aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_spanningtree/fjoin.cpp
diff options
context:
space:
mode:
authorGravatar Daniel De Graaf2010-02-19 11:00:38 -0600
committerGravatar Daniel De Graaf2010-08-03 17:32:36 -0400
commit23a506f04b2966caf939ea8ad166e8455095657c (patch)
treec7e02ccb21c513d3769fbf10c90a622611772960 /src/modules/m_spanningtree/fjoin.cpp
parentFix ban/invex entries in 005 line (diff)
Read FJOIN lines more sensibly
Diffstat (limited to 'src/modules/m_spanningtree/fjoin.cpp')
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp60
1 files changed, 21 insertions, 39 deletions
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index a3ceddce2..b4ec1e189 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -122,49 +122,31 @@ CmdResult CommandFJoin::Handle(const std::vector<std::string>& params, User *src
/* Now, process every 'modes,nick' pair */
while (users.GetToken(item))
{
- const char* usr = item.c_str();
- if (usr && *usr)
- {
- const char* unparsedmodes = usr;
- std::string modes;
-
-
- /* Iterate through all modes for this user and check they are valid. */
- while ((*unparsedmodes) && (*unparsedmodes != ','))
- {
- ModeHandler *mh = ServerInstance->Modes->FindMode(*unparsedmodes, MODETYPE_CHANNEL);
- if (mh)
- modes += *unparsedmodes;
- else
- return CMD_INVALID;
+ std::string::size_type comma = item.find(',');
+ if (comma == std::string::npos)
+ continue;
- usr++;
- unparsedmodes++;
- }
+ std::string modes = item.substr(0, comma);
- /* Advance past the comma, to the nick */
- usr++;
-
- /* Check the user actually exists */
- who = ServerInstance->FindUUID(usr);
- if (who)
- {
- /* Check that the user's 'direction' is correct */
- TreeServer* route_back_again = Utils->BestRouteTo(who->server);
- if ((!route_back_again) || (route_back_again->GetSocket() != src_socket))
- continue;
+ /* Check the user actually exists */
+ who = ServerInstance->FindUUID(item.substr(comma + 1));
+ if (who)
+ {
+ /* Check that the user's 'direction' is correct */
+ TreeServer* route_back_again = Utils->BestRouteTo(who->server);
+ if ((!route_back_again) || (route_back_again->GetSocket() != src_socket))
+ continue;
- /* Add any modes this user had to the mode stack */
- for (std::string::iterator x = modes.begin(); x != modes.end(); ++x)
- modestack.push(irc::modechange(*x, MODETYPE_CHANNEL, who->nick, true));
+ /* Add any modes this user had to the mode stack */
+ for (std::string::iterator x = modes.begin(); x != modes.end(); ++x)
+ modestack.push(irc::modechange(*x, MODETYPE_CHANNEL, who->uuid, true));
- Channel::JoinUser(who, channel.c_str(), true, "", route_back_again->bursting, TS);
- }
- else
- {
- ServerInstance->Logs->Log("m_spanningtree",SPARSE, "Ignored nonexistant user %s in fjoin to %s (probably quit?)", usr, channel.c_str());
- continue;
- }
+ Channel::JoinUser(who, channel.c_str(), true, "", route_back_again->bursting, TS);
+ }
+ else
+ {
+ ServerInstance->Logs->Log("m_spanningtree",SPARSE, "Ignored nonexistant user %s in fjoin to %s (probably quit?)", item.c_str(), channel.c_str());
+ continue;
}
}