summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-10 00:26:04 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-10 00:26:04 +0000
commitce533b67e6c58c02f25b2f26214ab9cd2c7c99b6 (patch)
tree8769edc2d2620441182585c14884d2456e8d5982
parentb8015b09dcf4b49ceb695b188a2172548378e1db (diff)
Small api change with wide reaching effects in modules - Allows modification of whats displayed by NAMES on a per-nick basis, so we can have UHNAMES in a seperate module to NAMESX (and possibly do some funky other stuff in the future too!)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6934 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/channels.h2
-rw-r--r--src/channels.cpp32
-rw-r--r--src/cmd_notice.cpp2
-rw-r--r--src/cmd_privmsg.cpp2
-rw-r--r--src/cmd_who.cpp6
-rw-r--r--src/modes/cmode_h.cpp6
-rw-r--r--src/modes/cmode_o.cpp6
-rw-r--r--src/modes/cmode_v.cpp6
-rw-r--r--src/modules/m_auditorium.cpp2
-rw-r--r--src/modules/m_chanprotect.cpp16
-rw-r--r--src/modules/m_check.cpp2
-rw-r--r--src/modules/m_deaf.cpp6
-rw-r--r--src/modules/m_invisible.cpp6
-rw-r--r--src/modules/m_namesx.cpp6
-rw-r--r--src/modules/m_silence_ext.cpp6
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.cpp4
-rw-r--r--src/modules/m_spy.cpp2
-rw-r--r--src/modules/m_sslmodes.cpp2
-rw-r--r--src/users.cpp22
20 files changed, 69 insertions, 69 deletions
diff --git a/include/channels.h b/include/channels.h
index 0e60e305f..f68f83889 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -69,7 +69,7 @@ typedef std::vector<BanItem> BanList;
/** A list of users on a channel
*/
-typedef std::map<userrec*,userrec*> CUList;
+typedef std::map<userrec*,std::string> CUList;
/** Shorthand for CUList::iterator
*/
diff --git a/src/channels.cpp b/src/channels.cpp
index 74c617538..93f0f790c 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -83,7 +83,7 @@ long chanrec::GetUserCounter()
void chanrec::AddUser(userrec* user)
{
- internal_userlist[user] = user;
+ internal_userlist[user] = user->nick;
}
unsigned long chanrec::DelUser(userrec* user)
@@ -109,7 +109,7 @@ bool chanrec::HasUser(userrec* user)
void chanrec::AddOppedUser(userrec* user)
{
- internal_op_userlist[user] = user;
+ internal_op_userlist[user] = user->nick;
}
void chanrec::DelOppedUser(userrec* user)
@@ -124,7 +124,7 @@ void chanrec::DelOppedUser(userrec* user)
void chanrec::AddHalfoppedUser(userrec* user)
{
- internal_halfop_userlist[user] = user;
+ internal_halfop_userlist[user] = user->nick;
}
void chanrec::DelHalfoppedUser(userrec* user)
@@ -139,7 +139,7 @@ void chanrec::DelHalfoppedUser(userrec* user)
void chanrec::AddVoicedUser(userrec* user)
{
- internal_voice_userlist[user] = user;
+ internal_voice_userlist[user] = user->nick;
}
void chanrec::DelVoicedUser(userrec* user)
@@ -622,8 +622,8 @@ void chanrec::WriteChannel(userrec* user, const std::string &text)
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if (IS_LOCAL(i->second))
- i->second->Write(out);
+ if (IS_LOCAL(i->first))
+ i->first->Write(out);
}
}
@@ -652,8 +652,8 @@ void chanrec::WriteChannelWithServ(const char* ServName, const std::string &text
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if (IS_LOCAL(i->second))
- i->second->Write(out);
+ if (IS_LOCAL(i->first))
+ i->first->Write(out);
}
}
@@ -715,12 +715,12 @@ void chanrec::WriteAllExcept(userrec* user, bool serversource, char status, CULi
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if ((IS_LOCAL(i->second)) && (except_list.find(i->second) == except_list.end()))
+ if ((IS_LOCAL(i->first)) && (except_list.find(i->first) == except_list.end()))
{
if (serversource)
- i->second->WriteServ(text);
+ i->first->WriteServ(text);
else
- i->second->Write(out);
+ i->first->Write(out);
}
}
}
@@ -728,7 +728,7 @@ void chanrec::WriteAllExcept(userrec* user, bool serversource, char status, CULi
void chanrec::WriteAllExceptSender(userrec* user, bool serversource, char status, const std::string& text)
{
CUList except_list;
- except_list[user] = user;
+ except_list[user] = user->nick;
this->WriteAllExcept(user, serversource, status, except_list, std::string(text));
}
@@ -742,7 +742,7 @@ int chanrec::CountInvisible()
CUList *ulist= this->GetUsers();
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if (!(i->second->modes[UM_INVISIBLE]))
+ if (!(i->first->IsModeSet('i')))
count++;
}
@@ -831,7 +831,7 @@ void chanrec::UserList(userrec *user, CUList *ulist)
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if ((!has_user) && (i->second->modes[UM_INVISIBLE]))
+ if ((!has_user) && (i->first->modes[UM_INVISIBLE]))
{
/*
* user is +i, and source not on the channel, does not show
@@ -840,10 +840,10 @@ void chanrec::UserList(userrec *user, CUList *ulist)
continue;
}
- if (i->second->Visibility && !i->second->Visibility->VisibleTo(user))
+ if (i->first->Visibility && !i->first->Visibility->VisibleTo(user))
continue;
- size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", this->GetPrefixChar(i->second), i->second->nick);
+ size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", this->GetPrefixChar(i->first), i->second.c_str());
curlen += ptrlen;
ptr += ptrlen;
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index 0a5aee051..b4e4dd7c4 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -62,7 +62,7 @@ CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
{
chan = ServerInstance->FindChan(parameters[0]);
- exempt_list[user] = user;
+ exempt_list[user] = user->nick;
if (chan)
{
diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp
index 425465109..b0662cfec 100644
--- a/src/cmd_privmsg.cpp
+++ b/src/cmd_privmsg.cpp
@@ -64,7 +64,7 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
{
chan = ServerInstance->FindChan(parameters[0]);
- except_list[user] = user;
+ except_list[user] = user->nick;
if (chan)
{
diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp
index 5992d7aa0..ff29447fb 100644
--- a/src/cmd_who.cpp
+++ b/src/cmd_who.cpp
@@ -259,14 +259,14 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
for (CUList::iterator i = cu->begin(); i != cu->end(); i++)
{
/* opers only, please */
- if (opt_viewopersonly && !IS_OPER(i->second))
+ if (opt_viewopersonly && !IS_OPER(i->first))
continue;
/* If we're not inside the channel, hide +i users */
- if (i->second->IsModeSet('i') && !inside)
+ if (i->first->IsModeSet('i') && !inside)
continue;
- SendWhoLine(user, initial, ch, i->second, whoresults);
+ SendWhoLine(user, initial, ch, i->first, whoresults);
}
}
}
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp
index 9bd061cd2..4ecf17c36 100644
--- a/src/modes/cmode_h.cpp
+++ b/src/modes/cmode_h.cpp
@@ -55,13 +55,13 @@ void ModeChannelHalfOp::RemoveMode(chanrec* channel)
for (CUList::iterator i = list->begin(); i != list->end(); i++)
{
- userrec* n = i->second;
- copy.insert(std::make_pair(n,n));
+ userrec* n = i->first;
+ copy.insert(std::make_pair(n,n->nick));
}
for (CUList::iterator i = copy.begin(); i != copy.end(); i++)
{
sprintf(moderemove,"-%c",this->GetModeChar());
- const char* parameters[] = { channel->name, moderemove, i->second->nick };
+ const char* parameters[] = { channel->name, moderemove, i->first->nick };
ServerInstance->SendMode(parameters, 3, n);
}
delete n;
diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp
index 855976bba..a77b40ce0 100644
--- a/src/modes/cmode_o.cpp
+++ b/src/modes/cmode_o.cpp
@@ -56,13 +56,13 @@ void ModeChannelOp::RemoveMode(chanrec* channel)
for (CUList::iterator i = list->begin(); i != list->end(); i++)
{
- userrec* n = i->second;
- copy.insert(std::make_pair(n,n));
+ userrec* n = i->first;
+ copy.insert(std::make_pair(n,n->nick));
}
for (CUList::iterator i = copy.begin(); i != copy.end(); i++)
{
sprintf(moderemove,"-%c",this->GetModeChar());
- const char* parameters[] = { channel->name, moderemove, i->second->nick };
+ const char* parameters[] = { channel->name, moderemove, i->first->nick };
ServerInstance->SendMode(parameters, 3, n);
}
delete n;
diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp
index 1c3c23527..088726208 100644
--- a/src/modes/cmode_v.cpp
+++ b/src/modes/cmode_v.cpp
@@ -55,13 +55,13 @@ void ModeChannelVoice::RemoveMode(chanrec* channel)
for (CUList::iterator i = list->begin(); i != list->end(); i++)
{
- userrec* n = i->second;
- copy.insert(std::make_pair(n,n));
+ userrec* n = i->first;
+ copy.insert(std::make_pair(n,n->nick));
}
for (CUList::iterator i = copy.begin(); i != copy.end(); i++)
{
sprintf(moderemove,"-%c",this->GetModeChar());
- const char* parameters[] = { channel->name, moderemove, i->second->nick };
+ const char* parameters[] = { channel->name, moderemove, i->first->nick };
ServerInstance->SendMode(parameters, 3, n);
}
delete n;
diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp
index c49391d2f..166d1bcc4 100644
--- a/src/modules/m_auditorium.cpp
+++ b/src/modules/m_auditorium.cpp
@@ -107,7 +107,7 @@ class ModuleAuditorium : public Module
/* Show all the opped users */
nl = *(Ptr->GetOppedUsers());
- nl[user] = user;
+ nl[user] = user->nick;
nameslist = &nl;
return 0;
}
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 3f44fd93e..81cf34c0c 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -88,9 +88,9 @@ class FounderProtectBase
std::deque<std::string> stackresult;
for (CUList::iterator i = cl->begin(); i != cl->end(); i++)
{
- if (i->second->GetExt(item, dummyptr))
+ if (i->first->GetExt(item, dummyptr))
{
- modestack.Push(mc, i->second->nick);
+ modestack.Push(mc, i->first->nick);
}
}
@@ -113,9 +113,9 @@ class FounderProtectBase
std::string item = extend+std::string(channel->name);
for (CUList::iterator i = cl->begin(); i != cl->end(); i++)
{
- if (i->second->GetExt(item, dummyptr))
+ if (i->first->GetExt(item, dummyptr))
{
- user->WriteServ("%d %s %s %s", list, user->nick, channel->name,i->second->nick);
+ user->WriteServ("%d %s %s %s", list, user->nick, channel->name,i->first->nick);
}
}
user->WriteServ("%d %s %s :End of channel %s list", end, user->nick, channel->name, type.c_str());
@@ -508,13 +508,13 @@ class ModuleChanProtect : public Module
std::deque<std::string> stackresult;
for (CUList::iterator i = cl->begin(); i != cl->end(); i++)
{
- if (i->second->GetExt(founder,dummyptr))
+ if (i->first->GetExt(founder,dummyptr))
{
- modestack.Push('q',i->second->nick);
+ modestack.Push('q',i->first->nick);
}
- if (i->second->GetExt(protect,dummyptr))
+ if (i->first->GetExt(protect,dummyptr))
{
- modestack.Push('a',i->second->nick);
+ modestack.Push('a',i->first->nick);
}
}
while (modestack.GetStackedLine(stackresult))
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 5304347c2..23b641294 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -119,7 +119,7 @@ class cmd_check : public command_t
/*
* Unlike Asuka, I define a clone as coming from the same host. --w00t
*/
- snprintf(tmpbuf, MAXBUF, "%lu %s%s (%s@%s) %s ", i->second->GlobalCloneCount(), targchan->GetAllPrefixChars(i->second), i->second->nick, i->second->ident, i->second->dhost, i->second->fullname);
+ snprintf(tmpbuf, MAXBUF, "%lu %s%s (%s@%s) %s ", i->first->GlobalCloneCount(), targchan->GetAllPrefixChars(i->first), i->first->nick, i->first->ident, i->first->dhost, i->first->fullname);
user->WriteServ(checkstr + " member " + tmpbuf);
}
}
diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp
index 69fde96f1..2278479cc 100644
--- a/src/modules/m_deaf.cpp
+++ b/src/modules/m_deaf.cpp
@@ -95,11 +95,11 @@ class ModuleDeaf : public Module
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if (IS_LOCAL(i->second))
+ if (IS_LOCAL(i->first))
{
- if (i->second->IsModeSet('d'))
+ if (i->first->IsModeSet('d'))
{
- exempt_list[i->second] = i->second;
+ exempt_list[i->first] = i->first->nick;
}
}
}
diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp
index 29b741425..ee6334f5e 100644
--- a/src/modules/m_invisible.cpp
+++ b/src/modules/m_invisible.cpp
@@ -98,11 +98,11 @@ class InvisibleMode : public ModeHandler
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
/* User only appears to vanish for non-opers */
- if (IS_LOCAL(i->second) && !IS_OPER(i->second))
+ if (IS_LOCAL(i->first) && !IS_OPER(i->first))
{
- i->second->Write(out);
+ i->first->Write(out);
if (!n.empty() && !adding)
- i->second->WriteServ("MODE %s +%s", f->first->name, n.c_str());
+ i->first->WriteServ("MODE %s +%s", f->first->name, n.c_str());
}
}
diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp
index 5194224b7..8d2be49e5 100644
--- a/src/modules/m_namesx.cpp
+++ b/src/modules/m_namesx.cpp
@@ -83,13 +83,13 @@ class ModuleNamesX : public Module
bool has_user = Ptr->HasUser(user);
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if ((!has_user) && (i->second->modes[UM_INVISIBLE]))
+ if ((!has_user) && (i->first->IsModeSet('i')))
continue;
- if (i->second->Visibility && !i->second->Visibility->VisibleTo(user))
+ if (i->first->Visibility && !i->first->Visibility->VisibleTo(user))
continue;
- size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", Ptr->GetAllPrefixChars(i->second), i->second->nick);
+ size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", Ptr->GetAllPrefixChars(i->first), i->second.c_str());
curlen += ptrlen;
ptr += ptrlen;
numusers++;
diff --git a/src/modules/m_silence_ext.cpp b/src/modules/m_silence_ext.cpp
index 9b93e56f4..ef7a46cd1 100644
--- a/src/modules/m_silence_ext.cpp
+++ b/src/modules/m_silence_ext.cpp
@@ -289,11 +289,11 @@ class ModuleSilence : public Module
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if (IS_LOCAL(i->second))
+ if (IS_LOCAL(i->first))
{
- if (MatchPattern(i->second, sender, public_silence) == 1)
+ if (MatchPattern(i->first, sender, public_silence) == 1)
{
- exempt_list[i->second] = i->second;
+ exempt_list[i->first] = i->first->nick;
}
}
}
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index ddfc2f18e..e6c9eeb49 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -999,7 +999,7 @@ void TreeSocket::SendFJoins(TreeServer* Current, chanrec* c)
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
// The first parameter gets a : before it
- size_t ptrlen = snprintf(ptr, MAXBUF, " %s%s,%s", !numusers ? ":" : "", c->GetAllPrefixChars(i->second), i->second->nick);
+ size_t ptrlen = snprintf(ptr, MAXBUF, " %s%s,%s", !numusers ? ":" : "", c->GetAllPrefixChars(i->first), i->first->nick);
curlen += ptrlen;
ptr += ptrlen;
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index e1026ca94..b3394dd55 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -208,9 +208,9 @@ void SpanningTreeUtilities::GetListOfServersForChannel(chanrec* c, TreeServerLis
}
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if ((i->second->GetFd() < 0) && (exempt_list.find(i->second) == exempt_list.end()))
+ if ((i->first->GetFd() < 0) && (exempt_list.find(i->first) == exempt_list.end()))
{
- TreeServer* best = this->BestRouteTo(i->second->server);
+ TreeServer* best = this->BestRouteTo(i->first->server);
if (best)
AddThisServer(best,list);
}
diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp
index de48284ba..7c91119b7 100644
--- a/src/modules/m_spy.cpp
+++ b/src/modules/m_spy.cpp
@@ -39,7 +39,7 @@ void spy_userlist(userrec *user, chanrec *c)
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", c->GetPrefixChar(i->second), i->second->nick);
+ size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", c->GetPrefixChar(i->first), i->first->nick);
curlen += ptrlen;
ptr += ptrlen;
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index ff350a85e..36f1e428a 100644
--- a/src/modules/m_sslmodes.cpp
+++ b/src/modules/m_sslmodes.cpp
@@ -38,7 +38,7 @@ class SSLMode : public ModeHandler
CUList* userlist = channel->GetUsers();
for(CUList::iterator i = userlist->begin(); i != userlist->end(); i++)
{
- if(!i->second->GetExt("ssl", dummy))
+ if(!i->first->GetExt("ssl", dummy))
{
source->WriteServ("490 %s %s :all members of the channel must be connected via SSL", source->nick, channel->name);
return MODEACTION_DENY;
diff --git a/src/users.cpp b/src/users.cpp
index ba5d7c25e..e9b61f67f 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1474,10 +1474,10 @@ void userrec::WriteCommon(const std::string &text)
CUList* ulist = v->first->GetUsers();
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if ((IS_LOCAL(i->second)) && (already_sent[i->second->fd] != uniq_id))
+ if ((IS_LOCAL(i->first)) && (already_sent[i->first->fd] != uniq_id))
{
- already_sent[i->second->fd] = uniq_id;
- i->second->Write(out);
+ already_sent[i->first->fd] = uniq_id;
+ i->first->Write(out);
sent_to_at_least_one = true;
}
}
@@ -1535,12 +1535,12 @@ void userrec::WriteCommonQuit(const std::string &normal_text, const std::string
CUList *ulist = v->first->GetUsers();
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if (this != i->second)
+ if (this != i->first)
{
- if ((IS_LOCAL(i->second)) && (already_sent[i->second->fd] != uniq_id))
+ if ((IS_LOCAL(i->first)) && (already_sent[i->first->fd] != uniq_id))
{
- already_sent[i->second->fd] = uniq_id;
- i->second->Write(*i->second->oper ? out2 : out1);
+ already_sent[i->first->fd] = uniq_id;
+ i->first->Write(IS_OPER(i->first) ? out2 : out1);
}
}
}
@@ -1564,12 +1564,12 @@ void userrec::WriteCommonExcept(const std::string &text)
CUList *ulist = v->first->GetUsers();
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if (this != i->second)
+ if (this != i->first)
{
- if ((IS_LOCAL(i->second)) && (already_sent[i->second->fd] != uniq_id))
+ if ((IS_LOCAL(i->first)) && (already_sent[i->first->fd] != uniq_id))
{
- already_sent[i->second->fd] = uniq_id;
- i->second->Write(out1);
+ already_sent[i->first->fd] = uniq_id;
+ i->first->Write(out1);
}
}
}