1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
20 Channel::Channel(const std::string &cname, time_t ts)
22 chan_hash::iterator findchan = ServerInstance->chanlist->find(cname);
23 if (findchan != ServerInstance->chanlist->end())
24 throw CoreException("Cannot create duplicate channel " + cname);
26 (*(ServerInstance->chanlist))[cname.c_str()] = this;
27 this->name.assign(cname, 0, ServerInstance->Config->Limits.ChanMax);
28 this->age = ts ? ts : ServerInstance->Time();
30 maxbans = topicset = 0;
34 void Channel::SetMode(char mode,bool mode_on)
36 modes[mode-65] = mode_on;
39 void Channel::SetModeParam(char mode, std::string parameter)
41 CustomModeList::iterator n = custom_mode_params.find(mode);
42 // always erase, even if changing, so that the map gets the new value
43 if (n != custom_mode_params.end())
44 custom_mode_params.erase(n);
45 if (parameter.empty())
47 modes[mode-65] = false;
51 custom_mode_params[mode] = parameter;
52 modes[mode-65] = true;
56 std::string Channel::GetModeParameter(char mode)
58 CustomModeList::iterator n = custom_mode_params.find(mode);
59 if (n != custom_mode_params.end())
64 int Channel::SetTopic(User *u, std::string &ntopic, bool forceset)
71 /* 0: check status, 1: don't, -1: disallow change silently */
73 FIRST_MOD_RESULT(OnPreTopicChange, res, (u,this,ntopic));
75 if (res == MOD_RES_DENY)
77 if (res != MOD_RES_ALLOW)
79 if (!this->HasUser(u))
81 u->WriteNumeric(442, "%s %s :You're not on that channel!",u->nick.c_str(), this->name.c_str());
84 if ((this->IsModeSet('t')) && (this->GetPrefixValue(u) < HALFOP_VALUE))
86 u->WriteNumeric(482, "%s %s :You must be at least a half-operator to change the topic on this channel", u->nick.c_str(), this->name.c_str());
93 this->topic.assign(ntopic, 0, ServerInstance->Config->Limits.MaxTopic);
96 this->setby.assign(ServerInstance->Config->FullHostInTopic ? u->GetFullHost() : u->nick, 0, 128);
97 this->WriteChannel(u, "TOPIC %s :%s", this->name.c_str(), this->topic.c_str());
101 this->setby.assign(ServerInstance->Config->ServerName);
102 this->WriteChannelWithServ(ServerInstance->Config->ServerName, "TOPIC %s :%s", this->name.c_str(), this->topic.c_str());
105 this->topicset = ServerInstance->Time();
107 // XXX: this check for 'u' is probably pre-fake-user, and it fucking sucks anyway. we need to change this.
110 FOREACH_MOD(I_OnPostTopicChange,OnPostTopicChange(u, this, this->topic));
116 long Channel::GetUserCounter()
118 return userlist.size();
121 Membership* Channel::AddUser(User* user)
123 Membership* memb = new Membership(user, this);
124 userlist[user] = memb;
128 void Channel::DelUser(User* user)
130 UserMembIter a = userlist.find(user);
132 if (a != userlist.end())
139 if (userlist.empty())
142 FIRST_MOD_RESULT(OnChannelPreDelete, res, (this));
143 if (res == MOD_RES_DENY)
145 chan_hash::iterator iter = ServerInstance->chanlist->find(this->name);
146 /* kill the record */
147 if (iter != ServerInstance->chanlist->end())
149 FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(this));
150 ServerInstance->chanlist->erase(iter);
152 ServerInstance->GlobalCulls.AddItem(this);
156 bool Channel::HasUser(User* user)
158 return (userlist.find(user) != userlist.end());
161 Membership* Channel::GetUser(User* user)
163 UserMembIter i = userlist.find(user);
164 if (i == userlist.end())
169 const UserMembList* Channel::GetUsers()
174 void Channel::SetDefaultModes()
176 ServerInstance->Logs->Log("CHANNELS", DEBUG, "SetDefaultModes %s",
177 ServerInstance->Config->DefaultModes.c_str());
178 irc::spacesepstream list(ServerInstance->Config->DefaultModes);
180 std::string parameter;
182 list.GetToken(modeseq);
184 for (std::string::iterator n = modeseq.begin(); n != modeseq.end(); ++n)
186 ModeHandler* mode = ServerInstance->Modes->FindMode(*n, MODETYPE_CHANNEL);
189 if (mode->GetNumParams(true))
190 list.GetToken(parameter);
194 mode->OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, this, parameter, true);
200 * add a channel to a user, creating the record for it if needed and linking
201 * it to the user record
203 Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char* key, bool bursting, time_t TS)
205 // Fix: unregistered users could be joined using /SAJOIN
206 if (!user || !cn || user->registered != REG_ALL)
214 * We don't restrict the number of channels that remote users or users that are override-joining may be in.
215 * We restrict local users to MaxChans channels.
216 * We restrict local operators to OperMaxChans channels.
217 * This is a lot more logical than how it was formerly. -- w00t
219 if (IS_LOCAL(user) && !override)
221 if (user->HasPrivPermission("channels/high-join-limit"))
223 if (user->chans.size() >= ServerInstance->Config->OperMaxChans)
225 user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn);
231 unsigned int maxchans = user->GetClass()->maxchans;
233 maxchans = ServerInstance->Config->MaxChans;
234 if (user->chans.size() >= maxchans)
236 user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn);
242 strlcpy(cname, cn, ServerInstance->Config->Limits.ChanMax);
243 Ptr = ServerInstance->FindChan(cname);
244 bool created_by_local = false;
249 * Fix: desync bug was here, don't set @ on remote users - spanningtree handles their permissions. bug #358. -- w00t
254 ServerInstance->Logs->Log("CHANNEL",DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick.c_str(), cn);
259 created_by_local = true;
262 if (IS_LOCAL(user) && override == false)
264 ModResult MOD_RESULT;
265 FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, NULL, cname, privs, key ? key : ""));
266 if (MOD_RESULT == MOD_RES_DENY)
270 Ptr = new Channel(cname, TS);
274 /* Already on the channel */
275 if (Ptr->HasUser(user))
279 * remote users are allowed us to bypass channel modes
280 * and bans (used by servers)
282 if (IS_LOCAL(user) && override == false)
284 ModResult MOD_RESULT;
285 FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, Ptr, cname, privs, key ? key : ""));
286 if (MOD_RESULT == MOD_RES_DENY)
290 else if (MOD_RESULT == MOD_RES_PASSTHRU)
292 std::string ckey = Ptr->GetModeParameter('k');
293 bool invited = IS_LOCAL(user)->IsInvited(Ptr->name.c_str());
294 bool can_bypass = ServerInstance->Config->InvBypassModes && invited;
298 FIRST_MOD_RESULT(OnCheckKey, MOD_RESULT, (user, Ptr, key ? key : ""));
299 if (!MOD_RESULT.check((key && ckey == key) || can_bypass))
301 // If no key provided, or key is not the right one, and can't bypass +k (not invited or option not enabled)
302 user->WriteNumeric(ERR_BADCHANNELKEY, "%s %s :Cannot join channel (Incorrect channel key)",user->nick.c_str(), Ptr->name.c_str());
307 if (Ptr->IsModeSet('i'))
309 FIRST_MOD_RESULT(OnCheckInvite, MOD_RESULT, (user, Ptr));
310 if (!MOD_RESULT.check(invited))
312 user->WriteNumeric(ERR_INVITEONLYCHAN, "%s %s :Cannot join channel (Invite only)",user->nick.c_str(), Ptr->name.c_str());
317 std::string limit = Ptr->GetModeParameter('l');
320 FIRST_MOD_RESULT(OnCheckLimit, MOD_RESULT, (user, Ptr));
321 if (!MOD_RESULT.check((Ptr->GetUserCounter() < atol(limit.c_str()) || can_bypass)))
323 user->WriteNumeric(ERR_CHANNELISFULL, "%s %s :Cannot join channel (Channel is full)",user->nick.c_str(), Ptr->name.c_str());
328 if (Ptr->IsBanned(user) && !can_bypass)
330 user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s %s :Cannot join channel (You're banned)",user->nick.c_str(), Ptr->name.c_str());
335 * If the user has invites for this channel, remove them now
336 * after a successful join so they don't build up.
340 IS_LOCAL(user)->RemoveInvite(Ptr->name.c_str());
346 if (created_by_local)
348 /* As spotted by jilles, dont bother to set this on remote users */
349 Ptr->SetDefaultModes();
352 return Channel::ForceChan(Ptr, user, privs, bursting, created_by_local);
355 Channel* Channel::ForceChan(Channel* Ptr, User* user, const std::string &privs, bool bursting, bool created)
357 std::string nick = user->nick;
359 Membership* memb = Ptr->AddUser(user);
360 user->chans.insert(Ptr);
362 for (std::string::const_iterator x = privs.begin(); x != privs.end(); x++)
364 const char status = *x;
365 ModeHandler* mh = ServerInstance->Modes->FindMode(status, MODETYPE_CHANNEL);
368 /* Set, and make sure that the mode handler knows this mode was now set */
369 Ptr->SetPrefix(user, mh->GetModeChar(), true);
370 mh->OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, Ptr, nick, true);
375 FOREACH_MOD(I_OnUserJoin,OnUserJoin(memb, bursting, created, except_list));
377 Ptr->WriteAllExcept(user, false, 0, except_list, "JOIN :%s", Ptr->name.c_str());
379 /* Theyre not the first ones in here, make sure everyone else sees the modes we gave the user */
380 std::string ms = memb->modes;
381 for(unsigned int i=0; i < memb->modes.length(); i++)
382 ms.append(" ").append(user->nick);
383 if ((Ptr->GetUserCounter() > 1) && (ms.length()))
384 Ptr->WriteAllExceptSender(user, true, 0, "MODE %s +%s", Ptr->name.c_str(), ms.c_str());
386 /* Major improvement by Brain - we dont need to be calculating all this pointlessly for remote users */
391 user->WriteNumeric(RPL_TOPIC, "%s %s :%s", user->nick.c_str(), Ptr->name.c_str(), Ptr->topic.c_str());
392 user->WriteNumeric(RPL_TOPICTIME, "%s %s %s %lu", user->nick.c_str(), Ptr->name.c_str(), Ptr->setby.c_str(), (unsigned long)Ptr->topicset);
396 FOREACH_MOD(I_OnPostJoin,OnPostJoin(memb));
400 bool Channel::IsBanned(User* user)
403 FIRST_MOD_RESULT(OnCheckChannelBan, result, (user, this));
405 if (result != MOD_RES_PASSTHRU)
406 return (result == MOD_RES_DENY);
408 for (BanList::iterator i = this->bans.begin(); i != this->bans.end(); i++)
410 if (CheckBan(user, i->data))
416 bool Channel::CheckBan(User* user, const std::string& mask)
419 FIRST_MOD_RESULT(OnCheckBan, result, (user, this, mask));
420 if (result != MOD_RES_PASSTHRU)
421 return (result == MOD_RES_DENY);
423 // extbans were handled above, if this is one it obviously didn't match
427 std::string::size_type at = mask.find('@');
428 if (at == std::string::npos)
431 char tomatch[MAXBUF];
432 snprintf(tomatch, MAXBUF, "%s!%s", user->nick.c_str(), user->ident.c_str());
433 std::string prefix = mask.substr(0, at);
434 if (InspIRCd::Match(tomatch, prefix, NULL))
436 std::string suffix = mask.substr(at + 1);
437 if (InspIRCd::Match(user->host, suffix, NULL) ||
438 InspIRCd::Match(user->dhost, suffix, NULL) ||
439 InspIRCd::MatchCIDR(user->GetIPString(), suffix, NULL))
445 ModResult Channel::GetExtBanStatus(User *user, char type)
448 FIRST_MOD_RESULT(OnExtBanCheck, rv, (user, this, type));
449 if (rv != MOD_RES_PASSTHRU)
451 for (BanList::iterator i = this->bans.begin(); i != this->bans.end(); i++)
453 if (i->data[0] == type && i->data[1] == ':')
455 std::string val = i->data.substr(2);
456 if (CheckBan(user, val))
460 return MOD_RES_PASSTHRU;
464 * remove a channel from a users record, and return the number of users left.
465 * Therefore, if this function returns 0 the caller should delete the Channel.
467 void Channel::PartUser(User *user, std::string &reason)
472 Membership* memb = GetUser(user);
477 FOREACH_MOD(I_OnUserPart,OnUserPart(memb, reason, except_list));
479 WriteAllExcept(user, false, 0, except_list, "PART %s%s%s", this->name.c_str(), reason.empty() ? "" : " :", reason.c_str());
481 user->chans.erase(this);
482 this->RemoveAllPrefixes(user);
488 void Channel::KickUser(User *src, User *user, const char* reason)
490 if (!src || !user || !reason)
493 Membership* memb = GetUser(user);
498 src->WriteNumeric(ERR_USERNOTINCHANNEL, "%s %s %s :They are not on that channel",src->nick.c_str(), user->nick.c_str(), this->name.c_str());
501 if ((ServerInstance->ULine(user->server)) && (!ServerInstance->ULine(src->server)))
503 src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only a u-line may kick a u-line from a channel.",src->nick.c_str(), this->name.c_str());
508 if (ServerInstance->ULine(src->server))
511 FIRST_MOD_RESULT(OnUserPreKick, res, (src,memb,reason));
513 if (res == MOD_RES_DENY)
516 if (res == MOD_RES_PASSTHRU)
518 int them = this->GetPrefixValue(src);
519 int us = this->GetPrefixValue(user);
520 if ((them < HALFOP_VALUE) || (them < us))
522 src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator",src->nick.c_str(), this->name.c_str(), them >= HALFOP_VALUE ? "" : "half-");
531 FOREACH_MOD(I_OnUserKick,OnUserKick(src, memb, reason, except_list));
533 WriteAllExcept(src, false, 0, except_list, "KICK %s %s :%s", name.c_str(), user->nick.c_str(), reason);
535 user->chans.erase(this);
536 this->RemoveAllPrefixes(user);
542 void Channel::WriteChannel(User* user, const char* text, ...)
544 char textbuffer[MAXBUF];
550 va_start(argsPtr, text);
551 vsnprintf(textbuffer, MAXBUF, text, argsPtr);
554 this->WriteChannel(user, std::string(textbuffer));
557 void Channel::WriteChannel(User* user, const std::string &text)
564 snprintf(tb,MAXBUF,":%s %s", user->GetFullHost().c_str(), text.c_str());
565 std::string out = tb;
567 for (UserMembIter i = userlist.begin(); i != userlist.end(); i++)
569 if (IS_LOCAL(i->first))
570 i->first->Write(out);
574 void Channel::WriteChannelWithServ(const std::string& ServName, const char* text, ...)
576 char textbuffer[MAXBUF];
582 va_start(argsPtr, text);
583 vsnprintf(textbuffer, MAXBUF, text, argsPtr);
586 this->WriteChannelWithServ(ServName, std::string(textbuffer));
589 void Channel::WriteChannelWithServ(const std::string& ServName, const std::string &text)
593 snprintf(tb,MAXBUF,":%s %s", ServName.empty() ? ServerInstance->Config->ServerName.c_str() : ServName.c_str(), text.c_str());
594 std::string out = tb;
596 for (UserMembIter i = userlist.begin(); i != userlist.end(); i++)
598 if (IS_LOCAL(i->first))
599 i->first->Write(out);
603 /* write formatted text from a source user to all users on a channel except
604 * for the sender (for privmsg etc) */
605 void Channel::WriteAllExceptSender(User* user, bool serversource, char status, const char* text, ...)
607 char textbuffer[MAXBUF];
613 va_start(argsPtr, text);
614 vsnprintf(textbuffer, MAXBUF, text, argsPtr);
617 this->WriteAllExceptSender(user, serversource, status, std::string(textbuffer));
620 void Channel::WriteAllExcept(User* user, bool serversource, char status, CUList &except_list, const char* text, ...)
622 char textbuffer[MAXBUF];
628 int offset = snprintf(textbuffer,MAXBUF,":%s ", user->GetFullHost().c_str());
630 va_start(argsPtr, text);
631 vsnprintf(textbuffer + offset, MAXBUF - offset, text, argsPtr);
634 this->RawWriteAllExcept(user, serversource, status, except_list, std::string(textbuffer));
637 void Channel::WriteAllExcept(User* user, bool serversource, char status, CUList &except_list, const std::string &text)
641 snprintf(tb,MAXBUF,":%s %s", serversource ? ServerInstance->Config->ServerName.c_str() : user->GetFullHost().c_str(), text.c_str());
642 std::string out = tb;
644 this->RawWriteAllExcept(user, serversource, status, except_list, std::string(tb));
647 void Channel::RawWriteAllExcept(User* user, bool serversource, char status, CUList &except_list, const std::string &out)
652 ModeHandler* mh = ServerInstance->Modes->FindPrefix(status);
654 statmode = mh->GetModeChar();
656 for (UserMembIter i = userlist.begin(); i != userlist.end(); i++)
658 if ((IS_LOCAL(i->first)) && (except_list.find(i->first) == except_list.end()))
660 /* User doesnt have the status we're after */
661 if (statmode && !i->second->hasMode(statmode))
664 i->first->Write(out);
669 void Channel::WriteAllExceptSender(User* user, bool serversource, char status, const std::string& text)
672 except_list.insert(user);
673 this->WriteAllExcept(user, serversource, status, except_list, std::string(text));
677 * return a count of the users on a specific channel accounting for
678 * invisible users who won't increase the count. e.g. for /LIST
680 int Channel::CountInvisible()
683 for (UserMembIter i = userlist.begin(); i != userlist.end(); i++)
685 if (!(i->first->IsModeSet('i')))
692 char* Channel::ChanModes(bool showkey)
694 static char scratch[MAXBUF];
695 static char sparam[MAXBUF];
696 char* offset = scratch;
697 std::string extparam;
702 /* This was still iterating up to 190, Channel::modes is only 64 elements -- Om */
703 for(int n = 0; n < 64; n++)
712 // Unfortunately this must be special-cased, as we definitely don't want to always display key.
715 extparam = this->GetModeParameter('k');
728 /* We know these have no parameters */
731 extparam = this->GetModeParameter(n + 65);
734 if (!extparam.empty())
736 charlcat(sparam,' ',MAXBUF);
737 strlcat(sparam,extparam.c_str(),MAXBUF);
742 /* Null terminate scratch */
744 strlcat(scratch,sparam,MAXBUF);
748 /* compile a userlist of a channel into a string, each nick seperated by
749 * spaces and op, voice etc status shown as @ and +, and send it to 'user'
751 void Channel::UserList(User *user)
755 ModResult call_modules;
760 FIRST_MOD_RESULT(OnUserList, call_modules, (user, this));
762 if (call_modules != MOD_RES_ALLOW)
764 if ((this->IsModeSet('s')) && (!this->HasUser(user)))
766 user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), this->name.c_str());
771 dlen = curlen = snprintf(list,MAXBUF,"%s %c %s :", user->nick.c_str(), this->IsModeSet('s') ? '@' : this->IsModeSet('p') ? '*' : '=', this->name.c_str());
774 char* ptr = list + dlen;
776 /* Improvement by Brain - this doesnt change in value, so why was it inside
779 bool has_user = this->HasUser(user);
781 for (UserMembIter i = userlist.begin(); i != userlist.end(); i++)
783 if ((!has_user) && (i->first->IsModeSet('i')))
786 * user is +i, and source not on the channel, does not show
792 std::string prefixlist = this->GetPrefixChar(i->first);
793 std::string nick = i->first->nick;
795 if (call_modules != MOD_RES_DENY)
797 FOREACH_MOD(I_OnNamesListItem, OnNamesListItem(user, i->second, prefixlist, nick));
799 /* Nick was nuked, a module wants us to skip it */
806 if (curlen + prefixlist.length() + nick.length() + 1 > 480)
808 /* list overflowed into multiple numerics */
809 user->WriteNumeric(RPL_NAMREPLY, std::string(list));
811 /* reset our lengths */
812 dlen = curlen = snprintf(list,MAXBUF,"%s %c %s :", user->nick.c_str(), this->IsModeSet('s') ? '@' : this->IsModeSet('p') ? '*' : '=', this->name.c_str());
819 ptrlen = snprintf(ptr, MAXBUF, "%s%s ", prefixlist.c_str(), nick.c_str());
827 /* if whats left in the list isnt empty, send it */
830 user->WriteNumeric(RPL_NAMREPLY, std::string(list));
833 user->WriteNumeric(RPL_ENDOFNAMES, "%s %s :End of /NAMES list.", user->nick.c_str(), this->name.c_str());
836 long Channel::GetMaxBans()
838 /* Return the cached value if there is one */
840 return this->maxbans;
842 /* If there isnt one, we have to do some O(n) hax to find it the first time. (ick) */
843 for (std::map<std::string,int>::iterator n = ServerInstance->Config->maxbans.begin(); n != ServerInstance->Config->maxbans.end(); n++)
845 if (InspIRCd::Match(this->name, n->first, NULL))
847 this->maxbans = n->second;
852 /* Screw it, just return the default of 64 */
854 return this->maxbans;
857 void Channel::ResetMaxBans()
862 /* returns the status character for a given user on a channel, e.g. @ for op,
863 * % for halfop etc. If the user has several modes set, the highest mode
864 * the user has must be returned.
866 const char* Channel::GetPrefixChar(User *user)
868 static char pf[2] = {0, 0};
870 unsigned int bestrank = 0;
872 UserMembIter m = userlist.find(user);
873 if (m != userlist.end())
875 for(unsigned int i=0; i < m->second->modes.length(); i++)
877 char mchar = m->second->modes[i];
878 ModeHandler* mh = ServerInstance->Modes->FindMode(mchar, MODETYPE_CHANNEL);
879 if (mh && mh->GetPrefixRank() > bestrank && mh->GetPrefix())
881 bestrank = mh->GetPrefixRank();
882 pf[0] = mh->GetPrefix();
889 unsigned int Membership::getRank()
891 char mchar = modes.c_str()[0];
895 ModeHandler* mh = ServerInstance->Modes->FindMode(mchar, MODETYPE_CHANNEL);
897 rv = mh->GetPrefixRank();
902 const char* Channel::GetAllPrefixChars(User* user)
904 static char prefix[64];
907 UserMembIter m = userlist.find(user);
908 if (m != userlist.end())
910 for(unsigned int i=0; i < m->second->modes.length(); i++)
912 char mchar = m->second->modes[i];
913 ModeHandler* mh = ServerInstance->Modes->FindMode(mchar, MODETYPE_CHANNEL);
914 if (mh && mh->GetPrefix())
915 prefix[ctr++] = mh->GetPrefix();
923 unsigned int Channel::GetPrefixValue(User* user)
925 UserMembIter m = userlist.find(user);
926 if (m == userlist.end())
928 return m->second->getRank();
931 void Channel::SetPrefix(User* user, char prefix, bool adding)
933 ModeHandler* delta_mh = ServerInstance->Modes->FindMode(prefix, MODETYPE_CHANNEL);
936 UserMembIter m = userlist.find(user);
937 if (m == userlist.end())
939 for(unsigned int i=0; i < m->second->modes.length(); i++)
941 char mchar = m->second->modes[i];
942 ModeHandler* mh = ServerInstance->Modes->FindMode(mchar, MODETYPE_CHANNEL);
943 if (mh && mh->GetPrefixRank() <= delta_mh->GetPrefixRank())
946 m->second->modes.substr(0,i) +
947 (adding ? std::string(1, prefix) : "") +
948 m->second->modes.substr(mchar == prefix ? i+1 : i);
953 m->second->modes += std::string(1, prefix);
956 void Channel::RemoveAllPrefixes(User* user)
958 UserMembIter m = userlist.find(user);
959 if (m != userlist.end())
961 m->second->modes.clear();