mirror of
https://github.com/anope/anope.git
synced 2026-06-25 02:46:37 +02:00
Made mlock_on, mlock_off, access, and akick private in ChannelInfo
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2630 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
+27
-7
@@ -12,7 +12,11 @@
|
||||
class CoreExport ChannelInfo : public Extensible
|
||||
{
|
||||
private:
|
||||
std::map<ChannelModeName, std::string> Params;
|
||||
std::map<ChannelModeName, std::string> Params; /* Map of parameters by mode name */
|
||||
std::vector<ChanAccess *> access; /* List of authorized users */
|
||||
std::vector<AutoKick *> akick; /* List of users to kickban */
|
||||
std::bitset<128> mlock_on; /* Modes mlocked on */
|
||||
std::bitset<128> mlock_off; /* Modes mlocked off */
|
||||
|
||||
public:
|
||||
ChannelInfo();
|
||||
@@ -39,12 +43,6 @@ class CoreExport ChannelInfo : public Extensible
|
||||
int16 bantype;
|
||||
int16 *levels; /* Access levels for commands */
|
||||
|
||||
std::vector<ChanAccess *> access; /* List of authorized users */
|
||||
std::vector<AutoKick *> akick; /* List of users to kickban */
|
||||
|
||||
std::bitset<128> mlock_on;
|
||||
std::bitset<128> mlock_off;
|
||||
|
||||
char *entry_message; /* Notice sent on entering channel */
|
||||
|
||||
MemoInfo memos;
|
||||
@@ -94,6 +92,11 @@ class CoreExport ChannelInfo : public Extensible
|
||||
*/
|
||||
ChanAccess *GetAccess(NickCore *nc, int16 level = 0);
|
||||
|
||||
/** Get the size of the accss vector for this channel
|
||||
* @return The access vector size
|
||||
*/
|
||||
const unsigned GetAccessCount() const;
|
||||
|
||||
/** Erase an entry from the channel access list
|
||||
*
|
||||
* @param index The index in the access list vector
|
||||
@@ -130,6 +133,17 @@ class CoreExport ChannelInfo : public Extensible
|
||||
*/
|
||||
AutoKick *AddAkick(const std::string &user, const std::string &mask, const std::string &reason, time_t t = time(NULL));
|
||||
|
||||
/** Get an entry from the channel akick list
|
||||
* @param index The index in the akick vector
|
||||
* @return The akick structure, or NULL if not found
|
||||
*/
|
||||
AutoKick *GetAkick(unsigned index);
|
||||
|
||||
/** Get the size of the akick vector for this channel
|
||||
* @return The akick vector size
|
||||
*/
|
||||
const unsigned GetAkickCount() const;
|
||||
|
||||
/** Erase an entry from the channel akick list
|
||||
* @param akick The akick
|
||||
*/
|
||||
@@ -162,6 +176,12 @@ class CoreExport ChannelInfo : public Extensible
|
||||
*/
|
||||
void ClearMLock();
|
||||
|
||||
/** Get the number of mlocked modes for this channel
|
||||
* @param status true for mlock on, false for mlock off
|
||||
* @return The number of mlocked modes
|
||||
*/
|
||||
const size_t GetMLockCount(bool status) const;
|
||||
|
||||
/** Set a channel mode param on the channel
|
||||
* @param Name The mode
|
||||
* @param param The param
|
||||
|
||||
+27
-28
@@ -156,9 +156,9 @@ char *get_mlock_modes(ChannelInfo * ci, int complete)
|
||||
memset(&res, '\0', sizeof(res));
|
||||
end = res;
|
||||
|
||||
if (ci->mlock_on.count() || ci->mlock_off.count())
|
||||
if (ci->GetMLockCount(true) || ci->GetMLockCount(false))
|
||||
{
|
||||
if (ci->mlock_on.count())
|
||||
if (ci->GetMLockCount(true))
|
||||
{
|
||||
*end++ = '+';
|
||||
|
||||
@@ -171,7 +171,7 @@ char *get_mlock_modes(ChannelInfo * ci, int complete)
|
||||
}
|
||||
}
|
||||
|
||||
if (ci->mlock_off.count())
|
||||
if (ci->GetMLockCount(false))
|
||||
{
|
||||
*end++ = '-';
|
||||
|
||||
@@ -184,7 +184,7 @@ char *get_mlock_modes(ChannelInfo * ci, int complete)
|
||||
}
|
||||
}
|
||||
|
||||
if (ci->mlock_on.count() && complete)
|
||||
if (ci->GetMLockCount(true) && complete)
|
||||
{
|
||||
for (it = ModeManager::ChannelModesByChar.begin(); it != ModeManager::ChannelModesByChar.end(); ++it)
|
||||
{
|
||||
@@ -233,10 +233,8 @@ void get_chanserv_stats(long *nrec, long *memuse)
|
||||
mem += strlen(ci->url) + 1;
|
||||
if (ci->email)
|
||||
mem += strlen(ci->email) + 1;
|
||||
if (!ci->access.empty())
|
||||
mem += ci->access.size() * sizeof(ChanAccess);
|
||||
if (!ci->akick.empty())
|
||||
mem += ci->akick.size() * sizeof(AutoKick);
|
||||
mem += ci->GetAccessCount() * sizeof(ChanAccess);
|
||||
mem += ci->GetAkickCount() * sizeof(AutoKick);
|
||||
|
||||
if (ci->GetParam(CMODE_KEY, ¶m))
|
||||
mem += param.length() + 1;
|
||||
@@ -667,8 +665,8 @@ void save_cs_dbase()
|
||||
for (j = 0; j < CA_SIZE; j++)
|
||||
SAFE(write_int16(ci->levels[j], f));
|
||||
|
||||
SAFE(write_int16(ci->access.empty() ? 0 : ci->access.size(), f));
|
||||
for (j = 0; j < ci->access.size(); j++) {
|
||||
SAFE(write_int16(ci->GetAccessCount(), f));
|
||||
for (j = 0; j < ci->GetAccessCount(); j++) {
|
||||
ChanAccess *access = ci->GetAccess(j);
|
||||
if (!access->in_use)
|
||||
continue;
|
||||
@@ -679,17 +677,18 @@ void save_cs_dbase()
|
||||
//SAFE(write_string(access->creator.c_str(), f));
|
||||
}
|
||||
|
||||
SAFE(write_int16(ci->akick.size(), f));
|
||||
for (j = 0; j < ci->akick.size(); ++j)
|
||||
SAFE(write_int16(ci->GetAkickCount(), f));
|
||||
for (j = 0; j < ci->GetAkickCount(); ++j)
|
||||
{
|
||||
SAFE(write_int16(ci->akick[j]->flags, f));
|
||||
if (ci->akick[j]->flags & AK_ISNICK)
|
||||
SAFE(write_string(ci->akick[j]->nc->display, f));
|
||||
AutoKick *akick = ci->GetAkick(j);
|
||||
SAFE(write_int16(akick->flags, f));
|
||||
if (akick->flags & AK_ISNICK)
|
||||
SAFE(write_string(akick->nc->display, f));
|
||||
else
|
||||
SAFE(write_string(ci->akick[j]->mask.c_str(), f));
|
||||
SAFE(write_string(ci->akick[j]->reason.c_str(), f));
|
||||
SAFE(write_string(ci->akick[j]->creator.c_str(), f));
|
||||
SAFE(write_int32(ci->akick[j]->addtime, f));
|
||||
SAFE(write_string(akick->mask.c_str(), f));
|
||||
SAFE(write_string(akick->reason.c_str(), f));
|
||||
SAFE(write_string(akick->creator.c_str(), f));
|
||||
SAFE(write_int32(akick->addtime, f));
|
||||
}
|
||||
|
||||
//SAFE(write_int32(ci->mlock_on, f));
|
||||
@@ -1185,9 +1184,9 @@ int check_kick(User * user, const char *chan, time_t chants)
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (unsigned j = 0; j < ci->akick.size(); ++j)
|
||||
for (unsigned j = 0; j < ci->GetAkickCount(); ++j)
|
||||
{
|
||||
akick = ci->akick[j];
|
||||
akick = ci->GetAkick(j);
|
||||
|
||||
if (!(akick->flags & AK_USED))
|
||||
continue;
|
||||
@@ -1490,7 +1489,7 @@ void cs_remove_nick(const NickCore * nc)
|
||||
if (ci->successor == nc)
|
||||
ci->successor = NULL;
|
||||
|
||||
for (j = ci->access.size(); j > 0; --j)
|
||||
for (j = ci->GetAccessCount(); j > 0; --j)
|
||||
{
|
||||
ca = ci->GetAccess(j - 1);
|
||||
|
||||
@@ -1498,9 +1497,9 @@ void cs_remove_nick(const NickCore * nc)
|
||||
ci->EraseAccess(j - 1);
|
||||
}
|
||||
|
||||
for (j = ci->akick.size(); j > 0; --j)
|
||||
for (j = ci->GetAkickCount(); j > 0; --j)
|
||||
{
|
||||
akick = ci->akick[j - 1];
|
||||
akick = ci->GetAkick(j - 1);
|
||||
if ((akick->flags & AK_USED) && (akick->flags & AK_ISNICK) && akick->nc == nc)
|
||||
ci->EraseAkick(akick);
|
||||
}
|
||||
@@ -1974,9 +1973,9 @@ AutoKick *is_stuck(ChannelInfo * ci, const char *mask)
|
||||
if (!ci)
|
||||
return NULL;
|
||||
|
||||
for (unsigned i = 0; i < ci->akick.size(); ++i)
|
||||
for (unsigned i = 0; i < ci->GetAkickCount(); ++i)
|
||||
{
|
||||
AutoKick *akick = ci->akick[i];
|
||||
AutoKick *akick = ci->GetAkick(i);
|
||||
|
||||
if (!(akick->flags & AK_USED) || (akick->flags & AK_ISNICK) || !(akick->flags & AK_STUCK))
|
||||
continue;
|
||||
@@ -2035,9 +2034,9 @@ void stick_all(ChannelInfo * ci)
|
||||
if (!ci)
|
||||
return;
|
||||
|
||||
for (unsigned i = 0; i < ci->akick.size(); ++i)
|
||||
for (unsigned i = 0; i < ci->GetAkickCount(); ++i)
|
||||
{
|
||||
AutoKick *akick = ci->akick[i];
|
||||
AutoKick *akick = ci->GetAkick(i);
|
||||
|
||||
if (!(akick->flags & AK_USED) || (akick->flags & AK_ISNICK)
|
||||
|| !(akick->flags & AK_STUCK))
|
||||
|
||||
@@ -40,7 +40,7 @@ static int access_del_callback(User * u, int num, va_list args)
|
||||
int *last = va_arg(args, int *);
|
||||
int *perm = va_arg(args, int *);
|
||||
int uacc = va_arg(args, int);
|
||||
if (num < 1 || num > ci->access.size())
|
||||
if (num < 1 || num > ci->GetAccessCount())
|
||||
return 0;
|
||||
*last = num;
|
||||
return access_del(u, ci, ci->GetAccess(num - 1), perm, uacc);
|
||||
@@ -75,7 +75,7 @@ static int access_list_callback(User * u, int num, va_list args)
|
||||
{
|
||||
ChannelInfo *ci = va_arg(args, ChannelInfo *);
|
||||
int *sent_header = va_arg(args, int *);
|
||||
if (num < 1 || num > ci->access.size())
|
||||
if (num < 1 || num > ci->GetAccessCount())
|
||||
return 0;
|
||||
return access_list(u, num - 1, ci, sent_header);
|
||||
}
|
||||
@@ -232,7 +232,7 @@ class CommandCSAccess : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
if (ci->access.size() >= CSAccessMax)
|
||||
if (ci->GetAccessCount() >= CSAccessMax)
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_ACCESS_REACHED_LIMIT, CSAccessMax);
|
||||
return MOD_CONT;
|
||||
@@ -255,7 +255,7 @@ class CommandCSAccess : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
if (ci->access.empty())
|
||||
if (!ci->GetAccessCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_ACCESS_LIST_EMPTY, chan);
|
||||
return MOD_CONT;
|
||||
@@ -331,7 +331,7 @@ class CommandCSAccess : public Command
|
||||
{
|
||||
int sent_header = 0;
|
||||
|
||||
if (ci->access.empty())
|
||||
if (!ci->GetAccessCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_ACCESS_LIST_EMPTY, chan);
|
||||
return MOD_CONT;
|
||||
@@ -340,7 +340,7 @@ class CommandCSAccess : public Command
|
||||
process_numlist(nick, NULL, access_list_callback, u, ci, &sent_header);
|
||||
else
|
||||
{
|
||||
for (i = 0; i < ci->access.size(); i++)
|
||||
for (i = 0; i < ci->GetAccessCount(); i++)
|
||||
{
|
||||
access = ci->GetAccess(i);
|
||||
if (nick && access->nc && !Anope::Match(access->nc->display, nick, false))
|
||||
@@ -357,7 +357,7 @@ class CommandCSAccess : public Command
|
||||
{
|
||||
int sent_header = 0;
|
||||
|
||||
if (ci->access.empty())
|
||||
if (!ci->GetAccessCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_ACCESS_LIST_EMPTY, chan);
|
||||
return MOD_CONT;
|
||||
@@ -366,7 +366,7 @@ class CommandCSAccess : public Command
|
||||
process_numlist(nick, NULL, access_view_callback, u, ci, &sent_header);
|
||||
else
|
||||
{
|
||||
for (i = 0; i < ci->access.size(); ++i)
|
||||
for (i = 0; i < ci->GetAccessCount(); ++i)
|
||||
{
|
||||
access = ci->GetAccess(i);
|
||||
if (nick && access->nc && !Anope::Match(access->nc->display, nick, false))
|
||||
|
||||
+28
-27
@@ -53,17 +53,17 @@ int akick_del_callback(User * u, int num, va_list args)
|
||||
|
||||
*last = num;
|
||||
|
||||
if (num < 1 || num > ci->akick.size())
|
||||
if (num < 1 || num > ci->GetAkickCount())
|
||||
return 0;
|
||||
|
||||
ci->EraseAkick(ci->akick[num - 1]);
|
||||
ci->EraseAkick(ci->GetAkick(num - 1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int akick_list(User * u, int index, ChannelInfo * ci, int *sent_header)
|
||||
{
|
||||
AutoKick *akick = ci->akick[index];
|
||||
AutoKick *akick = ci->GetAkick(index);
|
||||
|
||||
if (!(akick->flags & AK_USED))
|
||||
return 0;
|
||||
@@ -84,14 +84,14 @@ int akick_list_callback(User * u, int num, va_list args)
|
||||
{
|
||||
ChannelInfo *ci = va_arg(args, ChannelInfo *);
|
||||
int *sent_header = va_arg(args, int *);
|
||||
if (num < 1 || num > ci->akick.size())
|
||||
if (num < 1 || num > ci->GetAkickCount())
|
||||
return 0;
|
||||
return akick_list(u, num - 1, ci, sent_header);
|
||||
}
|
||||
|
||||
int akick_view(User * u, int index, ChannelInfo * ci, int *sent_header)
|
||||
{
|
||||
AutoKick *akick = ci->akick[index];
|
||||
AutoKick *akick = ci->GetAkick(index);
|
||||
char timebuf[64];
|
||||
struct tm tm;
|
||||
|
||||
@@ -128,7 +128,7 @@ int akick_view_callback(User * u, int num, va_list args)
|
||||
{
|
||||
ChannelInfo *ci = va_arg(args, ChannelInfo *);
|
||||
int *sent_header = va_arg(args, int *);
|
||||
if (num < 1 || num > ci->akick.size())
|
||||
if (num < 1 || num > ci->GetAkickCount())
|
||||
return 0;
|
||||
return akick_view(u, num - 1, ci, sent_header);
|
||||
}
|
||||
@@ -239,9 +239,9 @@ class CommandCSAKick : public Command
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned j = 0; j < ci->akick.size(); ++j)
|
||||
for (unsigned j = 0; j < ci->GetAkickCount(); ++j)
|
||||
{
|
||||
akick = ci->akick[j];
|
||||
akick = ci->GetAkick(j);
|
||||
if (!(akick->flags & AK_USED))
|
||||
continue;
|
||||
if ((akick->flags & AK_ISNICK) ? akick->nc == nc : akick->mask == mask)
|
||||
@@ -254,7 +254,7 @@ class CommandCSAKick : public Command
|
||||
|
||||
/* All entries should be in use so we don't have to go over
|
||||
* the entire list. We simply add new entries at the end. */
|
||||
if (ci->akick.size() >= CSAutokickMax)
|
||||
if (ci->GetAkickCount() >= CSAutokickMax)
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_AKICK_REACHED_LIMIT, CSAutokickMax);
|
||||
return;
|
||||
@@ -278,7 +278,7 @@ class CommandCSAKick : public Command
|
||||
unsigned i;
|
||||
AutoKick *akick;
|
||||
|
||||
if (ci->akick.empty())
|
||||
if (!ci->GetAkickCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name);
|
||||
return;
|
||||
@@ -287,9 +287,9 @@ class CommandCSAKick : public Command
|
||||
na = findnick(mask.c_str());
|
||||
nc = (na ? na->nc : NULL);
|
||||
|
||||
for (i = 0; i < ci->akick.size(); ++i)
|
||||
for (i = 0; i < ci->GetAkickCount(); ++i)
|
||||
{
|
||||
akick = ci->akick[i];
|
||||
akick = ci->GetAkick(i);
|
||||
|
||||
if (!(akick->flags & AK_USED) || (akick->flags & AK_ISNICK))
|
||||
continue;
|
||||
@@ -297,7 +297,8 @@ class CommandCSAKick : public Command
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == ci->akick.size()) {
|
||||
if (i == ci->GetAkickCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_AKICK_NOT_FOUND, mask.c_str(), ci->name);
|
||||
return;
|
||||
}
|
||||
@@ -317,7 +318,7 @@ class CommandCSAKick : public Command
|
||||
unsigned i;
|
||||
ci::string mask = params[2];
|
||||
|
||||
if (ci->akick.empty())
|
||||
if (!ci->GetAkickCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name);
|
||||
return;
|
||||
@@ -326,9 +327,9 @@ class CommandCSAKick : public Command
|
||||
na = findnick(mask.c_str());
|
||||
nc = (na ? na->nc : NULL);
|
||||
|
||||
for (i = 0; i < ci->akick.size(); ++i)
|
||||
for (i = 0; i < ci->GetAkickCount(); ++i)
|
||||
{
|
||||
akick = ci->akick[i];
|
||||
akick = ci->GetAkick(i);
|
||||
|
||||
if (!(akick->flags & AK_USED) || (akick->flags & AK_ISNICK))
|
||||
continue;
|
||||
@@ -336,7 +337,7 @@ class CommandCSAKick : public Command
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == ci->akick.size())
|
||||
if (i == ci->GetAkickCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_AKICK_NOT_FOUND, mask.c_str(), ci->name);
|
||||
return;
|
||||
@@ -352,7 +353,7 @@ class CommandCSAKick : public Command
|
||||
AutoKick *akick;
|
||||
unsigned i;
|
||||
|
||||
if (ci->akick.empty())
|
||||
if (!ci->GetAkickCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name);
|
||||
return;
|
||||
@@ -382,9 +383,9 @@ class CommandCSAKick : public Command
|
||||
NickAlias *na = findnick(mask.c_str());
|
||||
NickCore *nc = (na ? na->nc : NULL);
|
||||
|
||||
for (i = 0; i < ci->akick.size(); ++i)
|
||||
for (i = 0; i < ci->GetAkickCount(); ++i)
|
||||
{
|
||||
akick = ci->akick[i];
|
||||
akick = ci->GetAkick(i);
|
||||
|
||||
if (!(akick->flags & AK_USED))
|
||||
continue;
|
||||
@@ -394,7 +395,7 @@ class CommandCSAKick : public Command
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == ci->akick.size())
|
||||
if (i == ci->GetAkickCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_AKICK_NOT_FOUND, mask.c_str(), ci->name);
|
||||
return;
|
||||
@@ -413,7 +414,7 @@ class CommandCSAKick : public Command
|
||||
unsigned i;
|
||||
AutoKick *akick;
|
||||
|
||||
if (ci->akick.empty())
|
||||
if (!ci->GetAkickCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name);
|
||||
return;
|
||||
@@ -423,9 +424,9 @@ class CommandCSAKick : public Command
|
||||
process_numlist(mask.c_str(), NULL, akick_list_callback, u, ci, &sent_header);
|
||||
else
|
||||
{
|
||||
for (i = 0; i < ci->akick.size(); ++i)
|
||||
for (i = 0; i < ci->GetAkickCount(); ++i)
|
||||
{
|
||||
akick = ci->akick[i];
|
||||
akick = ci->GetAkick(i);
|
||||
|
||||
if (!(akick->flags & AK_USED))
|
||||
continue;
|
||||
@@ -452,7 +453,7 @@ class CommandCSAKick : public Command
|
||||
AutoKick *akick;
|
||||
unsigned i;
|
||||
|
||||
if (ci->akick.empty())
|
||||
if (!ci->GetAkickCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, ci->name);
|
||||
return;
|
||||
@@ -462,9 +463,9 @@ class CommandCSAKick : public Command
|
||||
process_numlist(mask.c_str(), NULL, akick_view_callback, u, ci, &sent_header);
|
||||
else
|
||||
{
|
||||
for (i = 0; i < ci->akick.size(); ++i)
|
||||
for (i = 0; i < ci->GetAkickCount(); ++i)
|
||||
{
|
||||
akick = ci->akick[i];
|
||||
akick = ci->GetAkick(i);
|
||||
|
||||
if (!(akick->flags & AK_USED))
|
||||
continue;
|
||||
|
||||
@@ -62,14 +62,9 @@ class CommandCSRegister : public Command
|
||||
{
|
||||
c->ci = ci;
|
||||
ci->c = c;
|
||||
ci->bantype = CSDefBantype;
|
||||
ci->flags = CSDefFlags;
|
||||
ci->mlock_on = ircd->DefMLock;
|
||||
ci->memos.memomax = MSMaxMemos;
|
||||
ci->last_used = ci->time_registered;
|
||||
ci->founder = u->nc;
|
||||
|
||||
ci->desc = sstrdup(desc);
|
||||
|
||||
if (c->topic)
|
||||
{
|
||||
ci->last_topic = sstrdup(c->topic);
|
||||
@@ -77,8 +72,8 @@ class CommandCSRegister : public Command
|
||||
ci->last_topic_time = c->topic_time;
|
||||
}
|
||||
else strscpy(ci->last_topic_setter, s_ChanServ, NICKMAX); /* Set this to something, otherwise it will maliform the topic */
|
||||
|
||||
ci->bi = NULL;
|
||||
ci->botflags = BSDefFlags;
|
||||
++ci->founder->channelcount;
|
||||
alog("%s: Channel '%s' registered by %s!%s@%s", s_ChanServ, chan, u->nick, u->GetIdent().c_str(), u->host);
|
||||
notice_lang(s_ChanServ, u, CHAN_REGISTERED, chan, u->nick);
|
||||
|
||||
+1
-1
@@ -431,7 +431,7 @@ class CommandCSSet : public Command
|
||||
if (!(ci->flags & CI_XOP)) {
|
||||
ChanAccess *access;
|
||||
|
||||
for (unsigned i = 0; i < ci->access.size(); i++) {
|
||||
for (unsigned i = 0; i < ci->GetAccessCount(); i++) {
|
||||
access = ci->GetAccess(i);
|
||||
if (!access->in_use)
|
||||
continue;
|
||||
|
||||
+8
-8
@@ -171,7 +171,7 @@ class XOPBase : public Command
|
||||
++change;
|
||||
}
|
||||
|
||||
if (!change && ci->access.size() >= CSAccessMax)
|
||||
if (!change && ci->GetAccessCount() >= CSAccessMax)
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_XOP_REACHED_LIMIT, CSAccessMax);
|
||||
return MOD_CONT;
|
||||
@@ -224,7 +224,7 @@ class XOPBase : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
if (ci->access.empty())
|
||||
if (!ci->GetAccessCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, messages[XOP_LIST_EMPTY], ci->name);
|
||||
return MOD_CONT;
|
||||
@@ -315,7 +315,7 @@ class XOPBase : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
if (ci->access.empty())
|
||||
if (!ci->GetAccessCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, messages[XOP_LIST_EMPTY], ci->name);
|
||||
return MOD_CONT;
|
||||
@@ -325,7 +325,7 @@ class XOPBase : public Command
|
||||
process_numlist(nick, NULL, xop_list_callback, u, ci, &sent_header, level, messages[XOP_LIST_HEADER]);
|
||||
else
|
||||
{
|
||||
for (unsigned i = 0; i < ci->access.size(); ++i)
|
||||
for (unsigned i = 0; i < ci->GetAccessCount(); ++i)
|
||||
{
|
||||
ChanAccess *access = ci->GetAccess(i);
|
||||
if (nick && access->nc && !Anope::Match(access->nc->display, nick, false))
|
||||
@@ -347,7 +347,7 @@ class XOPBase : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
if (ci->access.empty())
|
||||
if (!ci->GetAccessCount())
|
||||
{
|
||||
notice_lang(s_ChanServ, u, messages[XOP_LIST_EMPTY], ci->name);
|
||||
return MOD_CONT;
|
||||
@@ -359,7 +359,7 @@ class XOPBase : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
for (unsigned i = ci->access.size(); i > 0; --i)
|
||||
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
|
||||
{
|
||||
ChanAccess *access = ci->GetAccess(i - 1);
|
||||
if (access->in_use && access->level == level)
|
||||
@@ -590,7 +590,7 @@ int xop_del_callback(User *u, int num, va_list args)
|
||||
int uacc = va_arg(args, int);
|
||||
int xlev = va_arg(args, int);
|
||||
|
||||
if (num < 1 || num > ci->access.size())
|
||||
if (num < 1 || num > ci->GetAccessCount())
|
||||
return 0;
|
||||
*last = num;
|
||||
|
||||
@@ -622,7 +622,7 @@ int xop_list_callback(User *u, int num, va_list args)
|
||||
int xlev = va_arg(args, int);
|
||||
int xmsg = va_arg(args, int);
|
||||
|
||||
if (num < 1 || num > ci->access.size())
|
||||
if (num < 1 || num > ci->GetAccessCount())
|
||||
return 0;
|
||||
|
||||
return xop_list(u, num - 1, ci, sent_header, xlev, xmsg);
|
||||
|
||||
+49
-4
@@ -20,20 +20,26 @@ ChannelInfo::ChannelInfo()
|
||||
name[0] = last_topic_setter[0] = '\0';
|
||||
founder = successor = NULL;
|
||||
desc = url = email = last_topic = forbidby = forbidreason = NULL;
|
||||
time_registered = last_used = last_topic_time = 0;
|
||||
flags = 0;
|
||||
bantype = 0;
|
||||
last_topic_time = 0;
|
||||
levels = NULL;
|
||||
entry_message = NULL;
|
||||
c = NULL;
|
||||
bi = NULL;
|
||||
botflags = 0;
|
||||
ttb = NULL;
|
||||
bwcount = 0;
|
||||
badwords = NULL;
|
||||
capsmin = capspercent = 0;
|
||||
floodlines = floodsecs = 0;
|
||||
repeattimes = 0;
|
||||
|
||||
/* If ircd doesn't exist, this is from DB load and mlock is set later */
|
||||
if (ircd)
|
||||
mlock_on = ircd->DefMLock;
|
||||
flags = CSDefFlags;
|
||||
bantype = CSDefBantype;
|
||||
memos.memomax = MSMaxMemos;
|
||||
botflags = BSDefFlags;
|
||||
last_used = time_registered = time(NULL);
|
||||
}
|
||||
|
||||
/** Add an entry to the channel access list
|
||||
@@ -98,6 +104,14 @@ ChanAccess *ChannelInfo::GetAccess(NickCore *nc, int16 level)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Get the size of the accss vector for this channel
|
||||
* @return The access vector size
|
||||
*/
|
||||
const unsigned ChannelInfo::GetAccessCount() const
|
||||
{
|
||||
return access.empty() ? 0 : access.size();
|
||||
}
|
||||
|
||||
|
||||
/** Erase an entry from the channel access list
|
||||
*
|
||||
@@ -177,6 +191,26 @@ AutoKick *ChannelInfo::AddAkick(const std::string &user, const std::string &mask
|
||||
return autokick;
|
||||
}
|
||||
|
||||
/** Get an entry from the channel akick list
|
||||
* @param index The index in the akick vector
|
||||
* @return The akick structure, or NULL if not found
|
||||
*/
|
||||
AutoKick *ChannelInfo::GetAkick(unsigned index)
|
||||
{
|
||||
if (akick.empty() || index >= akick.size())
|
||||
return NULL;
|
||||
|
||||
return akick[index];
|
||||
}
|
||||
|
||||
/** Get the size of the akick vector for this channel
|
||||
* @return The akick vector size
|
||||
*/
|
||||
const unsigned ChannelInfo::GetAkickCount() const
|
||||
{
|
||||
return akick.empty() ? 0 : akick.size();
|
||||
}
|
||||
|
||||
/** Erase an entry from the channel akick list
|
||||
* @param akick The akick
|
||||
*/
|
||||
@@ -250,6 +284,17 @@ void ChannelInfo::ClearMLock()
|
||||
mlock_off.reset();
|
||||
}
|
||||
|
||||
/** Get the number of mlocked modes for this channel
|
||||
* @param status true for mlock on, false for mlock off
|
||||
* @return The number of mlocked modes
|
||||
*/
|
||||
const size_t ChannelInfo::GetMLockCount(bool status) const
|
||||
{
|
||||
if (status)
|
||||
return mlock_on.count();
|
||||
else
|
||||
return mlock_off.count();
|
||||
}
|
||||
|
||||
/** Set a channel mode param on the channel
|
||||
* @param Name The mode
|
||||
|
||||
Reference in New Issue
Block a user