diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-10 19:48:30 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-10 19:48:30 +0000 |
commit | 1a3297e97427c3dd6c0d25c6c0591fbbdb94d8a7 (patch) | |
tree | 03cd44ffb6650ac29c50387daf44f4abae1bc807 /src | |
parent | 2bbe76b1980aef7c91a15e3d6201bc40e036cd8f (diff) |
* Fix ChanModes::ModeString to not try and set a key as a user mode ;)
* Tweak the way cyclehosts works, so that mode change is not echoed back to user who changes their host/ident
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5208 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 18 | ||||
-rw-r--r-- | src/cmd_notice.cpp | 2 | ||||
-rw-r--r-- | src/cmd_privmsg.cpp | 2 | ||||
-rw-r--r-- | src/mode.cpp | 3 | ||||
-rw-r--r-- | src/users.cpp | 12 |
5 files changed, 20 insertions, 17 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 732b253cc..8dd8b490e 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -690,28 +690,25 @@ void chanrec::WriteChannelWithServ(const char* ServName, const std::string &text /* write formatted text from a source user to all users on a channel except * for the sender (for privmsg etc) */ -void chanrec::WriteAllExceptSender(userrec* user, char status, char* text, ...) +void chanrec::WriteAllExceptSender(userrec* user, bool serversource, char status, char* text, ...) { char textbuffer[MAXBUF]; va_list argsPtr; - if (!user || !text) + if (!text) return; va_start(argsPtr, text); vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); - this->WriteAllExceptSender(user, status, std::string(textbuffer)); + this->WriteAllExceptSender(user, serversource, status, std::string(textbuffer)); } -void chanrec::WriteAllExceptSender(userrec* user, char status, const std::string& text) +void chanrec::WriteAllExceptSender(userrec* user, bool serversource, char status, const std::string& text) { CUList *ulist; - if (!user) - return; - switch (status) { case '@': @@ -731,7 +728,12 @@ void chanrec::WriteAllExceptSender(userrec* user, char status, const std::string for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) { if ((IS_LOCAL(i->second)) && (user != i->second)) - i->second->WriteFrom(user,text); + { + if (serversource) + i->second->WriteServ(text); + else + i->second->WriteFrom(user,text); + } } } diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp index d018e1eb2..6c0336fa5 100644 --- a/src/cmd_notice.cpp +++ b/src/cmd_notice.cpp @@ -93,7 +93,7 @@ CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user) return CMD_FAILURE; } - chan->WriteAllExceptSender(user, status, "NOTICE %s :%s", chan->name, parameters[1]); + chan->WriteAllExceptSender(user, false, status, "NOTICE %s :%s", chan->name, parameters[1]); FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,chan,TYPE_CHANNEL,parameters[1],status)); } diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp index 0623fcd85..18c6900f4 100644 --- a/src/cmd_privmsg.cpp +++ b/src/cmd_privmsg.cpp @@ -94,7 +94,7 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) return CMD_FAILURE; } - chan->WriteAllExceptSender(user, status, "PRIVMSG %s :%s", chan->name, parameters[1]); + chan->WriteAllExceptSender(user, false, status, "PRIVMSG %s :%s", chan->name, parameters[1]); FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,chan,TYPE_CHANNEL,parameters[1],status)); } else diff --git a/src/mode.cpp b/src/mode.cpp index bddd6cc31..13bfe234b 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -734,7 +734,8 @@ std::string ModeParser::ModeString(userrec* user, chanrec* channel) { ModePair ret; ret = mh->ModeSet(NULL, user, channel, user->nick); - if (ret.first) + ServerInstance->Log(DEBUG,"first='%d' second='%s'",ret.first,ret.second.c_str()); + if ((ret.first) && (ret.second == user->nick)) { pars.append(" "); pars.append(user->nick); diff --git a/src/users.cpp b/src/users.cpp index 56d578687..8c6711d64 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1754,10 +1754,10 @@ bool userrec::ChangeDisplayedHost(const char* host) { if ((*i)->channel) { - (*i)->channel->WriteAllExceptSender(this, 0, "JOIN %s", (*i)->channel->name); + (*i)->channel->WriteAllExceptSender(this, false, 0, "JOIN %s", (*i)->channel->name); std::string n = this->ServerInstance->Modes->ModeString(this, (*i)->channel); - if (n.length()) - (*i)->channel->WriteChannelWithServ(this->ServerInstance->Config->ServerName, "MODE %s +%s", (*i)->channel->name, n.c_str()); + if (n.length() > 0) + (*i)->channel->WriteAllExceptSender(this, true, 0, "MODE %s +%s", (*i)->channel->name, n.c_str()); } } } @@ -1784,10 +1784,10 @@ bool userrec::ChangeIdent(const char* newident) { if ((*i)->channel) { - (*i)->channel->WriteAllExceptSender(this, 0, "JOIN %s", (*i)->channel->name); + (*i)->channel->WriteAllExceptSender(this, false, 0, "JOIN %s", (*i)->channel->name); std::string n = this->ServerInstance->Modes->ModeString(this, (*i)->channel); - if (n.length()) - (*i)->channel->WriteChannelWithServ(this->ServerInstance->Config->ServerName, "MODE %s +%s", (*i)->channel->name, n.c_str()); + if (n.length() > 0) + (*i)->channel->WriteAllExceptSender(this, true, 0, "MODE %s +%s", (*i)->channel->name, n.c_str()); } } } |