internal_userlist.erase(a);
return;
}
- log(DEBUG,"BUG BUG BUG! Attempt to remove an uncasted user from the internal list of %s!",name);
+ /* Tidy up any others */
+ DelOppedUser(castuser);
+ DelHalfoppedUser(castuser);
+ DelVoicedUser(castuser);
+}
+
+void chanrec::AddOppedUser(char* castuser)
+{
+ internal_op_userlist[castuser] = castuser;
+ log(DEBUG,"Added casted user to channel's internal list");
+}
+
+void chanrec::DelOppedUser(char* castuser)
+{
+ std::map<char*,char*>::iterator a = internal_op_userlist.find(castuser);
+ if (a != internal_op_userlist.end())
+ {
+ log(DEBUG,"Removed casted user from channel's internal list");
+ internal_op_userlist.erase(a);
+ return;
+ }
+}
+
+void chanrec::AddHalfoppedUser(char* castuser)
+{
+ internal_halfop_userlist[castuser] = castuser;
+ log(DEBUG,"Added casted user to channel's internal list");
+}
+
+void chanrec::DelHalfoppedUser(char* castuser)
+{
+ std::map<char*,char*>::iterator a = internal_halfop_userlist.find(castuser);
+ if (a != internal_halfop_userlist.end())
+ {
+ log(DEBUG,"Removed casted user from channel's internal list");
+ internal_halfop_userlist.erase(a);
+ return;
+ }
+}
+
+void chanrec::AddVoicedUser(char* castuser)
+{
+ internal_voice_userlist[castuser] = castuser;
+ log(DEBUG,"Added casted user to channel's internal list");
+}
+
+void chanrec::DelVoicedUser(char* castuser)
+{
+ std::map<char*,char*>::iterator a = internal_voice_userlist.find(castuser);
+ if (a != internal_voice_userlist.end())
+ {
+ log(DEBUG,"Removed casted user from channel's internal list");
+ internal_voice_userlist.erase(a);
+ return;
+ }
}
std::map<char*,char*> *chanrec::GetUsers()
return &internal_userlist;
}
+std::map<char*,char*> *chanrec::GetOppedUsers()
+{
+ return &internal_op_userlist;
+}
+
+std::map<char*,char*> *chanrec::GetHalfoppedUsers()
+{
+ return &internal_halfop_userlist;
+}
+
+std::map<char*,char*> *chanrec::GetVoicedUsers()
+{
+ return &internal_voice_userlist;
+}
+
/* add a channel to a user, creating the record for it if needed and linking
* it to the user record */
{
/* first user in is given ops */
a.uc_modes = UCMODE_OP;
+ Ptr->AddOppedUser((char*)user);
}
else
{
return;
}
- if (!has_channel(user,Ptr))
+ if (IS_LOCAL(user))
{
- /* Not on channel */
- return;
+ if (!has_channel(user,Ptr))
+ {
+ /* Not on channel */
+ return;
+ }
}
-
+
if (triggerevents)
{
FOREACH_MOD(I_OnUserKick,OnUserKick(NULL,user,Ptr,reason));
log(DEBUG,"kick_channel: removing: %s %s %s",user->nick,Ptr->name,src->nick);
- if (!has_channel(user,Ptr))
- {
- WriteServ(src->fd,"441 %s %s %s :They are not on that channel",src->nick, user->nick, Ptr->name);
- return;
- }
-
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(src,user,Ptr,AC_KICK));
- if ((MOD_RESULT == ACR_DENY) && (!is_uline(src->server)))
- return;
-
- if ((MOD_RESULT == ACR_DEFAULT) || (!is_uline(src->server)))
- {
- if ((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr)))
- {
- if (cstatus(src,Ptr) == STATUS_HOP)
- {
- WriteServ(src->fd,"482 %s %s :You must be a channel operator",src->nick, Ptr->name);
- }
- else
- {
- WriteServ(src->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",src->nick, Ptr->name);
- }
-
- return;
- }
- }
-
- if (!is_uline(src->server))
- {
- MOD_RESULT = 0;
- FOREACH_RESULT(I_OnUserPreKick,OnUserPreKick(src,user,Ptr,reason));
- if (MOD_RESULT)
- return;
- }
+ if (IS_LOCAL(user))
+ {
+ if (!has_channel(user,Ptr))
+ {
+ WriteServ(src->fd,"441 %s %s %s :They are not on that channel",src->nick, user->nick, Ptr->name);
+ return;
+ }
+ int MOD_RESULT = 0;
+ FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(src,user,Ptr,AC_KICK));
+ if ((MOD_RESULT == ACR_DENY) && (!is_uline(src->server)))
+ return;
+
+ if ((MOD_RESULT == ACR_DEFAULT) || (!is_uline(src->server)))
+ {
+ if ((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr)))
+ {
+ if (cstatus(src,Ptr) == STATUS_HOP)
+ {
+ WriteServ(src->fd,"482 %s %s :You must be a channel operator",src->nick, Ptr->name);
+ }
+ else
+ {
+ WriteServ(src->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",src->nick, Ptr->name);
+ }
+
+ return;
+ }
+ }
+ if (!is_uline(src->server))
+ {
+ MOD_RESULT = 0;
+ FOREACH_RESULT(I_OnUserPreKick,OnUserPreKick(src,user,Ptr,reason));
+ if (MOD_RESULT)
+ return;
+ }
+ }
FOREACH_MOD(I_OnUserKick,OnUserKick(src,user,Ptr,reason));