summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/m_spanningtree.cpp97
1 files changed, 51 insertions, 46 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index d8f4821ba..0ecc595fc 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -927,56 +927,61 @@ class TreeSocket : public InspSocket
{
/* process one channel at a time, applying modes. */
char* usr = (char*)params[usernum].c_str();
- char permissions = *usr;
- switch (permissions)
- {
- case '@':
- usr++;
- mode_users[modectr++] = usr;
- strlcat(modestring,"o",MAXBUF);
- break;
- case '%':
- usr++;
- mode_users[modectr++] = usr;
- strlcat(modestring,"h",MAXBUF);
- break;
- case '+':
- usr++;
- mode_users[modectr++] = usr;
- strlcat(modestring,"v",MAXBUF);
- break;
- }
- who = Srv->FindNick(usr);
- if (who)
- {
- Srv->JoinUserToChannel(who,channel,key);
- if (modectr >= (MAXMODES-1))
- {
- /* theres a mode for this user. push them onto the mode queue, and flush it
- * if there are more than MAXMODES to go.
- */
- if ((ourTS >= TS) || (Srv->IsUlined(who->server)))
- {
- /* We also always let u-lined clients win, no matter what the TS value */
- log(DEBUG,"Our our channel newer than theirs, accepting their modes");
- Srv->SendMode(mode_users,modectr,who);
- }
- else
+ /* Safety check just to make sure someones not sent us an FJOIN full of spaces
+ * (is this even possible?) */
+ if (usr && *usr)
+ {
+ char permissions = *usr;
+ switch (permissions)
+ {
+ case '@':
+ usr++;
+ mode_users[modectr++] = usr;
+ strlcat(modestring,"o",MAXBUF);
+ break;
+ case '%':
+ usr++;
+ mode_users[modectr++] = usr;
+ strlcat(modestring,"h",MAXBUF);
+ break;
+ case '+':
+ usr++;
+ mode_users[modectr++] = usr;
+ strlcat(modestring,"v",MAXBUF);
+ break;
+ }
+ who = Srv->FindNick(usr);
+ if (who)
+ {
+ Srv->JoinUserToChannel(who,channel,key);
+ if (modectr >= (MAXMODES-1))
{
- log(DEBUG,"Their channel newer than ours, bouncing their modes");
- /* bouncy bouncy! */
- std::deque<std::string> params;
- /* modes are now being UNSET... */
- *mode_users[1] = '-';
- for (unsigned int x = 0; x < modectr; x++)
+ /* theres a mode for this user. push them onto the mode queue, and flush it
+ * if there are more than MAXMODES to go.
+ */
+ if ((ourTS >= TS) || (Srv->IsUlined(who->server)))
+ {
+ /* We also always let u-lined clients win, no matter what the TS value */
+ log(DEBUG,"Our our channel newer than theirs, accepting their modes");
+ Srv->SendMode(mode_users,modectr,who);
+ }
+ else
{
- params.push_back(mode_users[x]);
+ log(DEBUG,"Their channel newer than ours, bouncing their modes");
+ /* bouncy bouncy! */
+ std::deque<std::string> params;
+ /* modes are now being UNSET... */
+ *mode_users[1] = '-';
+ for (unsigned int x = 0; x < modectr; x++)
+ {
+ params.push_back(mode_users[x]);
+ }
+ // tell everyone to bounce the modes. bad modes, bad!
+ DoOneToMany(Srv->GetServerName(),"FMODE",params);
}
- // tell everyone to bounce the modes. bad modes, bad!
- DoOneToMany(Srv->GetServerName(),"FMODE",params);
+ strcpy(mode_users[1],"+");
+ modectr = 2;
}
- strcpy(mode_users[1],"+");
- modectr = 2;
}
}
}