*/
typedef std::map<userrec*,userrec*> CUList;
+/** Shorthand for CUList::iterator
+ */
+typedef CUList::iterator CUListIter;
+typedef CUList::const_iterator CUListConstIter;
+
/** A list of custom modes parameters on a channel
*/
typedef std::map<char,char*> CustomModeList;
void server_kick_channel(userrec* user, chanrec* Ptr, char* reason, bool triggerevents);
#endif
-
*/
typedef std::vector<ConnectClass> ClassVector;
+/** Typedef for the list of user-channel records for a user
+ */
+typedef std::vector<ucrec*> UserChanList;
+
/** Holds all information about a user
* This class stores all information about a user connected to the irc server. Everything about a
* connection is stored here primarily, from the user's socket ID (file descriptor) through to the
*/
char modebits;
- std::vector<ucrec*> chans;
+ UserChanList chans;
/** The server the user is connected to.
*/
unsigned long chanrec::DelUser(userrec* user)
{
- CUList::iterator a = internal_userlist.find(user);
+ CUListIter a = internal_userlist.find(user);
+
if (a != internal_userlist.end())
{
internal_userlist.erase(a);
DelOppedUser(user);
DelHalfoppedUser(user);
DelVoicedUser(user);
- return internal_userlist.size();
}
+
return internal_userlist.size();
}
void chanrec::DelOppedUser(userrec* user)
{
- CUList::iterator a = internal_op_userlist.find(user);
+ CUListIter a = internal_op_userlist.find(user);
if (a != internal_op_userlist.end())
{
internal_op_userlist.erase(a);
void chanrec::DelHalfoppedUser(userrec* user)
{
- CUList::iterator a = internal_halfop_userlist.find(user);
+ CUListIter a = internal_halfop_userlist.find(user);
+
if (a != internal_halfop_userlist.end())
{
internal_halfop_userlist.erase(a);
- return;
}
}
void chanrec::DelVoicedUser(userrec* user)
{
- CUList::iterator a = internal_voice_userlist.find(user);
+ CUListIter a = internal_voice_userlist.find(user);
+
if (a != internal_voice_userlist.end())
{
internal_voice_userlist.erase(a);
- return;
}
}
log(DEBUG,"Passed channel checks");
- for (std::vector<ucrec*>::const_iterator index = user->chans.begin(); index != user->chans.end(); index++)
+ for (UserChanList::const_iterator index = user->chans.begin(); index != user->chans.end(); index++)
{
if ((*index)->channel == NULL)
{
FOREACH_MOD(I_OnUserKick,OnUserKick(src,user,Ptr,reason));
- for (std::vector<ucrec*>::const_iterator i = user->chans.begin(); i != user->chans.end(); i++)
+ for (UserChanList::const_iterator i = user->chans.begin(); i != user->chans.end(); i++)
{
/* zap it from the channel list of the user */
if ((*i)->channel && ((*i)->channel == Ptr))