2
0
mirror of https://github.com/inspircd/inspircd.git synced 2025-03-23 17:39:03 -04:00

Relatively small typo fix

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6088 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
brain 2006-12-24 00:51:29 +00:00
parent 31f75f75be
commit 69b3f63bb1
2 changed files with 38 additions and 25 deletions

@ -815,7 +815,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
{ {
irc::whowas::MaintainWhoWas(this, TIME); irc::whowas::MaintainWhoWas(this, TIME);
this->RehashUsersAndChans(); this->RehashUsersAndChans();
FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect()); FOREACH_MOD_I(this, I_OnGarbageCollect, OnGarbageCollect());
} }
Timers->TickTimers(TIME); Timers->TickTimers(TIME);
this->DoBackgroundUserStuff(TIME); this->DoBackgroundUserStuff(TIME);

@ -68,7 +68,7 @@ typedef std::map<irc::string, std::string>
* NOTE: We do NOT iterate this to display a user's WATCH list! * NOTE: We do NOT iterate this to display a user's WATCH list!
* See the comments above! * See the comments above!
*/ */
watchentries whos_watching_me; watchentries* whos_watching_me;
/** Handle /WATCH /** Handle /WATCH
*/ */
@ -106,8 +106,8 @@ class cmd_watch : public command_t
delete wl; delete wl;
} }
watchentries::iterator x = whos_watching_me.find(nick); watchentries::iterator x = whos_watching_me->find(nick);
if (x != whos_watching_me.end()) if (x != whos_watching_me->end())
{ {
/* People are watching this user, am i one of them? */ /* People are watching this user, am i one of them? */
std::deque<userrec*>::iterator n = std::find(x->second.begin(), x->second.end(), user); std::deque<userrec*>::iterator n = std::find(x->second.begin(), x->second.end(), user);
@ -116,7 +116,7 @@ class cmd_watch : public command_t
x->second.erase(n); x->second.erase(n);
if (!x->second.size()) if (!x->second.size())
whos_watching_me.erase(nick); whos_watching_me->erase(nick);
} }
} }
@ -154,8 +154,8 @@ class cmd_watch : public command_t
{ {
ServerInstance->Log(DEBUG,"*** Add to WATCH: '%s'", nick); ServerInstance->Log(DEBUG,"*** Add to WATCH: '%s'", nick);
/* Don't already have the user on my watch list, proceed */ /* Don't already have the user on my watch list, proceed */
watchentries::iterator x = whos_watching_me.find(nick); watchentries::iterator x = whos_watching_me->find(nick);
if (x != whos_watching_me.end()) if (x != whos_watching_me->end())
{ {
/* People are watching this user, add myself */ /* People are watching this user, add myself */
x->second.push_back(user); x->second.push_back(user);
@ -164,7 +164,7 @@ class cmd_watch : public command_t
{ {
std::deque<userrec*> newlist; std::deque<userrec*> newlist;
newlist.push_back(user); newlist.push_back(user);
whos_watching_me[nick] = newlist; (*(whos_watching_me))[nick] = newlist;
} }
userrec* target = ServerInstance->FindNick(nick); userrec* target = ServerInstance->FindNick(nick);
@ -222,8 +222,8 @@ class cmd_watch : public command_t
{ {
for (watchlist::iterator i = wl->begin(); i != wl->end(); i++) for (watchlist::iterator i = wl->begin(); i != wl->end(); i++)
{ {
watchentries::iterator x = whos_watching_me.find(i->first); watchentries::iterator x = whos_watching_me->find(i->first);
if (x != whos_watching_me.end()) if (x != whos_watching_me->end())
{ {
/* People are watching this user, am i one of them? */ /* People are watching this user, am i one of them? */
std::deque<userrec*>::iterator n = std::find(x->second.begin(), x->second.end(), user); std::deque<userrec*>::iterator n = std::find(x->second.begin(), x->second.end(), user);
@ -232,7 +232,7 @@ class cmd_watch : public command_t
x->second.erase(n); x->second.erase(n);
if (!x->second.size()) if (!x->second.size())
whos_watching_me.erase(user->nick); whos_watching_me->erase(user->nick);
} }
} }
@ -269,8 +269,8 @@ class cmd_watch : public command_t
you_have = wl->size(); you_have = wl->size();
} }
watchentries::iterator x = whos_watching_me.find(user->nick); watchentries::iterator x = whos_watching_me->find(user->nick);
if (x != whos_watching_me.end()) if (x != whos_watching_me->end())
youre_on = x->second.size(); youre_on = x->second.size();
user->WriteServ("603 %s :You have %d and are on %d WATCH entries", user->nick, you_have, youre_on); user->WriteServ("603 %s :You have %d and are on %d WATCH entries", user->nick, you_have, youre_on);
@ -303,20 +303,21 @@ class Modulewatch : public Module
Modulewatch(InspIRCd* Me) Modulewatch(InspIRCd* Me)
: Module::Module(Me), maxwatch(32) : Module::Module(Me), maxwatch(32)
{ {
whos_watching_me = new watchentries();
mycommand = new cmd_watch(ServerInstance, maxwatch); mycommand = new cmd_watch(ServerInstance, maxwatch);
ServerInstance->AddCommand(mycommand); ServerInstance->AddCommand(mycommand);
} }
void Implements(char* List) void Implements(char* List)
{ {
List[I_OnCleanup] = List[I_OnUserQuit] = List[I_OnPostConnect] = List[I_OnUserPostNick] = List[I_On005Numeric] = 1; List[I_OnGarbageCollect] = List[I_OnCleanup] = List[I_OnUserQuit] = List[I_OnPostConnect] = List[I_OnUserPostNick] = List[I_On005Numeric] = 1;
} }
virtual void OnUserQuit(userrec* user, const std::string &reason) virtual void OnUserQuit(userrec* user, const std::string &reason)
{ {
ServerInstance->Log(DEBUG,"*** WATCH: On global quit: user %s",user->nick); ServerInstance->Log(DEBUG,"*** WATCH: On global quit: user %s",user->nick);
watchentries::iterator x = whos_watching_me.find(user->nick); watchentries::iterator x = whos_watching_me->find(user->nick);
if (x != whos_watching_me.end()) if (x != whos_watching_me->end())
{ {
for (std::deque<userrec*>::iterator n = x->second.begin(); n != x->second.end(); n++) for (std::deque<userrec*>::iterator n = x->second.begin(); n != x->second.end(); n++)
{ {
@ -335,8 +336,8 @@ class Modulewatch : public Module
/* Iterate every user on my watch list, and take me out of the whos_watching_me map for each one we're watching */ /* Iterate every user on my watch list, and take me out of the whos_watching_me map for each one we're watching */
for (watchlist::iterator i = wl->begin(); i != wl->end(); i++) for (watchlist::iterator i = wl->begin(); i != wl->end(); i++)
{ {
watchentries::iterator x = whos_watching_me.find(i->first); watchentries::iterator x = whos_watching_me->find(i->first);
if (x != whos_watching_me.end()) if (x != whos_watching_me->end())
{ {
/* People are watching this user, am i one of them? */ /* People are watching this user, am i one of them? */
std::deque<userrec*>::iterator n = std::find(x->second.begin(), x->second.end(), user); std::deque<userrec*>::iterator n = std::find(x->second.begin(), x->second.end(), user);
@ -345,7 +346,7 @@ class Modulewatch : public Module
x->second.erase(n); x->second.erase(n);
if (!x->second.size()) if (!x->second.size())
whos_watching_me.erase(user->nick); whos_watching_me->erase(user->nick);
} }
} }
@ -354,6 +355,17 @@ class Modulewatch : public Module
} }
} }
virtual void OnGarbageCollect()
{
watchentries* old_watch = whos_watching_me;
whos_watching_me = new watchentries();
for (watchentries::const_iterator n = old_watch->begin(); n != old_watch->end(); n++)
whos_watching_me->insert(*n);
delete old_watch;
}
virtual void OnCleanup(int target_type, void* item) virtual void OnCleanup(int target_type, void* item)
{ {
if (target_type == TYPE_USER) if (target_type == TYPE_USER)
@ -372,8 +384,8 @@ class Modulewatch : public Module
virtual void OnPostConnect(userrec* user) virtual void OnPostConnect(userrec* user)
{ {
ServerInstance->Log(DEBUG,"*** WATCH: On global connect: user %s",user->nick); ServerInstance->Log(DEBUG,"*** WATCH: On global connect: user %s",user->nick);
watchentries::iterator x = whos_watching_me.find(user->nick); watchentries::iterator x = whos_watching_me->find(user->nick);
if (x != whos_watching_me.end()) if (x != whos_watching_me->end())
{ {
for (std::deque<userrec*>::iterator n = x->second.begin(); n != x->second.end(); n++) for (std::deque<userrec*>::iterator n = x->second.begin(); n != x->second.end(); n++)
{ {
@ -390,10 +402,10 @@ class Modulewatch : public Module
{ {
ServerInstance->Log(DEBUG,"*** WATCH: On global nickchange: old nick: %s new nick: %s",oldnick.c_str(),user->nick); ServerInstance->Log(DEBUG,"*** WATCH: On global nickchange: old nick: %s new nick: %s",oldnick.c_str(),user->nick);
watchentries::iterator new_online = whos_watching_me.find(user->nick); watchentries::iterator new_online = whos_watching_me->find(user->nick);
watchentries::iterator new_offline = whos_watching_me.find(assign(oldnick)); watchentries::iterator new_offline = whos_watching_me->find(assign(oldnick));
if (new_online != whos_watching_me.end()) if (new_online != whos_watching_me->end())
{ {
for (std::deque<userrec*>::iterator n = new_online->second.begin(); n != new_online->second.end(); n++) for (std::deque<userrec*>::iterator n = new_online->second.begin(); n != new_online->second.end(); n++)
{ {
@ -406,7 +418,7 @@ class Modulewatch : public Module
} }
} }
if (new_offline != whos_watching_me.end()) if (new_offline != whos_watching_me->end())
{ {
for (std::deque<userrec*>::iterator n = new_offline->second.begin(); n != new_offline->second.end(); n++) for (std::deque<userrec*>::iterator n = new_offline->second.begin(); n != new_offline->second.end(); n++)
{ {
@ -430,6 +442,7 @@ class Modulewatch : public Module
virtual ~Modulewatch() virtual ~Modulewatch()
{ {
delete whos_watching_me;
} }
virtual Version GetVersion() virtual Version GetVersion()