diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-01-22 19:23:20 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-01-22 19:23:20 +0000 |
commit | 93e3cda102be0870171ecd9ad0d6507566c7ffd1 (patch) | |
tree | 5fda1d70ee8bad97c59c9dd16780e1c54e52c08d /src/channels.cpp | |
parent | e16c16e7a0cc59d85373f794d9179befe5a7a1f7 (diff) |
Added facility for servers to send KICK message (ew, i hate this crap)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2830 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 2b1fac5f2..9179c8002 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -451,6 +451,52 @@ chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool return NULL; } +void server_kick_channel(userrec* user, chanrec* Ptr, char* reason, bool triggerevents) +{ + if ((!user) || (!Ptr) || (!reason)) + { + return; + } + + if (!has_channel(user,Ptr)) + { + /* Not on channel */ + return; + } + + if (triggerevents) + { + FOREACH_MOD(I_OnUserKick,OnUserKick(NULL,user,Ptr,reason)); + } + + for (unsigned int i =0; i < user->chans.size(); i++) + { + if (user->chans[i].channel) + if (!strcasecmp(user->chans[i].channel->name,Ptr->name)) + { + WriteChannelWithServ(Ptr,"KICK %s %s :%s",Ptr->name, user->nick, reason); + user->chans[i].uc_modes = 0; + user->chans[i].channel = NULL; + break; + } + } + + Ptr->DelUser((char*)user); + + if (!usercount(Ptr)) + { + chan_hash::iterator iter = chanlist.find(Ptr->name); + log(DEBUG,"del_channel: destroying channel: %s",Ptr->name); + /* kill the record */ + if (iter != chanlist.end()) + { + log(DEBUG,"del_channel: destroyed: %s",Ptr->name); + FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(Ptr)); + delete Ptr; + chanlist.erase(iter); + } + } +} void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason) { @@ -460,11 +506,6 @@ void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason) return; } - if ((!Ptr) || (!user) || (!src)) - { - return; - } - log(DEBUG,"kick_channel: removing: %s %s %s",user->nick,Ptr->name,src->nick); if (!has_channel(user,Ptr)) |