summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp8
-rw-r--r--src/cmd_invite.cpp2
-rw-r--r--src/users.cpp42
3 files changed, 14 insertions, 38 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 8a857f4af..b6912e245 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -28,7 +28,6 @@ chanrec::chanrec(InspIRCd* Instance) : ServerInstance(Instance)
{
*name = *topic = *setby = *key = 0;
created = topicset = limit = 0;
- internal_userlist.clear();
memset(&modes,0,64);
age = ServerInstance->Time(true);
}
@@ -274,11 +273,10 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
if (Ptr->modes[CM_INVITEONLY])
{
MOD_RESULT = 0;
- irc::string xname(Ptr->name);
FOREACH_RESULT_I(Instance,I_OnCheckInvite,OnCheckInvite(user, Ptr));
if (!MOD_RESULT)
{
- if (user->IsInvited(xname))
+ if (user->IsInvited(Ptr->name))
{
/* user was invited to channel */
/* there may be an optional channel NOTICE here */
@@ -289,7 +287,7 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
return NULL;
}
}
- user->RemoveInvite(xname);
+ user->RemoveInvite(Ptr->name);
}
if (Ptr->limit)
{
@@ -367,7 +365,6 @@ chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr, userrec* user, con
dummyuser->SetFd(FD_MAGIC_NUMBER);
Ptr->AddUser(user);
- user->ModChannelCount(1);
/* Just in case they have no permissions */
user->chans[Ptr] = 0;
@@ -467,7 +464,6 @@ long chanrec::PartUser(userrec *user, const char* reason)
FOREACH_MOD(I_OnUserPart,OnUserPart(user, this, reason ? reason : ""));
this->WriteChannel(user, "PART %s%s%s", this->name, reason ? " :" : "", reason ? reason : "");
user->chans.erase(i);
- user->ModChannelCount(-1);
this->RemoveAllPrefixes(user);
}
diff --git a/src/cmd_invite.cpp b/src/cmd_invite.cpp
index 2458134f3..34ca04791 100644
--- a/src/cmd_invite.cpp
+++ b/src/cmd_invite.cpp
@@ -90,7 +90,7 @@ CmdResult cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
InvitedList* il = user->GetInviteList();
for (InvitedList::iterator i = il->begin(); i != il->end(); i++)
{
- user->WriteServ("346 %s :%s",user->nick,i->channel.c_str());
+ user->WriteServ("346 %s :%s",user->nick,i->c_str());
}
user->WriteServ("347 %s :End of INVITE list",user->nick);
}
diff --git a/src/users.cpp b/src/users.cpp
index 4408c1938..d67f96e4f 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -439,13 +439,11 @@ char* userrec::GetFullRealHost()
return fresult;
}
-bool userrec::IsInvited(irc::string &channel)
+bool userrec::IsInvited(const irc::string &channel)
{
for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
{
- irc::string compare = i->channel;
-
- if (compare == channel)
+ if (channel == *i)
{
return true;
}
@@ -458,30 +456,22 @@ InvitedList* userrec::GetInviteList()
return &invites;
}
-void userrec::InviteTo(irc::string &channel)
+void userrec::InviteTo(const irc::string &channel)
{
- Invited i;
- i.channel = channel;
- invites.push_back(i);
+ invites.push_back(channel);
}
-void userrec::RemoveInvite(irc::string &channel)
+void userrec::RemoveInvite(const irc::string &channel)
{
ServerInstance->Log(DEBUG,"Removing invites");
-
- if (invites.size())
+ for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
{
- for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
+ if (channel == *i)
{
- irc::string compare = i->channel;
-
- if (compare == channel)
- {
- invites.erase(i);
- return;
- }
- }
- }
+ invites.erase(i);
+ return;
+ }
+ }
}
bool userrec::HasPermission(const std::string &command)
@@ -1762,16 +1752,6 @@ bool userrec::SharesChannelWith(userrec *other)
return false;
}
-int userrec::CountChannels()
-{
- return ChannelCount;
-}
-
-void userrec::ModChannelCount(int n)
-{
- ChannelCount += n;
-}
-
bool userrec::ChangeName(const char* gecos)
{
if (!strcmp(gecos, this->fullname))