mirror of
https://github.com/anope/anope.git
synced 2026-07-03 09:33:12 +02:00
Remove User::na, use User::nc everywhere. Will probably break everything, but opens the door to decoupling NC from NA, and means commands can now be run without bothering about changinc nick :)
More tweaking for na/nc usage. It compiles, but it's still a work in progress. Again, this compiles, but I *bet* there's no chance in hell it'll work. :) Slightly better. Set User::nc correctly. Fix crash with unregistered nicks in core and ns_access. Fix glist to work when you're not on that particular nick. Fix ns_set to not crash and burn horribly. Fix ns_set and ns_logout to not do bad things. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2076 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -34,7 +34,6 @@ class NickAlias
|
||||
time_registered = last_seen = 0;
|
||||
status = 0;
|
||||
nc = NULL;
|
||||
u = NULL;
|
||||
}
|
||||
|
||||
NickAlias *next, *prev;
|
||||
@@ -46,9 +45,6 @@ class NickAlias
|
||||
time_t last_seen; /* When it was seen online for the last time */
|
||||
uint16 status; /* See NS_* below */
|
||||
NickCore *nc; /* I'm an alias of this */
|
||||
|
||||
/* Not saved */
|
||||
User *u; /* Current online user that has me */
|
||||
};
|
||||
|
||||
class NickCore : public Extensible
|
||||
|
||||
+6
-10
@@ -317,7 +317,6 @@ E bool NSStrictPrivileges;
|
||||
E bool NSEmailReg;
|
||||
E bool NSModeOnID;
|
||||
E bool NSRestrictGetPass;
|
||||
E bool NSNickTracking;
|
||||
E bool NSAddAccessOnReg;
|
||||
|
||||
E int CSDefFlags;
|
||||
@@ -525,7 +524,9 @@ E void lang_init();
|
||||
E int strftime_lang(char *buf, int size, User * u, int format, struct tm *tm);
|
||||
E void syntax_error(char *service, User * u, const char *command, int msgnum);
|
||||
E const char *getstring(NickAlias *na, int index);
|
||||
E const char *getstring2(NickCore *nc, int index);
|
||||
E const char *getstring(NickCore *nc, int index);
|
||||
E const char *getstring(User *nc, int index);
|
||||
E const char *getstring(int index);
|
||||
|
||||
|
||||
/**** log.c ****/
|
||||
@@ -630,8 +631,8 @@ E const char *merge_args(int argc, const char **argv);
|
||||
E int match_wild(const char *pattern, const char *str) MARK_DEPRECATED;
|
||||
E int match_wild_nocase(const char *pattern, const char *str) MARK_DEPRECATED;
|
||||
E int dotime(const char *s);
|
||||
E char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds);
|
||||
E char *expire_left(NickAlias * na, char *buf, int len, time_t expires);
|
||||
E const char *duration(NickCore *nc, char *buf, int bufsize, time_t seconds);
|
||||
E const char *expire_left(NickCore *nc, char *buf, int len, time_t expires);
|
||||
E int doValidHost(const char *host, int type);
|
||||
|
||||
typedef int (*range_callback_t) (User * u, int num, va_list args);
|
||||
@@ -736,11 +737,6 @@ E NickAlias *findnick(const char *nick);
|
||||
E NickAlias *findnick(const std::string &nick);
|
||||
E NickCore *findcore(const char *nick);
|
||||
E void clean_ns_timeouts(NickAlias * na);
|
||||
E void nsStartNickTracking(User * u);
|
||||
E void nsStopNickTracking(User * u);
|
||||
E int nsCheckNickTracking(User *u);
|
||||
|
||||
E int group_identified(User * u, NickCore * nc);
|
||||
E int is_on_access(User * u, NickCore * nc);
|
||||
|
||||
/**** operserv.c ****/
|
||||
@@ -930,7 +926,7 @@ E char *TS6UPLINK;
|
||||
E void update_host(User * user);
|
||||
|
||||
E User *do_nick(const char *source, const char *nick, const char *username, const char *host,
|
||||
const char *server, const char *realname, time_t ts, uint32 svid, uint32 ip, const char *vhost, const char *uid);
|
||||
const char *server, const char *realname, time_t ts, uint32 ip, const char *vhost, const char *uid);
|
||||
|
||||
E void do_umode(const char *source, int ac, const char **av);
|
||||
E void do_quit(const char *source, int ac, const char **av);
|
||||
|
||||
@@ -1312,10 +1312,7 @@ class IRCDProto
|
||||
virtual void SendSGLine(const char *, const char *) { }
|
||||
virtual void SendBanDel(const char *, const char *) { }
|
||||
virtual void SendSVSModeChan(const char *, const char *, const char *) { }
|
||||
virtual void SendSVID(const char *, time_t) { }
|
||||
virtual void SendUnregisteredNick(User *) { }
|
||||
virtual void SendSVID2(User *, const char *) { }
|
||||
virtual void SendSVID3(User *, const char *) { }
|
||||
virtual void SendCTCP(BotInfo *bi, const char *dest, const char *fmt, ...);
|
||||
virtual void SendSVSJoin(const char *, const char *, const char *, const char *) { }
|
||||
virtual void SendSVSPart(const char *, const char *, const char *) { }
|
||||
|
||||
@@ -37,14 +37,11 @@ public: // XXX: exposing a tiny bit too much
|
||||
std::string chost; /* User's cloaked hostname */
|
||||
char *realname; /* Realname */
|
||||
Server *server; /* Server user is connected to */
|
||||
char *nickTrack; /* Nick Tracking */
|
||||
time_t timestamp; /* Timestamp of the nick */
|
||||
time_t my_signon; /* When did _we_ see the user? */
|
||||
time_t svid; /* Services ID */
|
||||
uint32 mode; /* See below */
|
||||
|
||||
NickCore *nc;
|
||||
NickAlias *na;
|
||||
|
||||
int isSuperAdmin; /* is SuperAdmin on or off? */
|
||||
|
||||
|
||||
+5
-5
@@ -803,7 +803,7 @@ static void bot_kick(ChannelInfo * ci, User * u, int message, ...)
|
||||
return;
|
||||
|
||||
va_start(args, message);
|
||||
fmt = getstring(u->na, message);
|
||||
fmt = getstring(u, message);
|
||||
if (!fmt)
|
||||
return;
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
@@ -837,7 +837,7 @@ void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick,
|
||||
if (ircd->protectedumode) {
|
||||
if (is_protected(u) && (requester != u)) {
|
||||
ircdproto->SendPrivmsg(ci->bi, ci->name, "%s",
|
||||
getstring2(NULL, PERMISSION_DENIED));
|
||||
getstring(PERMISSION_DENIED));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -849,7 +849,7 @@ void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick,
|
||||
if (ircd->except) {
|
||||
if (is_excepted(ci, u) == 1) {
|
||||
ircdproto->SendPrivmsg(ci->bi, ci->name, "%s",
|
||||
getstring2(NULL, BOT_EXCEPT));
|
||||
getstring(BOT_EXCEPT));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -913,7 +913,7 @@ void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick,
|
||||
if (ircd->protectedumode) {
|
||||
if (is_protected(u) && (requester != u)) {
|
||||
ircdproto->SendPrivmsg(ci->bi, ci->name, "%s",
|
||||
getstring2(NULL, PERMISSION_DENIED));
|
||||
getstring(PERMISSION_DENIED));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -967,7 +967,7 @@ void bot_raw_mode(User * requester, ChannelInfo * ci, const char *mode,
|
||||
if (ircd->protectedumode) {
|
||||
if (is_protected(u) && *mode == '-' && (requester != u)) {
|
||||
ircdproto->SendPrivmsg(ci->bi, ci->name, "%s",
|
||||
getstring2(NULL, PERMISSION_DENIED));
|
||||
getstring(PERMISSION_DENIED));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -499,7 +499,7 @@ User *nc_on_chan(Channel * c, NickCore * nc)
|
||||
return NULL;
|
||||
|
||||
for (u = c->users; u; u = u->next) {
|
||||
if (u->user->na && u->user->na->nc == nc
|
||||
if (u->user->nc == nc
|
||||
&& nick_recognized(u->user))
|
||||
return u->user;
|
||||
}
|
||||
@@ -1390,7 +1390,7 @@ void chan_set_correct_modes(User * user, Channel * c, int give_modes)
|
||||
* to receive modes. I wonder who added that... *looks at Rob* ;) -GD
|
||||
*/
|
||||
if (give_modes && (get_ignore(user->nick) == NULL)
|
||||
&& (!user->na || !(user->na->nc->flags & NI_AUTOOP))) {
|
||||
&& (!user->nc || !(user->nc->flags & NI_AUTOOP))) {
|
||||
if (ircd->owner && is_founder(user, ci))
|
||||
add_modes |= CUS_OWNER;
|
||||
else if ((ircd->protect || ircd->admin)
|
||||
@@ -1569,7 +1569,7 @@ void chan_adduser2(User * user, Channel * c)
|
||||
if (c->usercount == BSMinUsers)
|
||||
bot_join(c->ci);
|
||||
if (c->usercount >= BSMinUsers && (c->ci->botflags & BS_GREET)
|
||||
&& user->na && user->na->nc->greet
|
||||
&& user->nc && user->nc->greet
|
||||
&& check_access(user, c->ci, CA_GREET)) {
|
||||
/* Only display the greet if the main uplink we're connected
|
||||
* to has synced, or we'll get greet-floods when the net
|
||||
@@ -1577,7 +1577,7 @@ void chan_adduser2(User * user, Channel * c)
|
||||
*/
|
||||
if (is_sync(user->server)) {
|
||||
ircdproto->SendPrivmsg(c->ci->bi, c->name, "[%s] %s",
|
||||
user->na->nick, user->na->nc->greet);
|
||||
user->nc->display, user->nc->greet);
|
||||
c->ci->bi->lastmsg = time(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -1142,13 +1142,13 @@ int check_kick(User * user, const char *chan, time_t chants)
|
||||
if (ci->flags & CI_SUSPENDED || ci->flags & CI_FORBIDDEN)
|
||||
{
|
||||
get_idealban(ci, user, mask, sizeof(mask));
|
||||
reason = ci->forbidreason ? ci->forbidreason : getstring(user->na, CHAN_MAY_NOT_BE_USED);
|
||||
reason = ci->forbidreason ? ci->forbidreason : getstring(user, CHAN_MAY_NOT_BE_USED);
|
||||
set_modes = true;
|
||||
goto kick;
|
||||
}
|
||||
|
||||
if (nick_recognized(user))
|
||||
nc = user->na->nc;
|
||||
nc = user->nc;
|
||||
else
|
||||
nc = NULL;
|
||||
|
||||
@@ -1188,7 +1188,7 @@ int check_kick(User * user, const char *chan, time_t chants)
|
||||
|
||||
if (check_access(user, ci, CA_NOJOIN)) {
|
||||
get_idealban(ci, user, mask, sizeof(mask));
|
||||
reason = getstring(user->na, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
reason = getstring(user, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
goto kick;
|
||||
}
|
||||
|
||||
@@ -1846,7 +1846,7 @@ int is_founder(User * user, ChannelInfo * ci)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (user->na && user->na->nc == ci->founder) {
|
||||
if (user->nc && user->nc == ci->founder) {
|
||||
if ((nick_identified(user)
|
||||
|| (nick_recognized(user) && !(ci->flags & CI_SECURE))))
|
||||
return 1;
|
||||
@@ -1864,7 +1864,7 @@ int is_real_founder(User * user, ChannelInfo * ci)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (user->na && user->na->nc == ci->founder) {
|
||||
if (user->nc && user->nc == ci->founder) {
|
||||
if ((nick_identified(user)
|
||||
|| (nick_recognized(user) && !(ci->flags & CI_SECURE))))
|
||||
return 1;
|
||||
@@ -1927,12 +1927,12 @@ int get_access(User * user, ChannelInfo * ci)
|
||||
if (is_founder(user, ci))
|
||||
return ACCESS_FOUNDER;
|
||||
|
||||
if (!user->na)
|
||||
if (!user->nc)
|
||||
return 0;
|
||||
|
||||
if (nick_identified(user)
|
||||
|| (nick_recognized(user) && !(ci->flags & CI_SECURE)))
|
||||
if ((access = get_access_entry(user->na->nc, ci)))
|
||||
if ((access = get_access_entry(user->nc, ci)))
|
||||
return access->level;
|
||||
|
||||
if (nick_identified(user))
|
||||
@@ -1947,12 +1947,12 @@ void update_cs_lastseen(User * user, ChannelInfo * ci)
|
||||
{
|
||||
ChanAccess *access;
|
||||
|
||||
if (!ci || !user || !user->na)
|
||||
if (!ci || !user || !user->nc)
|
||||
return;
|
||||
|
||||
if (is_founder(user, ci) || nick_identified(user)
|
||||
|| (nick_recognized(user) && !(ci->flags & CI_SECURE)))
|
||||
if ((access = get_access_entry(user->na->nc, ci)))
|
||||
if ((access = get_access_entry(user->nc, ci)))
|
||||
access->last_seen = time(NULL);
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -77,8 +77,7 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char *
|
||||
// Command requires registered users only
|
||||
if (!nick_identified(u))
|
||||
{
|
||||
// XXX: we should have a new string for this
|
||||
notice_lang(service, u, ACCESS_DENIED);
|
||||
notice_lang(service, u, NICK_IDENTIFY_REQUIRED, service);
|
||||
alog("Access denied for unregistered user %s with service %s and command %s", u->nick, service, cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
+33
-33
@@ -61,7 +61,7 @@ class CommandBSInfo : public Command
|
||||
|
||||
int need_comma = 0;
|
||||
char buf[BUFSIZE], *end;
|
||||
const char *commastr = getstring(u->na, COMMA_SPACE);
|
||||
const char *commastr = getstring(u, COMMA_SPACE);
|
||||
|
||||
if ((bi = findbot(query)))
|
||||
{
|
||||
@@ -74,7 +74,7 @@ class CommandBSInfo : public Command
|
||||
strftime_lang(buf, sizeof(buf), u, STRFTIME_DATE_TIME_FORMAT, tm);
|
||||
notice_lang(s_BotServ, u, BOT_INFO_BOT_CREATED, buf);
|
||||
notice_lang(s_BotServ, u, BOT_INFO_BOT_OPTIONS,
|
||||
getstring(u->na,
|
||||
getstring(u,
|
||||
(bi->
|
||||
flags & BI_PRIVATE) ? BOT_INFO_OPT_PRIVATE :
|
||||
BOT_INFO_OPT_NONE));
|
||||
@@ -104,137 +104,137 @@ class CommandBSInfo : public Command
|
||||
if (ci->botflags & BS_KICK_BADWORDS) {
|
||||
if (ci->ttb[TTB_BADWORDS])
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_BADWORDS_BAN,
|
||||
getstring(u->na, BOT_INFO_ACTIVE),
|
||||
getstring(u, BOT_INFO_ACTIVE),
|
||||
ci->ttb[TTB_BADWORDS]);
|
||||
else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_BADWORDS,
|
||||
getstring(u->na, BOT_INFO_ACTIVE));
|
||||
getstring(u, BOT_INFO_ACTIVE));
|
||||
} else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_BADWORDS,
|
||||
getstring(u->na, BOT_INFO_INACTIVE));
|
||||
getstring(u, BOT_INFO_INACTIVE));
|
||||
if (ci->botflags & BS_KICK_BOLDS) {
|
||||
if (ci->ttb[TTB_BOLDS])
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_BOLDS_BAN,
|
||||
getstring(u->na, BOT_INFO_ACTIVE),
|
||||
getstring(u, BOT_INFO_ACTIVE),
|
||||
ci->ttb[TTB_BOLDS]);
|
||||
else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_BOLDS,
|
||||
getstring(u->na, BOT_INFO_ACTIVE));
|
||||
getstring(u, BOT_INFO_ACTIVE));
|
||||
} else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_BOLDS,
|
||||
getstring(u->na, BOT_INFO_INACTIVE));
|
||||
getstring(u, BOT_INFO_INACTIVE));
|
||||
if (ci->botflags & BS_KICK_CAPS) {
|
||||
if (ci->ttb[TTB_CAPS])
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_CAPS_BAN,
|
||||
getstring(u->na, BOT_INFO_ACTIVE),
|
||||
getstring(u, BOT_INFO_ACTIVE),
|
||||
ci->ttb[TTB_CAPS], ci->capsmin,
|
||||
ci->capspercent);
|
||||
else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_CAPS_ON,
|
||||
getstring(u->na, BOT_INFO_ACTIVE), ci->capsmin,
|
||||
getstring(u, BOT_INFO_ACTIVE), ci->capsmin,
|
||||
ci->capspercent);
|
||||
} else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_CAPS_OFF,
|
||||
getstring(u->na, BOT_INFO_INACTIVE));
|
||||
getstring(u, BOT_INFO_INACTIVE));
|
||||
if (ci->botflags & BS_KICK_COLORS) {
|
||||
if (ci->ttb[TTB_COLORS])
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_COLORS_BAN,
|
||||
getstring(u->na, BOT_INFO_ACTIVE),
|
||||
getstring(u, BOT_INFO_ACTIVE),
|
||||
ci->ttb[TTB_COLORS]);
|
||||
else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_COLORS,
|
||||
getstring(u->na, BOT_INFO_ACTIVE));
|
||||
getstring(u, BOT_INFO_ACTIVE));
|
||||
} else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_COLORS,
|
||||
getstring(u->na, BOT_INFO_INACTIVE));
|
||||
getstring(u, BOT_INFO_INACTIVE));
|
||||
if (ci->botflags & BS_KICK_FLOOD) {
|
||||
if (ci->ttb[TTB_FLOOD])
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_FLOOD_BAN,
|
||||
getstring(u->na, BOT_INFO_ACTIVE),
|
||||
getstring(u, BOT_INFO_ACTIVE),
|
||||
ci->ttb[TTB_FLOOD], ci->floodlines,
|
||||
ci->floodsecs);
|
||||
else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_FLOOD_ON,
|
||||
getstring(u->na, BOT_INFO_ACTIVE),
|
||||
getstring(u, BOT_INFO_ACTIVE),
|
||||
ci->floodlines, ci->floodsecs);
|
||||
} else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_FLOOD_OFF,
|
||||
getstring(u->na, BOT_INFO_INACTIVE));
|
||||
getstring(u, BOT_INFO_INACTIVE));
|
||||
if (ci->botflags & BS_KICK_REPEAT) {
|
||||
if (ci->ttb[TTB_REPEAT])
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_REPEAT_BAN,
|
||||
getstring(u->na, BOT_INFO_ACTIVE),
|
||||
getstring(u, BOT_INFO_ACTIVE),
|
||||
ci->ttb[TTB_REPEAT], ci->repeattimes);
|
||||
else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_REPEAT_ON,
|
||||
getstring(u->na, BOT_INFO_ACTIVE),
|
||||
getstring(u, BOT_INFO_ACTIVE),
|
||||
ci->repeattimes);
|
||||
} else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_REPEAT_OFF,
|
||||
getstring(u->na, BOT_INFO_INACTIVE));
|
||||
getstring(u, BOT_INFO_INACTIVE));
|
||||
if (ci->botflags & BS_KICK_REVERSES) {
|
||||
if (ci->ttb[TTB_REVERSES])
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_REVERSES_BAN,
|
||||
getstring(u->na, BOT_INFO_ACTIVE),
|
||||
getstring(u, BOT_INFO_ACTIVE),
|
||||
ci->ttb[TTB_REVERSES]);
|
||||
else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_REVERSES,
|
||||
getstring(u->na, BOT_INFO_ACTIVE));
|
||||
getstring(u, BOT_INFO_ACTIVE));
|
||||
} else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_REVERSES,
|
||||
getstring(u->na, BOT_INFO_INACTIVE));
|
||||
getstring(u, BOT_INFO_INACTIVE));
|
||||
if (ci->botflags & BS_KICK_UNDERLINES) {
|
||||
if (ci->ttb[TTB_UNDERLINES])
|
||||
notice_lang(s_BotServ, u,
|
||||
BOT_INFO_CHAN_KICK_UNDERLINES_BAN,
|
||||
getstring(u->na, BOT_INFO_ACTIVE),
|
||||
getstring(u, BOT_INFO_ACTIVE),
|
||||
ci->ttb[TTB_UNDERLINES]);
|
||||
else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_UNDERLINES,
|
||||
getstring(u->na, BOT_INFO_ACTIVE));
|
||||
getstring(u, BOT_INFO_ACTIVE));
|
||||
} else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_KICK_UNDERLINES,
|
||||
getstring(u->na, BOT_INFO_INACTIVE));
|
||||
getstring(u, BOT_INFO_INACTIVE));
|
||||
|
||||
end = buf;
|
||||
*end = 0;
|
||||
if (ci->botflags & BS_DONTKICKOPS) {
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s",
|
||||
getstring(u->na, BOT_INFO_OPT_DONTKICKOPS));
|
||||
getstring(u, BOT_INFO_OPT_DONTKICKOPS));
|
||||
need_comma = 1;
|
||||
}
|
||||
if (ci->botflags & BS_DONTKICKVOICES) {
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s",
|
||||
need_comma ? commastr : "",
|
||||
getstring(u->na, BOT_INFO_OPT_DONTKICKVOICES));
|
||||
getstring(u, BOT_INFO_OPT_DONTKICKVOICES));
|
||||
need_comma = 1;
|
||||
}
|
||||
if (ci->botflags & BS_FANTASY) {
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s",
|
||||
need_comma ? commastr : "",
|
||||
getstring(u->na, BOT_INFO_OPT_FANTASY));
|
||||
getstring(u, BOT_INFO_OPT_FANTASY));
|
||||
need_comma = 1;
|
||||
}
|
||||
if (ci->botflags & BS_GREET) {
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s",
|
||||
need_comma ? commastr : "",
|
||||
getstring(u->na, BOT_INFO_OPT_GREET));
|
||||
getstring(u, BOT_INFO_OPT_GREET));
|
||||
need_comma = 1;
|
||||
}
|
||||
if (ci->botflags & BS_NOBOT) {
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s",
|
||||
need_comma ? commastr : "",
|
||||
getstring(u->na, BOT_INFO_OPT_NOBOT));
|
||||
getstring(u, BOT_INFO_OPT_NOBOT));
|
||||
need_comma = 1;
|
||||
}
|
||||
if (ci->botflags & BS_SYMBIOSIS) {
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s",
|
||||
need_comma ? commastr : "",
|
||||
getstring(u->na, BOT_INFO_OPT_SYMBIOSIS));
|
||||
getstring(u, BOT_INFO_OPT_SYMBIOSIS));
|
||||
need_comma = 1;
|
||||
}
|
||||
notice_lang(s_BotServ, u, BOT_INFO_CHAN_OPTIONS,
|
||||
*buf ? buf : getstring(u->na, BOT_INFO_OPT_NONE));
|
||||
*buf ? buf : getstring(u, BOT_INFO_OPT_NONE));
|
||||
|
||||
} else
|
||||
notice_lang(s_BotServ, u, BOT_INFO_NOT_FOUND, query);
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ class CommandBSKick : public Command
|
||||
notice_lang(s_BotServ, u, CHAN_X_NOT_REGISTERED, chan);
|
||||
else if (ci->flags & CI_FORBIDDEN)
|
||||
notice_lang(s_BotServ, u, CHAN_X_FORBIDDEN, chan);
|
||||
else if (!check_access(u, ci, CA_SET) && !u->na->nc->HasCommand("botserv/administration"))
|
||||
else if (!check_access(u, ci, CA_SET) && !u->nc->HasCommand("botserv/administration"))
|
||||
notice_lang(s_BotServ, u, ACCESS_DENIED);
|
||||
else if (!ci->bi)
|
||||
notice_help(s_BotServ, u, BOT_NOT_ASSIGNED);
|
||||
|
||||
+4
-4
@@ -82,7 +82,7 @@ int akick_list(User * u, int index, ChannelInfo * ci, int *sent_header)
|
||||
((akick->flags & AK_ISNICK) ? akick->u.nc->
|
||||
display : akick->u.mask),
|
||||
(akick->reason ? akick->
|
||||
reason : getstring(u->na, NO_REASON)));
|
||||
reason : getstring(u, NO_REASON)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ int akick_view(User * u, int index, ChannelInfo * ci, int *sent_header)
|
||||
strftime_lang(timebuf, sizeof(timebuf), u,
|
||||
STRFTIME_SHORT_DATE_FORMAT, &tm);
|
||||
} else {
|
||||
snprintf(timebuf, sizeof(timebuf), "%s", getstring(u->na, UNKNOWN));
|
||||
snprintf(timebuf, sizeof(timebuf), "%s", getstring(u, UNKNOWN));
|
||||
}
|
||||
|
||||
notice_lang(s_ChanServ, u,
|
||||
@@ -122,11 +122,11 @@ int akick_view(User * u, int index, ChannelInfo * ci, int *sent_header)
|
||||
CHAN_AKICK_VIEW_FORMAT), index + 1,
|
||||
((akick->flags & AK_ISNICK) ? akick->u.nc->
|
||||
display : akick->u.mask),
|
||||
akick->creator ? akick->creator : getstring(u->na,
|
||||
akick->creator ? akick->creator : getstring(u,
|
||||
UNKNOWN),
|
||||
timebuf,
|
||||
(akick->reason ? akick->
|
||||
reason : getstring(u->na, NO_REASON)));
|
||||
reason : getstring(u, NO_REASON)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ class CommandCSHelp : public Command
|
||||
{
|
||||
notice_help(s_ChanServ, u, CHAN_HELP_LEVELS_DESC_FORMAT,
|
||||
levelinfo_maxwidth, levelinfo[i].name,
|
||||
getstring(u->na, levelinfo[i].desc));
|
||||
getstring(u, levelinfo[i].desc));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+16
-16
@@ -28,11 +28,11 @@ void myChanServHelp(User * u)
|
||||
|
||||
class CommandCSInfo : public Command
|
||||
{ // cannot be const, as it is modified.
|
||||
void CheckOptStr(std::string &buf, int opt, const std::string &str, ChannelInfo *ci, NickAlias *na)
|
||||
void CheckOptStr(std::string &buf, int opt, const std::string &str, ChannelInfo *ci, NickCore *nc)
|
||||
{
|
||||
if (ci->flags & opt)
|
||||
{
|
||||
const char *commastr = getstring(na, COMMA_SPACE);
|
||||
const char *commastr = getstring(nc, COMMA_SPACE);
|
||||
if (!buf.empty())
|
||||
buf += commastr;
|
||||
|
||||
@@ -69,7 +69,7 @@ class CommandCSInfo : public Command
|
||||
notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN_OPER, chan,
|
||||
ci->forbidby,
|
||||
(ci->forbidreason ? ci->
|
||||
forbidreason : getstring(u->na, NO_REASON)));
|
||||
forbidreason : getstring(u, NO_REASON)));
|
||||
else
|
||||
notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN, chan);
|
||||
|
||||
@@ -115,19 +115,19 @@ class CommandCSInfo : public Command
|
||||
notice_lang(s_ChanServ, u, CHAN_INFO_BANTYPE, ci->bantype);
|
||||
std::string optbuf;
|
||||
|
||||
CheckOptStr(optbuf, CI_KEEPTOPIC, getstring(u->na, CHAN_INFO_OPT_KEEPTOPIC), ci, u->na);
|
||||
CheckOptStr(optbuf, CI_OPNOTICE, getstring(u->na, CHAN_INFO_OPT_OPNOTICE), ci, u->na);
|
||||
CheckOptStr(optbuf, CI_PEACE, getstring(u->na, CHAN_INFO_OPT_PEACE), ci, u->na);
|
||||
CheckOptStr(optbuf, CI_PRIVATE, getstring(u->na, CHAN_INFO_OPT_PRIVATE), ci, u->na);
|
||||
CheckOptStr(optbuf, CI_RESTRICTED, getstring(u->na, CHAN_INFO_OPT_RESTRICTED), ci, u->na);
|
||||
CheckOptStr(optbuf, CI_SECURE, getstring(u->na, CHAN_INFO_OPT_SECURE), ci, u->na);
|
||||
CheckOptStr(optbuf, CI_SECUREFOUNDER, getstring(u->na, CHAN_INFO_OPT_SECUREFOUNDER), ci, u->na);
|
||||
CheckOptStr(optbuf, CI_SECUREOPS, getstring(u->na, CHAN_INFO_OPT_SECUREOPS), ci, u->na);
|
||||
CheckOptStr(optbuf, CI_SIGNKICK | CI_SIGNKICK_LEVEL, getstring(u->na, CHAN_INFO_OPT_SIGNKICK), ci, u->na);
|
||||
CheckOptStr(optbuf, CI_TOPICLOCK, getstring(u->na, CHAN_INFO_OPT_TOPICLOCK), ci, u->na);
|
||||
CheckOptStr(optbuf, CI_XOP, getstring(u->na, CHAN_INFO_OPT_XOP), ci, u->na);
|
||||
CheckOptStr(optbuf, CI_KEEPTOPIC, getstring(u, CHAN_INFO_OPT_KEEPTOPIC), ci, u->nc);
|
||||
CheckOptStr(optbuf, CI_OPNOTICE, getstring(u, CHAN_INFO_OPT_OPNOTICE), ci, u->nc);
|
||||
CheckOptStr(optbuf, CI_PEACE, getstring(u, CHAN_INFO_OPT_PEACE), ci, u->nc);
|
||||
CheckOptStr(optbuf, CI_PRIVATE, getstring(u, CHAN_INFO_OPT_PRIVATE), ci, u->nc);
|
||||
CheckOptStr(optbuf, CI_RESTRICTED, getstring(u, CHAN_INFO_OPT_RESTRICTED), ci, u->nc);
|
||||
CheckOptStr(optbuf, CI_SECURE, getstring(u, CHAN_INFO_OPT_SECURE), ci, u->nc);
|
||||
CheckOptStr(optbuf, CI_SECUREFOUNDER, getstring(u, CHAN_INFO_OPT_SECUREFOUNDER), ci, u->nc);
|
||||
CheckOptStr(optbuf, CI_SECUREOPS, getstring(u, CHAN_INFO_OPT_SECUREOPS), ci, u->nc);
|
||||
CheckOptStr(optbuf, CI_SIGNKICK | CI_SIGNKICK_LEVEL, getstring(u, CHAN_INFO_OPT_SIGNKICK), ci, u->nc);
|
||||
CheckOptStr(optbuf, CI_TOPICLOCK, getstring(u, CHAN_INFO_OPT_TOPICLOCK), ci, u->nc);
|
||||
CheckOptStr(optbuf, CI_XOP, getstring(u, CHAN_INFO_OPT_XOP), ci, u->nc);
|
||||
|
||||
notice_lang(s_ChanServ, u, CHAN_INFO_OPTIONS, optbuf.empty() ? getstring(u->na, CHAN_INFO_OPT_NONE) : optbuf.c_str());
|
||||
notice_lang(s_ChanServ, u, CHAN_INFO_OPTIONS, optbuf.empty() ? getstring(u, CHAN_INFO_OPT_NONE) : optbuf.c_str());
|
||||
notice_lang(s_ChanServ, u, CHAN_INFO_MODE_LOCK, get_mlock_modes(ci, 1));
|
||||
|
||||
// XXX: we could just as easily (and tidily) merge this in with the flags display above.
|
||||
@@ -148,7 +148,7 @@ class CommandCSInfo : public Command
|
||||
}
|
||||
if (ci->flags & CI_SUSPENDED)
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_X_SUSPENDED, ci->forbidby, (ci->forbidreason ? ci->forbidreason : getstring(u->na, NO_REASON)));
|
||||
notice_lang(s_ChanServ, u, CHAN_X_SUSPENDED, ci->forbidby, (ci->forbidreason ? ci->forbidreason : getstring(u, NO_REASON)));
|
||||
}
|
||||
|
||||
if (!show_all && (check_access(u, ci, CA_INFO) || is_servadmin))
|
||||
|
||||
@@ -56,10 +56,6 @@ class CommandCSRegister : public Command
|
||||
notice_lang(s_ChanServ, u, CHAN_SYMBOL_REQUIRED);
|
||||
else if (!ircdproto->IsChannelValid(chan))
|
||||
notice_lang(s_ChanServ, u, CHAN_X_INVALID, chan);
|
||||
else if (!u->na || !(nc = u->na->nc))
|
||||
notice_lang(s_ChanServ, u, CHAN_MUST_REGISTER_NICK, s_NickServ);
|
||||
else if (!nick_recognized(u))
|
||||
notice_lang(s_ChanServ, u, CHAN_MUST_IDENTIFY_NICK, s_NickServ, s_NickServ);
|
||||
else if (!(c = findchan(chan)))
|
||||
notice_lang(s_ChanServ, u, CHAN_REGISTER_NONE_CHANNEL, chan);
|
||||
else if ((ci = cs_findchan(chan)))
|
||||
|
||||
@@ -44,24 +44,24 @@ class CommandCSSendPass : public Command
|
||||
{
|
||||
MailInfo *mail;
|
||||
|
||||
snprintf(buf, sizeof(buf), getstring2(founder, CHAN_SENDPASS_SUBJECT), ci->name);
|
||||
snprintf(buf, sizeof(buf), getstring(founder, CHAN_SENDPASS_SUBJECT), ci->name);
|
||||
mail = MailBegin(u, founder, buf, s_ChanServ);
|
||||
if (!mail)
|
||||
return MOD_CONT;
|
||||
|
||||
fprintf(mail->pipe, getstring2(founder, CHAN_SENDPASS_HEAD));
|
||||
fprintf(mail->pipe, getstring(founder, CHAN_SENDPASS_HEAD));
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, getstring2(founder, CHAN_SENDPASS_LINE_1),
|
||||
fprintf(mail->pipe, getstring(founder, CHAN_SENDPASS_LINE_1),
|
||||
ci->name);
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, getstring2(founder, CHAN_SENDPASS_LINE_2),
|
||||
fprintf(mail->pipe, getstring(founder, CHAN_SENDPASS_LINE_2),
|
||||
tmp_pass);
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, getstring2(founder, CHAN_SENDPASS_LINE_3));
|
||||
fprintf(mail->pipe, getstring(founder, CHAN_SENDPASS_LINE_3));
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, getstring2(founder, CHAN_SENDPASS_LINE_4));
|
||||
fprintf(mail->pipe, getstring(founder, CHAN_SENDPASS_LINE_4));
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, getstring2(founder, CHAN_SENDPASS_LINE_5),
|
||||
fprintf(mail->pipe, getstring(founder, CHAN_SENDPASS_LINE_5),
|
||||
NetworkName);
|
||||
fprintf(mail->pipe, "\n.\n");
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class CommandMSCancel : public Command
|
||||
|
||||
for (i = mi->memos.size() - 1; i >= 0; --i)
|
||||
{
|
||||
if ((mi->memos[i]->flags & MF_UNREAD) && !stricmp(mi->memos[i]->sender, u->na->nc->display) && (!(mi->memos[i]->flags & MF_NOTIFYS)))
|
||||
if ((mi->memos[i]->flags & MF_UNREAD) && !stricmp(mi->memos[i]->sender, u->nc->display) && (!(mi->memos[i]->flags & MF_NOTIFYS)))
|
||||
{
|
||||
delmemo(mi, mi->memos[i]->number);
|
||||
notice_lang(s_MemoServ, u, MEMO_CANCELLED, name);
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ class CommandMSCheck : public Command
|
||||
|
||||
for (i = mi->memos.size() - 1; i >= 0; --i)
|
||||
{
|
||||
if (!stricmp(mi->memos[i]->sender, u->na->nc->display))
|
||||
if (!stricmp(mi->memos[i]->sender, u->nc->display))
|
||||
{
|
||||
found = 1; /* Yes, we've found the memo */
|
||||
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ class CommandMSDel : public Command
|
||||
notice_lang(s_MemoServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ);
|
||||
return MOD_CONT;
|
||||
}
|
||||
mi = &u->na->nc->memos;
|
||||
mi = &u->nc->memos;
|
||||
}
|
||||
if (!numstr || (!isdigit(*numstr) && stricmp(numstr, "ALL") && stricmp(numstr, "LAST")))
|
||||
this->OnSyntaxError(u);
|
||||
|
||||
+7
-7
@@ -82,11 +82,11 @@ class CommandMSInfo : public Command
|
||||
notice_lang(s_MemoServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ);
|
||||
return MOD_CONT;
|
||||
}
|
||||
mi = &u->na->nc->memos;
|
||||
hardmax = u->na->nc->flags & NI_MEMO_HARDMAX ? 1 : 0;
|
||||
mi = &u->nc->memos;
|
||||
hardmax = u->nc->flags & NI_MEMO_HARDMAX ? 1 : 0;
|
||||
}
|
||||
|
||||
if (name && (ci || na->nc != u->na->nc))
|
||||
if (name && (ci || na->nc != u->nc))
|
||||
{
|
||||
if (mi->memos.empty())
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_X_NO_MEMOS, name);
|
||||
@@ -145,7 +145,7 @@ class CommandMSInfo : public Command
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_X_NOTIFY_OFF, name);
|
||||
}
|
||||
}
|
||||
else /* !name || (!ci || na->nc == u->na->nc) */
|
||||
else /* !name || (!ci || na->nc == u->nc) */
|
||||
{
|
||||
if (mi->memos.empty())
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_NO_MEMOS);
|
||||
@@ -192,11 +192,11 @@ class CommandMSInfo : public Command
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_NO_LIMIT);
|
||||
|
||||
/* Ripped too. But differently because of a seg fault (loughs) */
|
||||
if ((u->na->nc->flags & NI_MEMO_RECEIVE) && (u->na->nc->flags & NI_MEMO_SIGNON))
|
||||
if ((u->nc->flags & NI_MEMO_RECEIVE) && (u->nc->flags & NI_MEMO_SIGNON))
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_NOTIFY_ON);
|
||||
else if (u->na->nc->flags & NI_MEMO_RECEIVE)
|
||||
else if (u->nc->flags & NI_MEMO_RECEIVE)
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_NOTIFY_RECEIVE);
|
||||
else if (u->na->nc->flags & NI_MEMO_SIGNON)
|
||||
else if (u->nc->flags & NI_MEMO_SIGNON)
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_NOTIFY_SIGNON);
|
||||
else
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_NOTIFY_OFF);
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ class CommandMSList : public Command
|
||||
notice_lang(s_MemoServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ);
|
||||
return MOD_CONT;
|
||||
}
|
||||
mi = &u->na->nc->memos;
|
||||
mi = &u->nc->memos;
|
||||
}
|
||||
if (param && !isdigit(*param) && stricmp(param, "NEW"))
|
||||
this->OnSyntaxError(u);
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ class CommandMSRead : public Command
|
||||
notice_lang(s_MemoServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ);
|
||||
return MOD_CONT;
|
||||
}
|
||||
mi = &u->na->nc->memos;
|
||||
mi = &u->nc->memos;
|
||||
}
|
||||
num = numstr ? atoi(numstr) : -1;
|
||||
if (!numstr || (stricmp(numstr, "LAST") && stricmp(numstr, "NEW") && num <= 0))
|
||||
|
||||
+3
-6
@@ -34,13 +34,10 @@ class CommandMSRSend : public Command
|
||||
/* prevent user from rsend to themselves */
|
||||
if ((na = findnick(name)))
|
||||
{
|
||||
if (u->na)
|
||||
if (na->nc == u->nc)
|
||||
{
|
||||
if (!stricmp(na->nc->display, u->na->nc->display))
|
||||
{
|
||||
notice_lang(s_MemoServ, u, MEMO_NO_RSEND_SELF);
|
||||
return MOD_CONT;
|
||||
}
|
||||
notice_lang(s_MemoServ, u, MEMO_NO_RSEND_SELF);
|
||||
return MOD_CONT;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+19
-17
@@ -26,26 +26,26 @@ class CommandMSSet : public Command
|
||||
|
||||
if (!stricmp(param, "ON"))
|
||||
{
|
||||
u->na->nc->flags |= NI_MEMO_SIGNON | NI_MEMO_RECEIVE;
|
||||
u->nc->flags |= NI_MEMO_SIGNON | NI_MEMO_RECEIVE;
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_ON, s_MemoServ);
|
||||
}
|
||||
else if (!stricmp(param, "LOGON"))
|
||||
{
|
||||
u->na->nc->flags |= NI_MEMO_SIGNON;
|
||||
u->na->nc->flags &= ~NI_MEMO_RECEIVE;
|
||||
u->nc->flags |= NI_MEMO_SIGNON;
|
||||
u->nc->flags &= ~NI_MEMO_RECEIVE;
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_LOGON, s_MemoServ);
|
||||
}
|
||||
else if (!stricmp(param, "NEW"))
|
||||
{
|
||||
u->na->nc->flags &= ~NI_MEMO_SIGNON;
|
||||
u->na->nc->flags |= NI_MEMO_RECEIVE;
|
||||
u->nc->flags &= ~NI_MEMO_SIGNON;
|
||||
u->nc->flags |= NI_MEMO_RECEIVE;
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_NEW, s_MemoServ);
|
||||
}
|
||||
else if (!stricmp(param, "MAIL"))
|
||||
{
|
||||
if (u->na->nc->email)
|
||||
if (u->nc->email)
|
||||
{
|
||||
u->na->nc->flags |= NI_MEMO_MAIL;
|
||||
u->nc->flags |= NI_MEMO_MAIL;
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_MAIL);
|
||||
}
|
||||
else
|
||||
@@ -53,12 +53,12 @@ class CommandMSSet : public Command
|
||||
}
|
||||
else if (!stricmp(param, "NOMAIL"))
|
||||
{
|
||||
u->na->nc->flags &= ~NI_MEMO_MAIL;
|
||||
u->nc->flags &= ~NI_MEMO_MAIL;
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_NOMAIL);
|
||||
}
|
||||
else if (!stricmp(param, "OFF"))
|
||||
{
|
||||
u->na->nc->flags &= ~(NI_MEMO_SIGNON | NI_MEMO_RECEIVE);
|
||||
u->nc->flags &= ~(NI_MEMO_SIGNON | NI_MEMO_RECEIVE);
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_OFF, s_MemoServ);
|
||||
}
|
||||
else
|
||||
@@ -73,7 +73,7 @@ class CommandMSSet : public Command
|
||||
const char *p3 = params.size() > 3 ? params[3].c_str() : NULL;
|
||||
const char *user = NULL, *chan = NULL;
|
||||
int32 limit;
|
||||
NickAlias *na = u->na;
|
||||
NickCore *nc = u->nc;
|
||||
ChannelInfo *ci = NULL;
|
||||
int is_servadmin = is_services_admin(u);
|
||||
|
||||
@@ -104,6 +104,7 @@ class CommandMSSet : public Command
|
||||
{
|
||||
if (p2 && stricmp(p2, "HARD") && !chan)
|
||||
{
|
||||
NickAlias *na;
|
||||
if (!(na = findnick(p1)))
|
||||
{
|
||||
notice_lang(s_MemoServ, u, NICK_X_NOT_REGISTERED, p1);
|
||||
@@ -111,6 +112,7 @@ class CommandMSSet : public Command
|
||||
}
|
||||
user = p1;
|
||||
mi = &na->nc->memos;
|
||||
nc = na->nc;
|
||||
p1 = p2;
|
||||
p2 = p3;
|
||||
}
|
||||
@@ -134,9 +136,9 @@ class CommandMSSet : public Command
|
||||
else
|
||||
{
|
||||
if (p2)
|
||||
na->nc->flags |= NI_MEMO_HARDMAX;
|
||||
nc->flags |= NI_MEMO_HARDMAX;
|
||||
else
|
||||
na->nc->flags &= ~NI_MEMO_HARDMAX;
|
||||
nc->flags &= ~NI_MEMO_HARDMAX;
|
||||
}
|
||||
limit = atoi(p1);
|
||||
if (limit < 0 || limit > 32767)
|
||||
@@ -158,7 +160,7 @@ class CommandMSSet : public Command
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_LIMIT_FORBIDDEN, chan);
|
||||
return MOD_CONT;
|
||||
}
|
||||
else if (!chan && (na->nc->flags & NI_MEMO_HARDMAX)) {
|
||||
else if (!chan && (nc->flags & NI_MEMO_HARDMAX)) {
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_YOUR_LIMIT_FORBIDDEN);
|
||||
return MOD_CONT;
|
||||
}
|
||||
@@ -182,21 +184,21 @@ class CommandMSSet : public Command
|
||||
mi->memomax = limit;
|
||||
if (limit > 0)
|
||||
{
|
||||
if (!chan && na->nc == u->na->nc)
|
||||
if (!chan && nc == u->nc)
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_YOUR_LIMIT, limit);
|
||||
else
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_LIMIT, chan ? chan : user, limit);
|
||||
}
|
||||
else if (!limit)
|
||||
{
|
||||
if (!chan && na->nc == u->na->nc)
|
||||
if (!chan && nc == u->nc)
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_YOUR_LIMIT_ZERO);
|
||||
else
|
||||
notice_lang(s_MemoServ, u, MEMO_SET_LIMIT_ZERO, chan ? chan : user);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!chan && na->nc == u->na->nc)
|
||||
if (!chan && nc == u->nc)
|
||||
notice_lang(s_MemoServ, u, MEMO_UNSET_YOUR_LIMIT);
|
||||
else
|
||||
notice_lang(s_MemoServ, u, MEMO_UNSET_LIMIT,
|
||||
@@ -212,7 +214,7 @@ class CommandMSSet : public Command
|
||||
CommandReturn Execute(User *u, std::vector<std::string> ¶ms)
|
||||
{
|
||||
const char *cmd = params[0].c_str();
|
||||
MemoInfo *mi = &u->na->nc->memos;
|
||||
MemoInfo *mi = &u->nc->memos;
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
|
||||
+35
-35
@@ -20,32 +20,34 @@ void myNickServHelp(User *u);
|
||||
class CommandNSAccess : public Command
|
||||
{
|
||||
private:
|
||||
CommandReturn DoServAdminList(User *u, std::vector<std::string> ¶ms, NickAlias *na)
|
||||
CommandReturn DoServAdminList(User *u, std::vector<std::string> ¶ms, NickCore *nc)
|
||||
{
|
||||
const char *mask = params.size() > 2 ? params[2].c_str() : NULL;
|
||||
char **access;
|
||||
int i;
|
||||
|
||||
if (!na->nc->accesscount)
|
||||
if (!nc->accesscount)
|
||||
{
|
||||
notice_lang(s_NickServ, u, NICK_ACCESS_LIST_X_EMPTY, na->nick);
|
||||
notice_lang(s_NickServ, u, NICK_ACCESS_LIST_X_EMPTY, nc->display);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
/* reinstate when forbidden is moved to a group flag
|
||||
if (na->status & NS_FORBIDDEN)
|
||||
{
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, na->nick);
|
||||
return MOD_CONT;
|
||||
}
|
||||
*/
|
||||
|
||||
if (na->nc->flags & NI_SUSPENDED)
|
||||
if (nc->flags & NI_SUSPENDED)
|
||||
{
|
||||
notice_lang(s_NickServ, u, NICK_X_SUSPENDED, na->nick);
|
||||
notice_lang(s_NickServ, u, NICK_X_SUSPENDED, nc->display);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
notice_lang(s_NickServ, u, NICK_ACCESS_LIST_X, params[1].c_str());
|
||||
for (access = na->nc->access, i = 0; i < na->nc->accesscount; ++access, ++i)
|
||||
for (access = nc->access, i = 0; i < nc->accesscount; ++access, ++i)
|
||||
{
|
||||
if (mask && !match_wild(mask, *access))
|
||||
continue;
|
||||
@@ -55,7 +57,7 @@ class CommandNSAccess : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
CommandReturn DoAdd(User *u, std::vector<std::string> ¶ms, NickAlias *na, const char *mask)
|
||||
CommandReturn DoAdd(User *u, std::vector<std::string> ¶ms, NickCore *nc, const char *mask)
|
||||
{
|
||||
char **access;
|
||||
int i;
|
||||
@@ -66,13 +68,13 @@ class CommandNSAccess : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
if (na->nc->accesscount >= NSAccessMax)
|
||||
if (nc->accesscount >= NSAccessMax)
|
||||
{
|
||||
notice_lang(s_NickServ, u, NICK_ACCESS_REACHED_LIMIT, NSAccessMax);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
for (access = na->nc->access, i = 0; i < na->nc->accesscount; ++access, ++i)
|
||||
for (access = nc->access, i = 0; i < nc->accesscount; ++access, ++i)
|
||||
{
|
||||
if (!strcmp(*access, mask))
|
||||
{
|
||||
@@ -81,15 +83,15 @@ class CommandNSAccess : public Command
|
||||
}
|
||||
}
|
||||
|
||||
++na->nc->accesscount;
|
||||
na->nc->access = static_cast<char **>(srealloc(na->nc->access, sizeof(char *) * na->nc->accesscount));
|
||||
na->nc->access[na->nc->accesscount - 1] = sstrdup(mask);
|
||||
++nc->accesscount;
|
||||
nc->access = static_cast<char **>(srealloc(nc->access, sizeof(char *) * nc->accesscount));
|
||||
nc->access[nc->accesscount - 1] = sstrdup(mask);
|
||||
notice_lang(s_NickServ, u, NICK_ACCESS_ADDED, mask);
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
CommandReturn DoDel(User *u, std::vector<std::string> ¶ms, NickAlias *na, const char *mask)
|
||||
CommandReturn DoDel(User *u, std::vector<std::string> ¶ms, NickCore *nc, const char *mask)
|
||||
{
|
||||
char **access;
|
||||
int i;
|
||||
@@ -100,12 +102,12 @@ class CommandNSAccess : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
for (access = na->nc->access, i = 0; i < na->nc->accesscount; ++access, ++i)
|
||||
for (access = nc->access, i = 0; i < nc->accesscount; ++access, ++i)
|
||||
{
|
||||
if (!stricmp(*access, mask))
|
||||
break;
|
||||
}
|
||||
if (i == na->nc->accesscount)
|
||||
if (i == nc->accesscount)
|
||||
{
|
||||
notice_lang(s_NickServ, u, NICK_ACCESS_NOT_FOUND, mask);
|
||||
return MOD_CONT;
|
||||
@@ -113,33 +115,33 @@ class CommandNSAccess : public Command
|
||||
|
||||
notice_lang(s_NickServ, u, NICK_ACCESS_DELETED, *access);
|
||||
delete [] *access;
|
||||
--na->nc->accesscount;
|
||||
if (i < na->nc->accesscount) /* if it wasn't the last entry... */
|
||||
memmove(access, access + 1, (na->nc->accesscount - i) * sizeof(char *));
|
||||
if (na->nc->accesscount) /* if there are any entries left... */
|
||||
na->nc->access = static_cast<char **>(srealloc(na->nc->access, na->nc->accesscount * sizeof(char *)));
|
||||
--nc->accesscount;
|
||||
if (i < nc->accesscount) /* if it wasn't the last entry... */
|
||||
memmove(access, access + 1, (nc->accesscount - i) * sizeof(char *));
|
||||
if (nc->accesscount) /* if there are any entries left... */
|
||||
nc->access = static_cast<char **>(srealloc(nc->access, nc->accesscount * sizeof(char *)));
|
||||
else
|
||||
{
|
||||
free(na->nc->access);
|
||||
na->nc->access = NULL;
|
||||
free(nc->access);
|
||||
nc->access = NULL;
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
CommandReturn DoList(User *u, std::vector<std::string> ¶ms, NickAlias *na, const char *mask)
|
||||
CommandReturn DoList(User *u, std::vector<std::string> ¶ms, NickCore *nc, const char *mask)
|
||||
{
|
||||
char **access;
|
||||
int i;
|
||||
|
||||
if (!na->nc->accesscount)
|
||||
if (!nc->accesscount)
|
||||
{
|
||||
notice_lang(s_NickServ, u, NICK_ACCESS_LIST_EMPTY, u->nick);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
notice_lang(s_NickServ, u, NICK_ACCESS_LIST);
|
||||
for (access = na->nc->access, i = 0; i < na->nc->accesscount; ++access, ++i)
|
||||
for (access = nc->access, i = 0; i < nc->accesscount; ++access, ++i)
|
||||
{
|
||||
if (mask && !match_wild(mask, *access))
|
||||
continue;
|
||||
@@ -160,7 +162,7 @@ class CommandNSAccess : public Command
|
||||
NickAlias *na;
|
||||
|
||||
if (!stricmp(cmd, "LIST") && is_services_admin(u) && mask && (na = findnick(params[1].c_str())))
|
||||
return this->DoServAdminList(u, params, na);
|
||||
return this->DoServAdminList(u, params, na->nc);
|
||||
|
||||
if (mask && !strchr(mask, '@'))
|
||||
{
|
||||
@@ -168,20 +170,18 @@ class CommandNSAccess : public Command
|
||||
notice_lang(s_NickServ, u, MORE_INFO, s_NickServ, "ACCESS");
|
||||
|
||||
}
|
||||
else if (!(na = u->na))
|
||||
notice_lang(s_NickServ, u, NICK_NOT_REGISTERED);
|
||||
/*
|
||||
else if (na->status & NS_FORBIDDEN)
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, na->nick);
|
||||
else if (na->nc->flags & NI_SUSPENDED)
|
||||
notice_lang(s_NickServ, u, NICK_X_SUSPENDED, na->nick);
|
||||
else if (!nick_identified(u))
|
||||
notice_lang(s_NickServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ);
|
||||
*/
|
||||
else if (u->nc->flags & NI_SUSPENDED)
|
||||
notice_lang(s_NickServ, u, NICK_X_SUSPENDED, u->nc->display);
|
||||
else if (!stricmp(cmd, "ADD"))
|
||||
return this->DoAdd(u, params, na, mask);
|
||||
return this->DoAdd(u, params, u->nc, mask);
|
||||
else if (!stricmp(cmd, "DEL"))
|
||||
return this->DoDel(u, params, na, mask);
|
||||
return this->DoDel(u, params, u->nc, mask);
|
||||
else if (!stricmp(cmd, "LIST"))
|
||||
return this->DoList(u, params, na, mask);
|
||||
return this->DoList(u, params, u->nc, mask);
|
||||
else
|
||||
this->OnSyntaxError(u);
|
||||
return MOD_CONT;
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ class CommandNSAList : public Command
|
||||
|
||||
if (!is_servadmin)
|
||||
/* Non service admins can only see their own levels */
|
||||
na = u->na;
|
||||
na = findnick(u->nick);
|
||||
else
|
||||
{
|
||||
/* Services admins can request ALIST on nicks.
|
||||
@@ -61,7 +61,7 @@ class CommandNSAList : public Command
|
||||
if (nick)
|
||||
na = findnick(nick);
|
||||
else
|
||||
na = u->na;
|
||||
na = findnick(u->nick);
|
||||
}
|
||||
|
||||
/* If available, get level from arguments */
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ class CommandNSDrop : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
if (!(na = (nick ? findnick(nick) : u->na)))
|
||||
if (!(na = (nick ? findnick(nick) : findnick(u->nick))))
|
||||
{
|
||||
if (nick)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ class CommandNSDrop : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
is_mine = u->na && u->na->nc == na->nc;
|
||||
is_mine = u->nc && u->nc == na->nc;
|
||||
if (is_mine && !nick)
|
||||
my_nick = sstrdup(na->nick);
|
||||
|
||||
|
||||
@@ -61,13 +61,11 @@ class CommandNSForbid : public Command
|
||||
if (reason)
|
||||
na->last_realname = sstrdup(reason);
|
||||
|
||||
na->u = finduser(na->nick);
|
||||
if (na->u)
|
||||
na->u->na = na;
|
||||
User *curr = finduser(na->nick);
|
||||
|
||||
if (na->u)
|
||||
if (curr)
|
||||
{
|
||||
notice_lang(s_NickServ, na->u, FORCENICKCHANGE_NOW);
|
||||
notice_lang(s_NickServ, curr, FORCENICKCHANGE_NOW);
|
||||
collide(na, 0);
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -28,12 +28,11 @@ class CommandNSGhost : public Command
|
||||
{
|
||||
const char *nick = params[0].c_str();
|
||||
const char *pass = params.size() > 1 ? params[1].c_str() : NULL;
|
||||
NickAlias *na;
|
||||
User *u2;
|
||||
NickAlias *na = findnick(nick);
|
||||
|
||||
if (!(u2 = finduser(nick)))
|
||||
if (!finduser(nick))
|
||||
notice_lang(s_NickServ, u, NICK_X_NOT_IN_USE, nick);
|
||||
else if (!(na = u2->na))
|
||||
else if (!na)
|
||||
notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED, nick);
|
||||
else if (na->status & NS_FORBIDDEN)
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, na->nick);
|
||||
@@ -63,7 +62,7 @@ class CommandNSGhost : public Command
|
||||
}
|
||||
else
|
||||
{
|
||||
if (group_identified(u, na->nc) || (!(na->nc->flags & NI_SECURE) && is_on_access(u, na->nc)))
|
||||
if (u->nc == na->nc || (!(na->nc->flags & NI_SECURE) && is_on_access(u, na->nc)))
|
||||
{
|
||||
char buf[NICKMAX + 32];
|
||||
snprintf(buf, sizeof(buf), "GHOST command used by %s", u->nick);
|
||||
|
||||
+15
-24
@@ -92,19 +92,12 @@ class CommandNSGroup : public Command
|
||||
notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED, nick);
|
||||
else if (time(NULL) < u->lastnickreg + NSRegDelay)
|
||||
notice_lang(s_NickServ, u, NICK_GROUP_PLEASE_WAIT, NSRegDelay);
|
||||
else if (u->na && (u->na->status & NS_FORBIDDEN))
|
||||
{
|
||||
alog("%s: %s@%s tried to use GROUP from FORBIDden nick %s", s_NickServ, u->GetIdent().c_str(), u->host, u->nick);
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, u->nick);
|
||||
}
|
||||
else if (u->na && (u->na->nc->flags & NI_SUSPENDED))
|
||||
else if (u->nc->flags & NI_SUSPENDED)
|
||||
{
|
||||
alog("%s: %s!%s@%s tried to use GROUP from SUSPENDED nick %s", s_NickServ, u->nick, u->GetIdent().c_str(), u->host, target->nick);
|
||||
notice_lang(s_NickServ, u, NICK_X_SUSPENDED, u->nick);
|
||||
}
|
||||
else if (u->na && NSNoGroupChange)
|
||||
notice_lang(s_NickServ, u, NICK_GROUP_CHANGE_DISABLED, s_NickServ);
|
||||
else if (u->na && !nick_identified(u))
|
||||
else if (!nick_identified(u))
|
||||
notice_lang(s_NickServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ);
|
||||
else if (target && (target->nc->flags & NI_SUSPENDED))
|
||||
{
|
||||
@@ -113,7 +106,7 @@ class CommandNSGroup : public Command
|
||||
}
|
||||
else if (target->status & NS_FORBIDDEN)
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, nick);
|
||||
else if (u->na && target->nc == u->na->nc)
|
||||
else if (target->nc == u->nc)
|
||||
notice_lang(s_NickServ, u, NICK_GROUP_SAME, target->nick);
|
||||
else if (NSMaxAliases && (target->nc->aliases.count >= NSMaxAliases) && !nick_is_services_admin(target->nc))
|
||||
notice_lang(s_NickServ, u, NICK_GROUP_TOO_MANY, target->nick, s_NickServ, s_NickServ);
|
||||
@@ -128,8 +121,8 @@ class CommandNSGroup : public Command
|
||||
/* If the nick is already registered, drop it.
|
||||
* If not, check that it is valid.
|
||||
*/
|
||||
if (u->na)
|
||||
delnick(u->na);
|
||||
if (findnick(u->nick))
|
||||
delnick(findnick(u->nick));
|
||||
else
|
||||
{
|
||||
int prefixlen = strlen(NSGuestNickPrefix);
|
||||
@@ -163,9 +156,7 @@ class CommandNSGroup : public Command
|
||||
}
|
||||
}
|
||||
|
||||
u->na = na;
|
||||
u->nc = na->nc;
|
||||
na->u = u;
|
||||
|
||||
send_event(EVENT_GROUP, 1, u->nick);
|
||||
alog("%s: %s!%s@%s makes %s join group of %s (%s) (e-mail: %s)", s_NickServ, u->nick, u->GetIdent().c_str(), u->host, u->nick, target->nick, target->nc->display, (target->nc->email ? target->nc->email : "none"));
|
||||
@@ -223,17 +214,17 @@ class CommandNSGList : public Command
|
||||
{
|
||||
const char *nick = params.size() ? params[0].c_str() : NULL;
|
||||
|
||||
NickAlias *na, *na2;
|
||||
NickCore *nc = u->nc;
|
||||
int is_servadmin = is_services_admin(u);
|
||||
int nick_ided = nick_identified(u);
|
||||
int i;
|
||||
|
||||
if (nick ? (stricmp(nick, u->nick) ? !is_servadmin : !nick_ided) : !nick_ided)
|
||||
notice_lang(s_NickServ, u, nick_ided ? ACCESS_DENIED : NICK_IDENTIFY_REQUIRED, s_NickServ);
|
||||
else if (!nick ? !(na = u->na) : !(na = findnick(nick)))
|
||||
else if (nick && (!findnick(nick) || !(nc = findnick(nick)->nc)))
|
||||
notice_lang(s_NickServ, u, !nick ? NICK_NOT_REGISTERED : NICK_X_NOT_REGISTERED, nick);
|
||||
else if (na->status & NS_FORBIDDEN)
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, na->nick);
|
||||
/* else if (na->status & NS_FORBIDDEN)
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, na->nick);*/
|
||||
else
|
||||
{
|
||||
time_t expt;
|
||||
@@ -241,22 +232,22 @@ class CommandNSGList : public Command
|
||||
char buf[BUFSIZE];
|
||||
int wont_expire;
|
||||
|
||||
notice_lang(s_NickServ, u, nick ? NICK_GLIST_HEADER_X : NICK_GLIST_HEADER, na->nc->display);
|
||||
for (i = 0; i < na->nc->aliases.count; ++i)
|
||||
notice_lang(s_NickServ, u, nick ? NICK_GLIST_HEADER_X : NICK_GLIST_HEADER, nc->display);
|
||||
for (i = 0; i < nc->aliases.count; ++i)
|
||||
{
|
||||
na2 = static_cast<NickAlias *>(na->nc->aliases.list[i]);
|
||||
if (na2->nc == na->nc)
|
||||
NickAlias *na2 = static_cast<NickAlias *>(nc->aliases.list[i]);
|
||||
if (na2->nc == nc)
|
||||
{
|
||||
if (!(wont_expire = na2->status & NS_NO_EXPIRE))
|
||||
{
|
||||
expt = na2->last_seen + NSExpire;
|
||||
tm = localtime(&expt);
|
||||
strftime_lang(buf, sizeof(buf), na2->u, STRFTIME_DATE_TIME_FORMAT, tm);
|
||||
strftime_lang(buf, sizeof(buf), finduser(na2->nick), STRFTIME_DATE_TIME_FORMAT, tm);
|
||||
}
|
||||
notice_lang(s_NickServ, u, is_services_admin(u) && !wont_expire ? NICK_GLIST_REPLY_ADMIN : NICK_GLIST_REPLY, wont_expire ? '!' : ' ', na2->nick, buf);
|
||||
}
|
||||
}
|
||||
notice_lang(s_NickServ, u, NICK_GLIST_FOOTER, na->nc->aliases.count);
|
||||
notice_lang(s_NickServ, u, NICK_GLIST_FOOTER, nc->aliases.count);
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class CommandNSIdentify : public Command
|
||||
char modes[512];
|
||||
int len;
|
||||
|
||||
if (!(na = u->na))
|
||||
if (!(na = findnick(u->nick)))
|
||||
{
|
||||
if ((nr = findrequestnick(u->nick)))
|
||||
notice_lang(s_NickServ, u, NICK_IS_PREREG);
|
||||
@@ -74,6 +74,8 @@ class CommandNSIdentify : public Command
|
||||
|
||||
na->status |= NS_IDENTIFIED;
|
||||
na->last_seen = time(NULL);
|
||||
u->nc = na->nc;
|
||||
|
||||
snprintf(tsbuf, sizeof(tsbuf), "%lu", static_cast<unsigned long>(u->timestamp));
|
||||
|
||||
if (ircd->modeonreg)
|
||||
@@ -99,7 +101,7 @@ class CommandNSIdentify : public Command
|
||||
if (NSModeOnID)
|
||||
do_setmodes(u);
|
||||
|
||||
if (NSForceEmail && u->na && !u->na->nc->email)
|
||||
if (NSForceEmail && u->nc && !u->nc->email)
|
||||
{
|
||||
notice_lang(s_NickServ, u, NICK_IDENTIFY_EMAIL_REQUIRED);
|
||||
notice_help(s_NickServ, u, NICK_IDENTIFY_EMAIL_HOWTO);
|
||||
@@ -108,10 +110,6 @@ class CommandNSIdentify : public Command
|
||||
if (!(na->status & NS_RECOGNIZED))
|
||||
check_memos(u);
|
||||
|
||||
/* Enable nick tracking if enabled */
|
||||
if (NSNickTracking)
|
||||
nsStartNickTracking(u);
|
||||
|
||||
/* Clear any timers */
|
||||
if (na->nc->flags & NI_KILLPROTECT)
|
||||
del_ns_timeout(na, TO_COLLIDE);
|
||||
|
||||
+13
-14
@@ -21,11 +21,11 @@ class CommandNSInfo : public Command
|
||||
{
|
||||
private:
|
||||
// cannot be const, as it is modified
|
||||
void CheckOptStr(std::string &buf, int opt, const std::string &str, NickCore *nc, NickAlias *na, bool reverse_logic = false)
|
||||
void CheckOptStr(std::string &buf, int opt, const std::string &str, NickCore *nc, bool reverse_logic = false)
|
||||
{
|
||||
if (reverse_logic ? !(nc->flags & opt) : (nc->flags & opt))
|
||||
{
|
||||
const char *commastr = getstring(na, COMMA_SPACE);
|
||||
const char *commastr = getstring(nc, COMMA_SPACE);
|
||||
if (!buf.empty())
|
||||
buf += commastr;
|
||||
|
||||
@@ -75,7 +75,7 @@ class CommandNSInfo : public Command
|
||||
else if (na->status & NS_FORBIDDEN)
|
||||
{
|
||||
if (is_oper(u) && na->last_usermask)
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN_OPER, nick, na->last_usermask, na->last_realname ? na->last_realname : getstring(u->na, NO_REASON));
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN_OPER, nick, na->last_usermask, na->last_realname ? na->last_realname : getstring(u, NO_REASON));
|
||||
else
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, nick);
|
||||
}
|
||||
@@ -93,12 +93,12 @@ class CommandNSInfo : public Command
|
||||
|
||||
/* Only show hidden fields to owner and sadmins and only when the ALL
|
||||
* parameter is used. -TheShadow */
|
||||
if (param && !stricmp(param, "ALL") && u->na && ((nick_identified(u) && na->nc == u->na->nc) || is_servadmin))
|
||||
if (param && !stricmp(param, "ALL") && u->nc && (na->nc == u->nc || is_servadmin))
|
||||
show_hidden = 1;
|
||||
|
||||
notice_lang(s_NickServ, u, NICK_INFO_REALNAME, na->nick, na->last_realname);
|
||||
|
||||
if ((nick_identified(u) && na->nc == u->na->nc) || is_servadmin)
|
||||
if (show_hidden)
|
||||
{
|
||||
if (nick_is_services_root(na->nc))
|
||||
notice_lang(s_NickServ, u, NICK_INFO_SERVICES_ROOT, na->nick);
|
||||
@@ -169,13 +169,13 @@ class CommandNSInfo : public Command
|
||||
|
||||
std::string optbuf;
|
||||
|
||||
CheckOptStr(optbuf, NI_KILLPROTECT, getstring(u->na, NICK_INFO_OPT_KILL), na->nc, u->na);
|
||||
CheckOptStr(optbuf, NI_SECURE, getstring(u->na, NICK_INFO_OPT_SECURE), na->nc, u->na);
|
||||
CheckOptStr(optbuf, NI_PRIVATE, getstring(u->na, NICK_INFO_OPT_PRIVATE), na->nc, u->na);
|
||||
CheckOptStr(optbuf, NI_MSG, getstring(u->na, NICK_INFO_OPT_MSG), na->nc, u->na);
|
||||
CheckOptStr(optbuf, NI_AUTOOP, getstring(u->na, NICK_INFO_OPT_AUTOOP), na->nc, u->na, true);
|
||||
CheckOptStr(optbuf, NI_KILLPROTECT, getstring(u, NICK_INFO_OPT_KILL), na->nc);
|
||||
CheckOptStr(optbuf, NI_SECURE, getstring(u, NICK_INFO_OPT_SECURE), na->nc);
|
||||
CheckOptStr(optbuf, NI_PRIVATE, getstring(u, NICK_INFO_OPT_PRIVATE), na->nc);
|
||||
CheckOptStr(optbuf, NI_MSG, getstring(u, NICK_INFO_OPT_MSG), na->nc);
|
||||
CheckOptStr(optbuf, NI_AUTOOP, getstring(u, NICK_INFO_OPT_AUTOOP), na->nc, true);
|
||||
|
||||
notice_lang(s_NickServ, u, NICK_INFO_OPTIONS, optbuf.empty() ? getstring(u->na, NICK_INFO_OPT_NONE) : optbuf.c_str());
|
||||
notice_lang(s_NickServ, u, NICK_INFO_OPTIONS, optbuf.empty() ? getstring(u, NICK_INFO_OPT_NONE) : optbuf.c_str());
|
||||
|
||||
if (na->nc->flags & NI_SUSPENDED)
|
||||
{
|
||||
@@ -193,14 +193,13 @@ class CommandNSInfo : public Command
|
||||
{
|
||||
expt = na->last_seen + NSExpire;
|
||||
tm = localtime(&expt);
|
||||
strftime_lang(buf, sizeof(buf), na->u, STRFTIME_DATE_TIME_FORMAT, tm);
|
||||
strftime_lang(buf, sizeof(buf), finduser(na->nick), STRFTIME_DATE_TIME_FORMAT, tm);
|
||||
notice_lang(s_NickServ, u, NICK_INFO_EXPIRE, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!show_hidden && ((u->na && (na->nc == u->na->nc) && nick_identified(u)) || is_servadmin))
|
||||
notice_lang(s_NickServ, u, NICK_INFO_FOR_MORE, s_NickServ, na->nick);
|
||||
notice_lang(s_NickServ, u, NICK_INFO_FOR_MORE, s_NickServ, na->nick);
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ class CommandNSList : public Command
|
||||
}
|
||||
}
|
||||
|
||||
mync = nick_identified(u) ? u->na->nc : NULL;
|
||||
mync = u->nc;
|
||||
|
||||
notice_lang(s_NickServ, u, NICK_LIST_HEADER, pattern);
|
||||
if (!nronly)
|
||||
|
||||
+9
-10
@@ -32,20 +32,19 @@ class CommandNSLogout : public Command
|
||||
const char *nick = params.size() ? params[0].c_str() : NULL;
|
||||
const char *param = params.size() > 1 ? params[1].c_str() : NULL;
|
||||
User *u2;
|
||||
NickAlias *na;
|
||||
|
||||
if (!is_services_admin(u) && nick)
|
||||
this->OnSyntaxError(u);
|
||||
else if (!(u2 = (nick ? finduser(nick) : u)))
|
||||
notice_lang(s_NickServ, u, NICK_X_NOT_IN_USE, nick);
|
||||
else if (!u2->na)
|
||||
else if (!(na = findnick(u2->nick)))
|
||||
{
|
||||
if (nick)
|
||||
notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED, nick);
|
||||
else
|
||||
notice_lang(s_NickServ, u, NICK_NOT_REGISTERED);
|
||||
}
|
||||
else if (u2->na->status & NS_FORBIDDEN)
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, u2->na->nick);
|
||||
else if (!nick && !nick_identified(u))
|
||||
notice_lang(s_NickServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ);
|
||||
else if (nick && is_services_admin(u2))
|
||||
@@ -58,7 +57,9 @@ class CommandNSLogout : public Command
|
||||
validate_user(u2);
|
||||
}
|
||||
else
|
||||
u2->na->status &= ~(NS_IDENTIFIED | NS_RECOGNIZED);
|
||||
{
|
||||
na->status &= ~(NS_IDENTIFIED | NS_RECOGNIZED);
|
||||
}
|
||||
|
||||
if (ircd->modeonreg)
|
||||
common_svsmode(u2, ircd->modeonunreg, "1");
|
||||
@@ -71,13 +72,11 @@ class CommandNSLogout : public Command
|
||||
else
|
||||
notice_lang(s_NickServ, u, NICK_LOGOUT_SUCCEEDED);
|
||||
|
||||
/* Stop nick tracking if enabled */
|
||||
if (NSNickTracking)
|
||||
nsStopNickTracking(u2);
|
||||
|
||||
/* Clear any timers again */
|
||||
if (u->na->nc->flags & NI_KILLPROTECT)
|
||||
del_ns_timeout(u->na, TO_COLLIDE);
|
||||
if (u->nc->flags & NI_KILLPROTECT)
|
||||
del_ns_timeout(na, TO_COLLIDE);
|
||||
|
||||
u2->nc = NULL;
|
||||
|
||||
/* Send out an event */
|
||||
send_event(EVENT_NICK_LOGOUT, 1, u2->nick);
|
||||
|
||||
@@ -33,7 +33,7 @@ class CommandNSRecover : public Command
|
||||
|
||||
if (!(u2 = finduser(nick)))
|
||||
notice_lang(s_NickServ, u, NICK_X_NOT_IN_USE, nick);
|
||||
else if (!(na = u2->na))
|
||||
else if (!(na = findnick(u2->nick)))
|
||||
notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED, nick);
|
||||
else if (na->status & NS_FORBIDDEN)
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, na->nick);
|
||||
@@ -53,7 +53,7 @@ class CommandNSRecover : public Command
|
||||
collide(na, 0);
|
||||
|
||||
/* Convert NSReleaseTimeout seconds to string format */
|
||||
duration(u2->na, relstr, sizeof(relstr), NSReleaseTimeout);
|
||||
duration(na->nc, relstr, sizeof(relstr), NSReleaseTimeout);
|
||||
|
||||
notice_lang(s_NickServ, u, NICK_RECOVERED, s_NickServ, nick, relstr);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class CommandNSRecover : public Command
|
||||
}
|
||||
else
|
||||
{
|
||||
if (group_identified(u, na->nc) || (!(na->nc->flags & NI_SECURE) && is_on_access(u, na->nc)))
|
||||
if (u->nc == na->nc || (!(na->nc->flags & NI_SECURE) && is_on_access(u, na->nc)))
|
||||
{
|
||||
notice_lang(s_NickServ, u2, FORCENICKCHANGE_NOW);
|
||||
collide(na, 0);
|
||||
@@ -86,7 +86,7 @@ class CommandNSRecover : public Command
|
||||
char relstr[192];
|
||||
|
||||
/* Convert NSReleaseTimeout seconds to string format */
|
||||
duration(u->na, relstr, sizeof(relstr), NSReleaseTimeout);
|
||||
duration(u->nc, relstr, sizeof(relstr), NSReleaseTimeout);
|
||||
|
||||
notice_help(s_NickServ, u, NICK_HELP_RECOVER, relstr);
|
||||
do_help_limited(s_NickServ, u, this);
|
||||
|
||||
+11
-15
@@ -88,9 +88,7 @@ class CommandNSConfirm : public Command
|
||||
|
||||
if (!force)
|
||||
{
|
||||
u->na = na;
|
||||
u->nc = na->nc;
|
||||
na->u = u;
|
||||
alog("%s: '%s' registered by %s@%s (e-mail: %s)", s_NickServ, u->nick, u->GetIdent().c_str(), u->host, nr->email ? nr->email : "none");
|
||||
if (NSAddAccessOnReg)
|
||||
notice_lang(s_NickServ, u, NICK_REGISTERED, u->nick, na->nc->access[0]);
|
||||
@@ -126,10 +124,6 @@ class CommandNSConfirm : public Command
|
||||
notice_lang(s_NickServ, u, NICK_FORCE_REG, nr->nick);
|
||||
delnickrequest(nr); /* remove the nick request */
|
||||
|
||||
/* Enable nick tracking if enabled */
|
||||
if (NSNickTracking)
|
||||
nsStartNickTracking(u);
|
||||
|
||||
return MOD_CONT;
|
||||
|
||||
}
|
||||
@@ -228,6 +222,7 @@ class CommandNSRegister : public CommandNSConfirm
|
||||
{
|
||||
NickRequest *nr = NULL, *anr = NULL;
|
||||
NickCore *nc = NULL;
|
||||
NickAlias *na;
|
||||
int prefixlen = strlen(NSGuestNickPrefix);
|
||||
int nicklen = strlen(u->nick);
|
||||
const char *pass = params[0].c_str();
|
||||
@@ -315,9 +310,10 @@ class CommandNSRegister : public CommandNSConfirm
|
||||
this->OnSyntaxError(u);
|
||||
else if (time(NULL) < u->lastnickreg + NSRegDelay)
|
||||
notice_lang(s_NickServ, u, NICK_REG_PLEASE_WAIT, NSRegDelay);
|
||||
else if (u->na) /* i.e. there's already such a nick regged */
|
||||
else if ((na = findnick(u->nick)))
|
||||
{
|
||||
if (u->na->status & NS_FORBIDDEN)
|
||||
/* i.e. there's already such a nick regged */
|
||||
if (na->status & NS_FORBIDDEN)
|
||||
{
|
||||
alog("%s: %s@%s tried to register FORBIDden nick %s", s_NickServ, u->GetIdent().c_str(), u->host, u->nick);
|
||||
notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick);
|
||||
@@ -498,21 +494,21 @@ int do_sendregmail(User *u, NickRequest *nr)
|
||||
|
||||
if (!nr && !u)
|
||||
return -1;
|
||||
snprintf(buf, sizeof(buf), getstring2(NULL, NICK_REG_MAIL_SUBJECT), nr->nick);
|
||||
snprintf(buf, sizeof(buf), getstring(NICK_REG_MAIL_SUBJECT), nr->nick);
|
||||
mail = MailRegBegin(u, nr, buf, s_NickServ);
|
||||
if (!mail)
|
||||
return -1;
|
||||
fprintf(mail->pipe, getstring2(NULL, NICK_REG_MAIL_HEAD));
|
||||
fprintf(mail->pipe, getstring(NICK_REG_MAIL_HEAD));
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, getstring2(NULL, NICK_REG_MAIL_LINE_1), nr->nick);
|
||||
fprintf(mail->pipe, getstring(NICK_REG_MAIL_LINE_1), nr->nick);
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, getstring2(NULL, NICK_REG_MAIL_LINE_2), s_NickServ, nr->passcode);
|
||||
fprintf(mail->pipe, getstring(NICK_REG_MAIL_LINE_2), s_NickServ, nr->passcode);
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, getstring2(NULL, NICK_REG_MAIL_LINE_3));
|
||||
fprintf(mail->pipe, getstring(NICK_REG_MAIL_LINE_3));
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, getstring2(NULL, NICK_REG_MAIL_LINE_4));
|
||||
fprintf(mail->pipe, getstring(NICK_REG_MAIL_LINE_4));
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, getstring2(NULL, NICK_REG_MAIL_LINE_5), NetworkName);
|
||||
fprintf(mail->pipe, getstring(NICK_REG_MAIL_LINE_5), NetworkName);
|
||||
fprintf(mail->pipe, "\n.\n");
|
||||
MailEnd(mail);
|
||||
return 0;
|
||||
|
||||
@@ -58,7 +58,7 @@ class CommandNSRelease : public Command
|
||||
}
|
||||
else
|
||||
{
|
||||
if (group_identified(u, na->nc) || (!(na->nc->flags & NI_SECURE) && is_on_access(u, na->nc)))
|
||||
if (u->nc == na->nc || (!(na->nc->flags & NI_SECURE) && is_on_access(u, na->nc)))
|
||||
{
|
||||
release(na, 0);
|
||||
notice_lang(s_NickServ, u, NICK_RELEASED);
|
||||
@@ -74,7 +74,7 @@ class CommandNSRelease : public Command
|
||||
char relstr[192];
|
||||
|
||||
/* Convert NSReleaseTimeout seconds to string format */
|
||||
duration(u->na, relstr, sizeof(relstr), NSReleaseTimeout);
|
||||
duration(u->nc, relstr, sizeof(relstr), NSReleaseTimeout);
|
||||
|
||||
notice_help(s_NickServ, u, NICK_HELP_RELEASE, relstr);
|
||||
do_help_limited(s_NickServ, u, this);
|
||||
|
||||
+2
-7
@@ -52,11 +52,6 @@ private:
|
||||
|
||||
change_core_display(nc, param);
|
||||
notice_lang(s_NickServ, u, NICK_SASET_DISPLAY_CHANGED, nc->display);
|
||||
|
||||
/* Enable nick tracking if enabled */
|
||||
if (NSNickTracking)
|
||||
nsStartNickTracking(u);
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -73,7 +68,7 @@ private:
|
||||
int len = strlen(param);
|
||||
char tmp_pass[PASSMAX];
|
||||
|
||||
if (NSSecureAdmins && u->na->nc != nc && nick_is_services_admin(nc) && !is_services_root(u))
|
||||
if (NSSecureAdmins && u->nc != nc && nick_is_services_admin(nc) && !is_services_root(u))
|
||||
{
|
||||
notice_lang(s_NickServ, u, PERMISSION_DENIED);
|
||||
return MOD_CONT;
|
||||
@@ -138,7 +133,7 @@ private:
|
||||
notice_lang(s_NickServ, u, NICK_SASET_EMAIL_UNSET_IMPOSSIBLE);
|
||||
return MOD_CONT;
|
||||
}
|
||||
else if (NSSecureAdmins && u->na->nc != nc && nick_is_services_admin(nc) && !is_services_root(u))
|
||||
else if (NSSecureAdmins && u->nc != nc && nick_is_services_admin(nc) && !is_services_root(u))
|
||||
{
|
||||
notice_lang(s_NickServ, u, PERMISSION_DENIED);
|
||||
return MOD_CONT;
|
||||
|
||||
+18
-24
@@ -53,11 +53,6 @@ class CommandNSSet : public Command
|
||||
|
||||
change_core_display(nc, param);
|
||||
notice_lang(s_NickServ, u, NICK_SET_DISPLAY_CHANGED, nc->display);
|
||||
|
||||
/* Enable nick tracking if enabled */
|
||||
if (NSNickTracking)
|
||||
nsStartNickTracking(u);
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -455,7 +450,6 @@ class CommandNSSet : public Command
|
||||
CommandReturn Execute(User *u, std::vector<std::string> ¶ms)
|
||||
{
|
||||
const char *cmd = params[0].c_str();
|
||||
NickAlias *na = u->na;
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
@@ -463,40 +457,40 @@ class CommandNSSet : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
if (!na)
|
||||
notice_lang(s_NickServ, u, NICK_NOT_REGISTERED);
|
||||
else if (na->status & NS_FORBIDDEN)
|
||||
/*
|
||||
if (na->status & NS_FORBIDDEN)
|
||||
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, na->nick);
|
||||
else if (na->nc->flags & NI_SUSPENDED)
|
||||
notice_lang(s_NickServ, u, NICK_X_SUSPENDED, na->nick);
|
||||
*/
|
||||
if (u->nc->flags & NI_SUSPENDED)
|
||||
notice_lang(s_NickServ, u, NICK_X_SUSPENDED, u->nc->display);
|
||||
else if (!nick_identified(u))
|
||||
notice_lang(s_NickServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ);
|
||||
else if (!stricmp(cmd, "DISPLAY"))
|
||||
return this->DoSetDisplay(u, params, na->nc);
|
||||
return this->DoSetDisplay(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "PASSWORD"))
|
||||
return this->DoSetPassword(u, params, na->nc);
|
||||
return this->DoSetPassword(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "LANGUAGE"))
|
||||
return this->DoSetLanguage(u, params, na->nc);
|
||||
return this->DoSetLanguage(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "URL"))
|
||||
return this->DoSetUrl(u, params, na->nc);
|
||||
return this->DoSetUrl(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "EMAIL"))
|
||||
return this->DoSetEmail(u, params, na->nc);
|
||||
return this->DoSetEmail(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "ICQ"))
|
||||
return this->DoSetICQ(u, params, na->nc);
|
||||
return this->DoSetICQ(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "GREET"))
|
||||
return this->DoSetGreet(u, params, na->nc);
|
||||
return this->DoSetGreet(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "KILL"))
|
||||
return this->DoSetKill(u, params, na->nc);
|
||||
return this->DoSetKill(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "SECURE"))
|
||||
return this->DoSetSecure(u, params, na->nc);
|
||||
return this->DoSetSecure(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "PRIVATE"))
|
||||
return this->DoSetPrivate(u, params, na->nc);
|
||||
return this->DoSetPrivate(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "MSG"))
|
||||
return this->DoSetMsg(u, params, na->nc);
|
||||
return this->DoSetMsg(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "HIDE"))
|
||||
return this->DoSetHide(u, params, na->nc);
|
||||
return this->DoSetHide(u, params, u->nc);
|
||||
else if (!stricmp(cmd, "AUTOOP"))
|
||||
return this->DoSetAutoOP(u, params, na->nc);
|
||||
return this->DoSetAutoOP(u, params, u->nc);
|
||||
else
|
||||
notice_lang(s_NickServ, u, NICK_SET_UNKNOWN_OPTION, cmd);
|
||||
return MOD_CONT;
|
||||
|
||||
@@ -26,20 +26,22 @@ class CommandNSUpdate : public Command
|
||||
|
||||
CommandReturn Process(User *u, std::vector<std::string> ¶ms)
|
||||
{
|
||||
if (!nick_identified(u))
|
||||
NickAlias *na = findnick(u->nick);
|
||||
|
||||
if (!na)
|
||||
{
|
||||
notice_lang(s_NickServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
if (NSModeOnID)
|
||||
do_setmodes(u);
|
||||
check_memos(u);
|
||||
if (u->na->last_realname)
|
||||
delete [] u->na->last_realname;
|
||||
u->na->last_realname = sstrdup(u->realname);
|
||||
u->na->status |= NS_IDENTIFIED;
|
||||
u->na->last_seen = time(NULL);
|
||||
|
||||
if (na->last_realname)
|
||||
delete [] na->last_realname;
|
||||
na->last_realname = sstrdup(u->realname);
|
||||
na->status |= NS_IDENTIFIED;
|
||||
na->last_seen = time(NULL);
|
||||
if (ircd->vhost)
|
||||
do_on_id(u);
|
||||
notice_lang(s_NickServ, u, NICK_UPDATE_SUCCESS, s_NickServ);
|
||||
|
||||
+1
-1
@@ -367,7 +367,7 @@ int akill_view(int number, Akill *ak, User *u, int *sent_header)
|
||||
snprintf(mask, sizeof(mask), "%s@%s", ak->user, ak->host);
|
||||
tm = *localtime(&ak->seton);
|
||||
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_SHORT_DATE_FORMAT, &tm);
|
||||
expire_left(u->na, expirebuf, sizeof(expirebuf), ak->expires);
|
||||
expire_left(u->nc, expirebuf, sizeof(expirebuf), ak->expires);
|
||||
notice_lang(s_OperServ, u, OPER_AKILL_VIEW_FORMAT, number, mask, ak->by, timebuf, expirebuf, ak->reason);
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -30,7 +30,7 @@ class CommandOSDEFCON : public Command
|
||||
{
|
||||
const char *lvl = params[0].c_str();
|
||||
int newLevel = 0;
|
||||
const char *langglobal = getstring(NULL, DEFCON_GLOBAL);
|
||||
const char *langglobal = getstring(DEFCON_GLOBAL);
|
||||
|
||||
if (!DefConLevel) /* If we dont have a .conf setting! */
|
||||
{
|
||||
@@ -56,7 +56,7 @@ class CommandOSDEFCON : public Command
|
||||
notice_lang(s_OperServ, u, OPER_DEFCON_CHANGED, DefConLevel);
|
||||
defcon_sendlvls(u);
|
||||
alog("Defcon level changed to %d by Oper %s", newLevel, u->nick);
|
||||
ircdproto->SendGlobops(s_OperServ, getstring2(NULL, OPER_DEFCON_WALL), u->nick, newLevel);
|
||||
ircdproto->SendGlobops(s_OperServ, getstring(OPER_DEFCON_WALL), u->nick, newLevel);
|
||||
/* Global notice the user what is happening. Also any Message that
|
||||
the Admin would like to add. Set in config file. */
|
||||
if (GlobalOnDefcon)
|
||||
|
||||
@@ -170,7 +170,7 @@ static int exception_view(User *u, const int index, int *sent_header)
|
||||
tm = *localtime(exceptions[index].time ? &exceptions[index].time : &t);
|
||||
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_SHORT_DATE_FORMAT, &tm);
|
||||
|
||||
expire_left(u->na, expirebuf, sizeof(expirebuf), exceptions[index].expires);
|
||||
expire_left(u->nc, expirebuf, sizeof(expirebuf), exceptions[index].expires);
|
||||
|
||||
notice_lang(s_OperServ, u, OPER_EXCEPTION_VIEW_FORMAT, index + 1, exceptions[index].mask, *exceptions[index].who ? exceptions[index].who : "<unknown>", timebuf, expirebuf, exceptions[index].limit, exceptions[index].reason);
|
||||
return 1;
|
||||
|
||||
+2
-2
@@ -158,14 +158,14 @@ class CommandOSSet : public Command
|
||||
u->isSuperAdmin = 1;
|
||||
notice_lang(s_OperServ, u, OPER_SUPER_ADMIN_ON);
|
||||
alog("%s: %s is a SuperAdmin ", s_OperServ, u->nick);
|
||||
ircdproto->SendGlobops(s_OperServ, getstring2(NULL, OPER_SUPER_ADMIN_WALL_ON), u->nick);
|
||||
ircdproto->SendGlobops(s_OperServ, getstring(OPER_SUPER_ADMIN_WALL_ON), u->nick);
|
||||
}
|
||||
else if (!stricmp(setting, "OFF"))
|
||||
{
|
||||
u->isSuperAdmin = 0;
|
||||
notice_lang(s_OperServ, u, OPER_SUPER_ADMIN_OFF);
|
||||
alog("%s: %s is no longer a SuperAdmin", s_OperServ, u->nick);
|
||||
ircdproto->SendGlobops(s_OperServ, getstring2(NULL, OPER_SUPER_ADMIN_WALL_OFF), u->nick);
|
||||
ircdproto->SendGlobops(s_OperServ, getstring(OPER_SUPER_ADMIN_WALL_OFF), u->nick);
|
||||
}
|
||||
else
|
||||
notice_lang(s_OperServ, u, OPER_SUPER_ADMIN_SYNTAX);
|
||||
|
||||
@@ -368,7 +368,7 @@ int sgline_view(int number, SXLine *sx, User *u, int *sent_header)
|
||||
|
||||
tm = *localtime(&sx->seton);
|
||||
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_SHORT_DATE_FORMAT, &tm);
|
||||
expire_left(u->na, expirebuf, sizeof(expirebuf), sx->expires);
|
||||
expire_left(u->nc, expirebuf, sizeof(expirebuf), sx->expires);
|
||||
notice_lang(s_OperServ, u, OPER_SGLINE_VIEW_FORMAT, number, sx->mask, sx->by, timebuf, expirebuf, sx->reason);
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -353,7 +353,7 @@ int sqline_view(int number, SXLine *sx, User *u, int *sent_header)
|
||||
|
||||
tm = *localtime(&sx->seton);
|
||||
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_SHORT_DATE_FORMAT, &tm);
|
||||
expire_left(u->na, expirebuf, sizeof(expirebuf), sx->expires);
|
||||
expire_left(u->nc, expirebuf, sizeof(expirebuf), sx->expires);
|
||||
notice_lang(s_OperServ, u, OPER_SQLINE_VIEW_FORMAT, number, sx->mask, sx->by, timebuf, expirebuf, sx->reason);
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -352,7 +352,7 @@ int szline_view(int number, SXLine *sx, User *u, int *sent_header)
|
||||
|
||||
tm = *localtime(&sx->seton);
|
||||
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_SHORT_DATE_FORMAT, &tm);
|
||||
expire_left(u->na, expirebuf, sizeof(expirebuf), sx->expires);
|
||||
expire_left(u->nc, expirebuf, sizeof(expirebuf), sx->expires);
|
||||
notice_lang(s_OperServ, u, OPER_SZLINE_VIEW_FORMAT, number, sx->mask, sx->by, timebuf, expirebuf, sx->reason);
|
||||
|
||||
return 1;
|
||||
|
||||
+7
-7
@@ -527,8 +527,8 @@ int is_host_setter(User * u)
|
||||
}
|
||||
|
||||
/* Look through all user's aliases (0000412) */
|
||||
for (i = 0; i < u->na->nc->aliases.count; i++) {
|
||||
na = static_cast<NickAlias *>(u->na->nc->aliases.list[i]);
|
||||
for (i = 0; i < u->nc->aliases.count; i++) {
|
||||
na = static_cast<NickAlias *>(u->nc->aliases.list[i]);
|
||||
for (j = 0; j < HostNumber; j++) {
|
||||
if (stricmp(HostSetters[j], na->nick) == 0) {
|
||||
return 1;
|
||||
@@ -549,10 +549,10 @@ int is_host_remover(User * u)
|
||||
*/
|
||||
void set_lastmask(User * u)
|
||||
{
|
||||
if (u->na->last_usermask)
|
||||
delete [] u->na->last_usermask;
|
||||
|
||||
u->na->last_usermask = new char[u->GetIdent().length() + u->GetDisplayedHost().length() + 2];
|
||||
sprintf(u->na->last_usermask, "%s@%s", u->GetIdent().c_str(), u->GetDisplayedHost().c_str());
|
||||
NickAlias *na = findnick(u->nick);
|
||||
if (na->last_usermask)
|
||||
delete [] na->last_usermask;
|
||||
|
||||
na->last_usermask = new char[u->GetIdent().length() + u->GetDisplayedHost().length() + 2];
|
||||
sprintf(na->last_usermask, "%s@%s", u->GetIdent().c_str(), u->GetDisplayedHost().c_str());
|
||||
}
|
||||
|
||||
+16
-3
@@ -240,7 +240,7 @@ void lang_init()
|
||||
|
||||
int strftime_lang(char *buf, int size, User * u, int format, struct tm *tm)
|
||||
{
|
||||
int language = u && u->na ? u->na->nc->language : NSDefLanguage;
|
||||
int language = u && u->nc ? u->nc->language : NSDefLanguage;
|
||||
char tmpbuf[BUFSIZE], buf2[BUFSIZE];
|
||||
char *s;
|
||||
int i, ret;
|
||||
@@ -301,7 +301,7 @@ void syntax_error(char *service, User * u, const char *command, int msgnum)
|
||||
return;
|
||||
}
|
||||
|
||||
str = getstring(u->na, msgnum);
|
||||
str = getstring(u, msgnum);
|
||||
notice_lang(service, u, SYNTAX_ERROR, str);
|
||||
notice_lang(service, u, MORE_INFO, service, command);
|
||||
}
|
||||
@@ -318,7 +318,7 @@ const char *getstring(NickAlias *na, int index)
|
||||
return langtexts[langidx][index];
|
||||
}
|
||||
|
||||
const char *getstring2(NickCore *nc, int index)
|
||||
const char *getstring(NickCore *nc, int index)
|
||||
{
|
||||
// Default to config
|
||||
int langidx = NSDefLanguage;
|
||||
@@ -331,4 +331,17 @@ const char *getstring2(NickCore *nc, int index)
|
||||
return langtexts[langidx][index];
|
||||
}
|
||||
|
||||
const char *getstring(User *u, int index)
|
||||
{
|
||||
return getstring(u->nc, index);
|
||||
}
|
||||
|
||||
const char *getstring(int index)
|
||||
{
|
||||
// Default to config
|
||||
int langidx = NSDefLanguage;
|
||||
|
||||
return langtexts[langidx][index];
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ MailInfo *MailMemoBegin(NickCore * nc)
|
||||
nc->email);
|
||||
}
|
||||
fprintf(mail->pipe, "Subject: %s\n",
|
||||
getstring2(NULL, MEMO_MAIL_SUBJECT));
|
||||
getstring(MEMO_MAIL_SUBJECT));
|
||||
return mail;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
+10
-10
@@ -65,7 +65,7 @@ void memoserv(User * u, char *buf)
|
||||
}
|
||||
ircdproto->SendCTCP(findbot(s_MemoServ), u->nick, "PING %s", s);
|
||||
} else {
|
||||
if (!u->na && stricmp(cmd, "HELP") != 0)
|
||||
if (!u->nc && stricmp(cmd, "HELP") != 0)
|
||||
notice_lang(s_MemoServ, u, NICK_NOT_REGISTERED_HELP,
|
||||
s_NickServ);
|
||||
else
|
||||
@@ -94,7 +94,7 @@ void check_memos(User * u)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(nc = (u->na ? u->na->nc : NULL)) || !nick_recognized(u) ||
|
||||
if (!(nc = u->nc) || !nick_recognized(u) ||
|
||||
!(nc->flags & NI_MEMO_SIGNON)) {
|
||||
return;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ void memo_send(User * u, const char *name, const char *text, int z)
|
||||
Memo *m;
|
||||
MemoInfo *mi;
|
||||
time_t now = time(NULL);
|
||||
char *source = u->na->nc->display;
|
||||
char *source = u->nc->display;
|
||||
int is_servoper = is_services_oper(u);
|
||||
|
||||
if (readonly) {
|
||||
@@ -289,8 +289,8 @@ void memo_send(User * u, const char *name, const char *text, int z)
|
||||
|
||||
for (i = 0; i < nc->aliases.count; i++) {
|
||||
na = static_cast<NickAlias *>(nc->aliases.list[i]);
|
||||
if (na->u && nick_identified(na->u))
|
||||
notice_lang(s_MemoServ, na->u,
|
||||
if (finduser(na->nick) && nick_identified(finduser(na->nick)))
|
||||
notice_lang(s_MemoServ, finduser(na->nick),
|
||||
MEMO_NEW_MEMO_ARRIVED, source,
|
||||
s_MemoServ, m->number);
|
||||
}
|
||||
@@ -313,8 +313,8 @@ void memo_send(User * u, const char *name, const char *text, int z)
|
||||
for (cu = c->users; cu; cu = next) {
|
||||
next = cu->next;
|
||||
if (check_access(cu->user, c->ci, CA_MEMO)) {
|
||||
if (cu->user->na
|
||||
&& (cu->user->na->nc->flags & NI_MEMO_RECEIVE)
|
||||
if (cu->user->nc
|
||||
&& (cu->user->nc->flags & NI_MEMO_RECEIVE)
|
||||
&& get_ignore(cu->user->nick) == NULL) {
|
||||
notice_lang(s_MemoServ, cu->user,
|
||||
MEMO_NEW_X_MEMO_ARRIVED,
|
||||
@@ -367,12 +367,12 @@ static void new_memo_mail(NickCore * nc, Memo * m)
|
||||
if (!mail) {
|
||||
return;
|
||||
}
|
||||
fprintf(mail->pipe, getstring2(NULL, MEMO_MAIL_TEXT1), nc->display);
|
||||
fprintf(mail->pipe, getstring(MEMO_MAIL_TEXT1), nc->display);
|
||||
fprintf(mail->pipe, "\n");
|
||||
fprintf(mail->pipe, getstring2(NULL, MEMO_MAIL_TEXT2), m->sender,
|
||||
fprintf(mail->pipe, getstring(MEMO_MAIL_TEXT2), m->sender,
|
||||
m->number);
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, "%s", getstring2(NULL, MEMO_MAIL_TEXT3));
|
||||
fprintf(mail->pipe, "%s", getstring(MEMO_MAIL_TEXT3));
|
||||
fprintf(mail->pipe, "\n\n");
|
||||
fprintf(mail->pipe, "%s", m->text);
|
||||
fprintf(mail->pipe, "\n");
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ int m_privmsg(const char *source, const char *receiver, const char *msg)
|
||||
/* Two lookups naughty, however, this won't happen often. -- w00t */
|
||||
if (findbot(receiver))
|
||||
{
|
||||
ircdproto->SendMessage(findbot(receiver), source, "%s", getstring(NULL, USER_RECORD_NOT_FOUND));
|
||||
ircdproto->SendMessage(findbot(receiver), source, "%s", getstring(USER_RECORD_NOT_FOUND));
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
+12
-12
@@ -365,13 +365,13 @@ int dotime(const char *s)
|
||||
* @param seconds time in seconds
|
||||
* @return buffer
|
||||
*/
|
||||
char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
|
||||
const char *duration(NickCore *nc, char *buf, int bufsize, time_t seconds)
|
||||
{
|
||||
int days = 0, hours = 0, minutes = 0;
|
||||
int need_comma = 0;
|
||||
|
||||
char buf2[64], *end;
|
||||
const char *comma = getstring(na, COMMA_SPACE);
|
||||
const char *comma = getstring(nc, COMMA_SPACE);
|
||||
|
||||
/* We first calculate everything */
|
||||
days = seconds / 86400;
|
||||
@@ -382,7 +382,7 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
|
||||
|
||||
if (!days && !hours && !minutes) {
|
||||
snprintf(buf, bufsize,
|
||||
getstring(na,
|
||||
getstring(nc,
|
||||
(seconds <=
|
||||
1 ? DURATION_SECOND : DURATION_SECONDS)),
|
||||
seconds);
|
||||
@@ -390,7 +390,7 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
|
||||
end = buf;
|
||||
if (days) {
|
||||
snprintf(buf2, sizeof(buf2),
|
||||
getstring(na,
|
||||
getstring(nc,
|
||||
(days == 1 ? DURATION_DAY : DURATION_DAYS)),
|
||||
days);
|
||||
end += snprintf(end, bufsize - (end - buf), "%s", buf2);
|
||||
@@ -398,7 +398,7 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
|
||||
}
|
||||
if (hours) {
|
||||
snprintf(buf2, sizeof(buf2),
|
||||
getstring(na,
|
||||
getstring(nc,
|
||||
(hours ==
|
||||
1 ? DURATION_HOUR : DURATION_HOURS)),
|
||||
hours);
|
||||
@@ -409,7 +409,7 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
|
||||
}
|
||||
if (minutes) {
|
||||
snprintf(buf2, sizeof(buf2),
|
||||
getstring(na,
|
||||
getstring(nc,
|
||||
(minutes ==
|
||||
1 ? DURATION_MINUTE : DURATION_MINUTES)),
|
||||
minutes);
|
||||
@@ -433,27 +433,27 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
|
||||
* @param seconds time in seconds
|
||||
* @return buffer
|
||||
*/
|
||||
char *expire_left(NickAlias * na, char *buf, int len, time_t expires)
|
||||
const char *expire_left(NickCore *nc, char *buf, int len, time_t expires)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
|
||||
if (!expires) {
|
||||
strncpy(buf, getstring(na, NO_EXPIRE), len);
|
||||
strncpy(buf, getstring(nc, NO_EXPIRE), len);
|
||||
} else if (expires <= now) {
|
||||
strncpy(buf, getstring(na, EXPIRES_SOON), len);
|
||||
strncpy(buf, getstring(nc, EXPIRES_SOON), len);
|
||||
} else {
|
||||
time_t diff = expires - now + 59;
|
||||
|
||||
if (diff >= 86400) {
|
||||
int days = diff / 86400;
|
||||
snprintf(buf, len,
|
||||
getstring(na, (days == 1) ? EXPIRES_1D : EXPIRES_D),
|
||||
getstring(nc, (days == 1) ? EXPIRES_1D : EXPIRES_D),
|
||||
days);
|
||||
} else {
|
||||
if (diff <= 3600) {
|
||||
int minutes = diff / 60;
|
||||
snprintf(buf, len,
|
||||
getstring(na,
|
||||
getstring(nc,
|
||||
(minutes ==
|
||||
1) ? EXPIRES_1M : EXPIRES_M), minutes);
|
||||
} else {
|
||||
@@ -461,7 +461,7 @@ char *expire_left(NickAlias * na, char *buf, int len, time_t expires)
|
||||
diff -= (hours * 3600);
|
||||
minutes = diff / 60;
|
||||
snprintf(buf, len,
|
||||
getstring(na,
|
||||
getstring(nc,
|
||||
((hours == 1
|
||||
&& minutes ==
|
||||
1) ? EXPIRES_1H1M : ((hours == 1
|
||||
|
||||
+6
-5
@@ -1044,12 +1044,13 @@ void Module::NoticeLang(char *source, User * u, int number, ...)
|
||||
char *s, *t, *buf;
|
||||
|
||||
/* Find the users lang, and use it if we can */
|
||||
if (u && u->na && u->na->nc) {
|
||||
mlang = u->na->nc->language;
|
||||
if (u && u->nc) {
|
||||
mlang = u->nc->language;
|
||||
}
|
||||
|
||||
/* If the users lang isnt supported, drop back to English */
|
||||
if (this->lang[mlang].argc == 0) {
|
||||
if (this->lang[mlang].argc == 0)
|
||||
{
|
||||
mlang = LANG_EN_US;
|
||||
}
|
||||
|
||||
@@ -1081,8 +1082,8 @@ const char *Module::GetLangString(User * u, int number)
|
||||
int mlang = NSDefLanguage;
|
||||
|
||||
/* Find the users lang, and use it if we can */
|
||||
if (u && u->na && u->na->nc)
|
||||
mlang = u->na->nc->language;
|
||||
if (u && u->nc)
|
||||
mlang = u->nc->language;
|
||||
|
||||
/* If the users lang isnt supported, drop back to English */
|
||||
if (this->lang[mlang].argc == 0)
|
||||
|
||||
@@ -116,7 +116,7 @@ class CommandCSEnforce : public Command
|
||||
if (check_access(u, c->ci, CA_NOJOIN))
|
||||
{
|
||||
get_idealban(ci, u, mask, sizeof(mask));
|
||||
reason = getstring(u->na, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
reason = getstring(u, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
ircdproto->SendMode(whosends(ci), ci->name, "+b %s %lu", mask, time(NULL));
|
||||
ircdproto->SendKick(whosends(ci), ci->name, u->nick, "%s", reason);
|
||||
av[0] = ci->name;
|
||||
@@ -155,7 +155,7 @@ class CommandCSEnforce : public Command
|
||||
if (!nick_identified(u))
|
||||
{
|
||||
get_idealban(ci, u, mask, sizeof(mask));
|
||||
reason = getstring(u->na, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
reason = getstring(u, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
if (!(cbm = &cbmodes[static_cast<int>('R')])->flag || !(c->mode & cbm->flag))
|
||||
ircdproto->SendMode(whosends(ci), ci->name, "+b %s %lu", mask, time(NULL));
|
||||
ircdproto->SendKick(whosends(ci), ci->name, u->nick, "%s", reason);
|
||||
|
||||
@@ -345,7 +345,7 @@ class HSListBase : public Command
|
||||
{
|
||||
++display_counter;
|
||||
tm = localtime(¤t->time);
|
||||
strftime(buf, sizeof(buf), getstring(NULL, STRFTIME_DATE_TIME_FORMAT), tm);
|
||||
strftime(buf, sizeof(buf), getstring(u, STRFTIME_DATE_TIME_FORMAT), tm);
|
||||
if (current->vIdent)
|
||||
notice_lang(s_HostServ, u, HOST_IDENT_ENTRY, counter, current->nick, current->vIdent, current->vHost, current->creator, buf);
|
||||
else
|
||||
@@ -751,8 +751,8 @@ void my_memo_lang(User *u, char *name, int z, int number, ...)
|
||||
|
||||
u2 = finduser(name);
|
||||
/* Find the users lang, and use it if we cant */
|
||||
if (u2 && u2->na && u2->na->nc)
|
||||
lang = u2->na->nc->language;
|
||||
if (u2 && u2->nc)
|
||||
lang = u2->nc->language;
|
||||
|
||||
/* If the users lang isnt supported, drop back to enlgish */
|
||||
if (!me->lang[lang].argc)
|
||||
|
||||
@@ -161,7 +161,7 @@ int count_email_in_use(const char *email, User * u)
|
||||
{
|
||||
for (nc = nclists[i]; nc; nc = nc->next)
|
||||
{
|
||||
if (!(u->na && u->na->nc && u->na->nc == nc) && nc->email && !stricmp(nc->email, email))
|
||||
if (!(u->nc && u->nc == nc) && nc->email && !stricmp(nc->email, email))
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
+17
-120
@@ -542,7 +542,7 @@ int validate_user(User * u)
|
||||
notice_lang(s_NickServ, u, NICK_IS_PREREG);
|
||||
}
|
||||
|
||||
if (!(na = u->na))
|
||||
if (!(na = findnick(u->nick)))
|
||||
return 0;
|
||||
|
||||
if (na->status & NS_FORBIDDEN)
|
||||
@@ -615,7 +615,7 @@ int validate_user(User * u)
|
||||
|
||||
void cancel_user(User * u)
|
||||
{
|
||||
NickAlias *na = u->na;
|
||||
NickAlias *na = findnick(u->nick);
|
||||
|
||||
if (na)
|
||||
{
|
||||
@@ -652,24 +652,11 @@ void cancel_user(User * u)
|
||||
|
||||
int nick_identified(User * u)
|
||||
{
|
||||
if (u)
|
||||
if (u->nc)
|
||||
{
|
||||
if (u->na)
|
||||
{
|
||||
if (u->na->status)
|
||||
{
|
||||
return (u->na->status & NS_IDENTIFIED);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -681,11 +668,12 @@ int nick_recognized(User * u)
|
||||
{
|
||||
if (u)
|
||||
{
|
||||
if (u->na)
|
||||
NickAlias *na = findnick(u->nick);
|
||||
if (na)
|
||||
{
|
||||
if (u->na->status)
|
||||
if (na->status)
|
||||
{
|
||||
return (u->na->status & (NS_IDENTIFIED | NS_RECOGNIZED));
|
||||
return (na->status & (NS_IDENTIFIED | NS_RECOGNIZED));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -702,15 +690,6 @@ int nick_recognized(User * u)
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/* Returns whether a user is identified AND in the group nc */
|
||||
|
||||
int group_identified(User * u, NickCore * nc)
|
||||
{
|
||||
return nick_identified(u) && u->na->nc == nc;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/* Remove all nicks which have expired. Also update last-seen time for all
|
||||
* nicks.
|
||||
*/
|
||||
@@ -728,9 +707,9 @@ void expire_nicks()
|
||||
{
|
||||
next = na->next;
|
||||
|
||||
if (na->u
|
||||
&& ((na->nc->flags & NI_SECURE) ? nick_identified(na->u) :
|
||||
nick_recognized(na->u)))
|
||||
User *u = finduser(na->nick);
|
||||
if (u
|
||||
&& ((na->nc->flags & NI_SECURE) ? nick_identified(u) : nick_recognized(u)))
|
||||
{
|
||||
if (debug >= 2)
|
||||
alog("debug: NickServ: updating last seen time for %s",
|
||||
@@ -1132,15 +1111,10 @@ int delnick(NickAlias * na)
|
||||
|
||||
/* Second thing to do: look for an user using the alias
|
||||
* being deleted, and make appropriate changes */
|
||||
|
||||
if (na->u)
|
||||
if (finduser(na->nick))
|
||||
{
|
||||
u = na->u;
|
||||
na->u->na = NULL;
|
||||
|
||||
if (ircd->modeonunreg)
|
||||
common_svsmode(na->u, ircd->modeonunreg, "1");
|
||||
|
||||
common_svsmode(finduser(na->nick), ircd->modeonunreg, "1");
|
||||
}
|
||||
|
||||
delHostCore(na->nick); /* delete any vHost's for this nick */
|
||||
@@ -1221,8 +1195,7 @@ void collide(NickAlias * na, int from_timeout)
|
||||
NSGuestNickPrefix, getrandom16());
|
||||
}
|
||||
while (finduser(guestnick));
|
||||
notice_lang(s_NickServ, na->u, FORCENICKCHANGE_CHANGING,
|
||||
guestnick);
|
||||
notice_lang(s_NickServ, finduser(na->nick), FORCENICKCHANGE_CHANGING, guestnick);
|
||||
ircdproto->SendForceNickChange(na->nick, guestnick, time(NULL));
|
||||
na->status |= NS_GUESTED;
|
||||
}
|
||||
@@ -1302,8 +1275,8 @@ static void timeout_collide(Timeout * t)
|
||||
|
||||
rem_ns_timeout(na, TO_COLLIDE);
|
||||
/* If they identified or don't exist anymore, don't kill them. */
|
||||
if ((na->status & NS_IDENTIFIED) || !na->u
|
||||
|| na->u->my_signon > t->settime)
|
||||
if ((na->status & NS_IDENTIFIED) || !finduser(na->nick)
|
||||
|| finduser(na->nick)->my_signon > t->settime)
|
||||
return;
|
||||
/* The RELEASE timeout will always add to the beginning of the
|
||||
* list, so we won't see it. Which is fine because it can't be
|
||||
@@ -1507,79 +1480,3 @@ int do_setmodes(User * u)
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/*
|
||||
* Nick tracking
|
||||
*/
|
||||
|
||||
/**
|
||||
* Start Nick tracking and store the nick core display under the user struct.
|
||||
* @param u The user to track nicks for
|
||||
**/
|
||||
void nsStartNickTracking(User * u)
|
||||
{
|
||||
NickCore *nc;
|
||||
|
||||
/* We only track identified users */
|
||||
if (nick_identified(u))
|
||||
{
|
||||
nc = u->na->nc;
|
||||
|
||||
/* Release memory if needed */
|
||||
if (u->nickTrack)
|
||||
delete [] u->nickTrack;
|
||||
|
||||
/* Copy the nick core displayed nick to
|
||||
the user structure for further checks */
|
||||
u->nickTrack = sstrdup(nc->display);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop Nick tracking and remove the nick core display under the user struct.
|
||||
* @param u The user to stop tracking for
|
||||
**/
|
||||
void nsStopNickTracking(User * u)
|
||||
{
|
||||
/* Simple enough. If its there, release it */
|
||||
if (u->nickTrack)
|
||||
{
|
||||
delete [] u->nickTrack;
|
||||
u->nickTrack = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Boolean function to check if the user requesting a nick has the tracking
|
||||
* signature of that core in its structure.
|
||||
* @param u The user whom to check tracking for
|
||||
**/
|
||||
int nsCheckNickTracking(User * u)
|
||||
{
|
||||
NickCore *nc;
|
||||
NickAlias *na;
|
||||
char *nick;
|
||||
|
||||
/* No nick alias or nick return false by default */
|
||||
if ((!(na = u->na)) || (!(nick = na->nick)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* nick is forbidden best return 0 */
|
||||
if (na->status & NS_FORBIDDEN)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get the core for the requested nick */
|
||||
nc = na->nc;
|
||||
|
||||
/* If the core and the tracking displayed nick are there,
|
||||
* and they match, return true
|
||||
*/
|
||||
if (nc && u->nickTrack && (strcmp(nc->display, u->nickTrack) == 0))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
+5
-5
@@ -352,7 +352,7 @@ int is_services_root(User * u)
|
||||
if ((NSStrictPrivileges && !is_oper(u))
|
||||
|| (!nick_identified(u)))
|
||||
return 0;
|
||||
if ((u->na->nc->flags & NI_SERVICES_ROOT))
|
||||
if ((u->nc->flags & NI_SERVICES_ROOT))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ int is_services_admin(User * u)
|
||||
if ((NSStrictPrivileges && !is_oper(u))
|
||||
|| (!nick_identified(u)))
|
||||
return 0;
|
||||
if ((u->na->nc->flags & (NI_SERVICES_ADMIN | NI_SERVICES_ROOT)))
|
||||
if ((u->nc->flags & (NI_SERVICES_ADMIN | NI_SERVICES_ROOT)))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ int is_services_oper(User * u)
|
||||
if ((NSStrictPrivileges && !is_oper(u))
|
||||
|| (!nick_identified(u)))
|
||||
return 0;
|
||||
if ((u->na->nc->
|
||||
if ((u->nc->
|
||||
flags & (NI_SERVICES_OPER | NI_SERVICES_ADMIN |
|
||||
NI_SERVICES_ROOT)))
|
||||
return 1;
|
||||
@@ -1355,13 +1355,13 @@ void resetDefCon(int level)
|
||||
send_event(EVENT_DEFCON_LEVEL, 1, strLevel);
|
||||
alog("Defcon level timeout, returning to lvl %d", level);
|
||||
ircdproto->SendGlobops(s_OperServ,
|
||||
getstring2(NULL, OPER_DEFCON_WALL),
|
||||
getstring(OPER_DEFCON_WALL),
|
||||
s_OperServ, level);
|
||||
if (GlobalOnDefcon) {
|
||||
if (DefConOffMessage) {
|
||||
oper_global(NULL, "%s", DefConOffMessage);
|
||||
} else {
|
||||
oper_global(NULL, getstring(NULL, DEFCON_GLOBAL),
|
||||
oper_global(NULL, getstring(DEFCON_GLOBAL),
|
||||
DefConLevel);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-16
@@ -494,7 +494,6 @@ class BahamutIRCdProto : public IRCDProto
|
||||
}
|
||||
--ac;
|
||||
++av;
|
||||
user->svid = strtoul(*av, NULL, 0);
|
||||
break;
|
||||
case 'o':
|
||||
if (add) {
|
||||
@@ -684,13 +683,6 @@ class BahamutIRCdProto : public IRCDProto
|
||||
SendSQLine(nick, "Reserved for services");
|
||||
}
|
||||
|
||||
/* SVSMODE +d */
|
||||
/* sent if svid is something weird */
|
||||
void SendSVID(const char *nick, time_t ts)
|
||||
{
|
||||
send_cmd(ServerName, "SVSMODE %s %lu +d 1", nick, static_cast<unsigned long>(ts));
|
||||
}
|
||||
|
||||
/* SVSMODE +d */
|
||||
/* nc_change was = 1, and there is no na->status */
|
||||
void SendUnregisteredNick(User *u)
|
||||
@@ -698,12 +690,6 @@ class BahamutIRCdProto : public IRCDProto
|
||||
common_svsmode(u, "+d", "1");
|
||||
}
|
||||
|
||||
void SendSVID3(User *u, const char *ts)
|
||||
{
|
||||
if (u->svid != u->timestamp) common_svsmode(u, "+rd", ts);
|
||||
else common_svsmode(u, "+r", NULL);
|
||||
}
|
||||
|
||||
int IsFloodModeParamValid(const char *value)
|
||||
{
|
||||
char *dp, *end;
|
||||
@@ -761,13 +747,13 @@ int anope_event_nick(const char *source, int ac, const char **av)
|
||||
if (ac != 2) {
|
||||
user = do_nick(source, av[0], av[4], av[5], av[6], av[9],
|
||||
strtoul(av[2], NULL, 10), strtoul(av[7], NULL, 0),
|
||||
strtoul(av[8], NULL, 0), NULL, NULL);
|
||||
NULL, NULL);
|
||||
if (user) {
|
||||
ircdproto->ProcessUsermodes(user, 1, &av[3]);
|
||||
}
|
||||
} else {
|
||||
do_nick(source, av[0], NULL, NULL, NULL, NULL,
|
||||
strtoul(av[1], NULL, 10), 0, 0, NULL, NULL);
|
||||
strtoul(av[1], NULL, 10), 0, NULL, NULL);
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -471,7 +471,6 @@ class InspIRCdProto : public IRCDProto
|
||||
else --opcnt;
|
||||
break;
|
||||
case 'r':
|
||||
user->svid = add ? user->timestamp : 0;
|
||||
if (add && !nick_identified(user)) {
|
||||
common_svsmode(user, "-r", NULL);
|
||||
user->mode &= ~UMODE_r;
|
||||
@@ -656,12 +655,6 @@ class InspIRCdProto : public IRCDProto
|
||||
common_svsmode(u, "-r", NULL);
|
||||
}
|
||||
|
||||
/* SVSMODE +r */
|
||||
void SendSVID2(User *u, const char *ts)
|
||||
{
|
||||
common_svsmode(u, "+r", NULL);
|
||||
}
|
||||
|
||||
void SendSVSJoin(const char *source, const char *nick, const char *chan, const char *param)
|
||||
{
|
||||
send_cmd(source, "SVSJOIN %s %s", nick, chan);
|
||||
@@ -1075,27 +1068,22 @@ int anope_event_nick(const char *source, int ac, const char **av)
|
||||
|
||||
if (ac != 1) {
|
||||
if (ac == 8) {
|
||||
int svid = 0;
|
||||
int ts = strtoul(av[0], NULL, 10);
|
||||
|
||||
if (strchr(av[5], 'r') != NULL)
|
||||
svid = ts;
|
||||
|
||||
inet_aton(av[6], &addy);
|
||||
user = do_nick("", av[1], /* nick */
|
||||
av[4], /* username */
|
||||
av[2], /* realhost */
|
||||
source, /* server */
|
||||
av[7], /* realname */
|
||||
ts, svid, htonl(*ad), av[3], NULL);
|
||||
ts, htonl(*ad), av[3], NULL);
|
||||
if (user) {
|
||||
ircdproto->ProcessUsermodes(user, 1, &av[5]);
|
||||
user->chost = av[3];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
do_nick(source, av[0], NULL, NULL, NULL, NULL, 0, 0, 0, NULL,
|
||||
NULL);
|
||||
do_nick(source, av[0], NULL, NULL, NULL, NULL, 0, 0, NULL, NULL);
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -469,7 +469,6 @@ class InspIRCdProto : public IRCDProto
|
||||
else --opcnt;
|
||||
break;
|
||||
case 'r':
|
||||
user->svid = add ? user->timestamp : 0;
|
||||
if (add && !nick_identified(user)) {
|
||||
common_svsmode(user, "-r", NULL);
|
||||
user->mode &= ~UMODE_r;
|
||||
@@ -657,12 +656,6 @@ class InspIRCdProto : public IRCDProto
|
||||
common_svsmode(u, "-r", NULL);
|
||||
}
|
||||
|
||||
/* SVSMODE +r */
|
||||
void SendSVID2(User *u, const char *ts)
|
||||
{
|
||||
common_svsmode(u, "+r", NULL);
|
||||
}
|
||||
|
||||
void SendSVSJoin(const char *source, const char *nick, const char *chan, const char *param)
|
||||
{
|
||||
User *u = finduser(nick);
|
||||
@@ -1101,7 +1094,7 @@ int anope_event_sethost(const char *source, int ac, const char **av)
|
||||
|
||||
int anope_event_nick(const char *source, int ac, const char **av)
|
||||
{
|
||||
do_nick(source, av[0], NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
|
||||
do_nick(source, av[0], NULL, NULL, NULL, NULL, 0, 0, NULL, NULL);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -1126,19 +1119,15 @@ int anope_event_uid(const char *source, int ac, const char **av)
|
||||
struct in_addr addy;
|
||||
Server *s = findserver_uid(servlist, source);
|
||||
uint32 *ad = reinterpret_cast<uint32 *>(&addy);
|
||||
int svid = 0;
|
||||
int ts = strtoul(av[1], NULL, 10);
|
||||
|
||||
if (strchr(av[8], 'r') != NULL)
|
||||
svid = ts;
|
||||
|
||||
inet_aton(av[6], &addy);
|
||||
user = do_nick("", av[2], /* nick */
|
||||
av[5], /* username */
|
||||
av[3], /* realhost */
|
||||
s->name, /* server */
|
||||
av[ac - 1], /* realname */
|
||||
ts, svid, htonl(*ad), av[4], av[0]);
|
||||
ts, htonl(*ad), av[4], av[0]);
|
||||
if (user)
|
||||
{
|
||||
ircdproto->ProcessUsermodes(user, 1, &av[8]);
|
||||
|
||||
@@ -725,7 +725,7 @@ int anope_event_nick(const char *source, int ac, const char **av)
|
||||
s = findserver_uid(servlist, source);
|
||||
/* Source is always the server */
|
||||
user = do_nick("", av[0], av[4], av[5], s->name, av[8],
|
||||
strtoul(av[2], NULL, 10), 0, 0, "*", av[7]);
|
||||
strtoul(av[2], NULL, 10), 0, "*", av[7]);
|
||||
if (user)
|
||||
{
|
||||
ircdproto->ProcessUsermodes(user, 1, &av[3]);
|
||||
@@ -734,7 +734,7 @@ int anope_event_nick(const char *source, int ac, const char **av)
|
||||
if (ac == 2)
|
||||
{
|
||||
do_nick(source, av[0], NULL, NULL, NULL, NULL,
|
||||
strtoul(av[1], NULL, 10), 0, 0, NULL, NULL);
|
||||
strtoul(av[1], NULL, 10), 0, NULL, NULL);
|
||||
}
|
||||
}
|
||||
return MOD_CONT;
|
||||
|
||||
+6
-32
@@ -562,7 +562,7 @@ class UnrealIRCdProto : public IRCDProto
|
||||
break;
|
||||
if (isdigit(*av[1]))
|
||||
{
|
||||
user->svid = strtoul(av[1], NULL, 0);
|
||||
//user->svid = strtoul(av[1], NULL, 0);
|
||||
user->mode = backup; /* Ugly fix, but should do the job ~ Viper */
|
||||
continue; // +d was setting a service stamp, ignore the usermode +-d.
|
||||
}
|
||||
@@ -818,29 +818,6 @@ class UnrealIRCdProto : public IRCDProto
|
||||
else send_cmd(ServerName, "n %s %s", name, mode);
|
||||
}
|
||||
|
||||
|
||||
/* SVSMODE +d */
|
||||
/* sent if svid is something weird */
|
||||
void SendSVID(const char *nick, time_t ts)
|
||||
{
|
||||
send_cmd(ServerName, "v %s +d 1", nick);
|
||||
}
|
||||
|
||||
/* SVSMODE +d */
|
||||
/* nc_change was = 1, and there is no na->status */
|
||||
void SendUnregisteredNick(User *u)
|
||||
{
|
||||
common_svsmode(u, "-r+d", "1");
|
||||
}
|
||||
|
||||
/* SVSMODE +r */
|
||||
void SendSVID2(User *u, const char *ts)
|
||||
{
|
||||
if (u->svid != u->timestamp) common_svsmode(u, "+rd", ts);
|
||||
else common_svsmode(u, "+r", NULL);
|
||||
}
|
||||
|
||||
|
||||
/* svsjoin
|
||||
parv[0] - sender
|
||||
parv[1] - nick to make join
|
||||
@@ -1223,7 +1200,7 @@ int anope_event_sethost(const char *source, int ac, const char **av)
|
||||
*/
|
||||
/*
|
||||
do_nick(const char *source, char *nick, char *username, char *host,
|
||||
char *server, char *realname, time_t ts, uint32 svid,
|
||||
char *server, char *realname, time_t ts,
|
||||
uint32 ip, char *vhost, char *uid)
|
||||
*/
|
||||
int anope_event_nick(const char *source, int ac, const char **av)
|
||||
@@ -1239,28 +1216,25 @@ int anope_event_nick(const char *source, int ac, const char **av)
|
||||
- so we have to leave it around for now -TSL
|
||||
*/
|
||||
do_nick(source, av[0], av[3], av[4], av[5], av[6],
|
||||
strtoul(av[2], NULL, 10), 0, 0, "*", NULL);
|
||||
strtoul(av[2], NULL, 10), 0, "*", NULL);
|
||||
|
||||
} else if (ac == 11) {
|
||||
user = do_nick(source, av[0], av[3], av[4], av[5], av[10],
|
||||
strtoul(av[2], NULL, 10), strtoul(av[6], NULL,
|
||||
0),
|
||||
ntohl(decode_ip(av[9])), av[8], NULL);
|
||||
strtoul(av[2], NULL, 10), ntohl(decode_ip(av[9])), av[8], NULL);
|
||||
if (user)
|
||||
ircdproto->ProcessUsermodes(user, 1, &av[7]);
|
||||
|
||||
} else {
|
||||
/* NON NICKIP */
|
||||
user = do_nick(source, av[0], av[3], av[4], av[5], av[9],
|
||||
strtoul(av[2], NULL, 10), strtoul(av[6], NULL,
|
||||
0), 0, av[8],
|
||||
strtoul(av[2], NULL, 10), 0, av[8],
|
||||
NULL);
|
||||
if (user)
|
||||
ircdproto->ProcessUsermodes(user, 1, &av[7]);
|
||||
}
|
||||
} else {
|
||||
do_nick(source, av[0], NULL, NULL, NULL, NULL,
|
||||
strtoul(av[1], NULL, 10), 0, 0, NULL, NULL);
|
||||
strtoul(av[1], NULL, 10), 0, NULL, NULL);
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
+2
-2
@@ -180,7 +180,7 @@ void notice_lang(const char *source, User * dest, int message, ...)
|
||||
return;
|
||||
}
|
||||
va_start(args, message);
|
||||
fmt = getstring(dest->na, message);
|
||||
fmt = getstring(dest, message);
|
||||
|
||||
if (!fmt)
|
||||
return;
|
||||
@@ -221,7 +221,7 @@ void notice_help(const char *source, User * dest, int message, ...)
|
||||
return;
|
||||
}
|
||||
va_start(args, message);
|
||||
fmt = getstring(dest->na, message);
|
||||
fmt = getstring(dest, message);
|
||||
if (!fmt)
|
||||
return;
|
||||
/* Some sprintf()'s eat %S or turn it into just S, so change all %S's
|
||||
|
||||
+4
-2
@@ -204,8 +204,9 @@ static void delete_server(Server * serv, const char *quitreason)
|
||||
u = firstuser();
|
||||
while (u) {
|
||||
unext = nextuser();
|
||||
if (u->server == serv) {
|
||||
if ((na = u->na) && !(na->status & NS_FORBIDDEN)
|
||||
if (u->server == serv)
|
||||
{
|
||||
if ((na = findnick(u->nick)) && !(na->status & NS_FORBIDDEN)
|
||||
&& (!(na->nc->flags & NI_SUSPENDED))
|
||||
&& (na->status & (NS_IDENTIFIED | NS_RECOGNIZED))) {
|
||||
na->last_seen = time(NULL);
|
||||
@@ -214,6 +215,7 @@ static void delete_server(Server * serv, const char *quitreason)
|
||||
na->last_quit =
|
||||
(quitreason ? sstrdup(quitreason) : NULL);
|
||||
}
|
||||
|
||||
if (LimitSessions) {
|
||||
del_session(u->host);
|
||||
}
|
||||
|
||||
+59
-110
@@ -38,13 +38,12 @@ User::User(const std::string &snick, const std::string &suid)
|
||||
/* we used to do this by calloc, no more. */
|
||||
this->next = NULL;
|
||||
this->prev = NULL;
|
||||
host = hostip = vhost = realname = nickTrack = NULL;
|
||||
host = hostip = vhost = realname = NULL;
|
||||
server = NULL;
|
||||
na = NULL;
|
||||
nc = NULL;
|
||||
chans = NULL;
|
||||
founder_chans = NULL;
|
||||
invalid_pw_count = timestamp = my_signon = svid = mode = invalid_pw_time = lastmemosend = lastnickreg = lastmail = 0;
|
||||
invalid_pw_count = timestamp = my_signon = mode = invalid_pw_time = lastmemosend = lastnickreg = lastmail = 0;
|
||||
|
||||
strscpy(this->nick, snick.c_str(), NICKMAX);
|
||||
this->uid = suid;
|
||||
@@ -56,12 +55,7 @@ User::User(const std::string &snick, const std::string &suid)
|
||||
|
||||
*list = this;
|
||||
|
||||
this->na = findnick(snick);
|
||||
|
||||
if (this->na) {
|
||||
this->na->u = this;
|
||||
this->nc = this->na->nc;
|
||||
}
|
||||
this->nc = NULL;
|
||||
|
||||
usercnt++;
|
||||
|
||||
@@ -74,13 +68,11 @@ User::User(const std::string &snick, const std::string &suid)
|
||||
}
|
||||
|
||||
this->isSuperAdmin = 0; /* always set SuperAdmin to 0 for new users */
|
||||
this->nickTrack = NULL; /* ensure no default tracking nick */
|
||||
}
|
||||
|
||||
void User::SetNewNick(const std::string &newnick)
|
||||
{
|
||||
User **list;
|
||||
int is_same;
|
||||
|
||||
/* Sanity check to make sure we don't segfault */
|
||||
if (newnick.empty())
|
||||
@@ -91,8 +83,6 @@ void User::SetNewNick(const std::string &newnick)
|
||||
if (debug)
|
||||
alog("debug: %s changed nick to %s", this->nick, newnick.c_str());
|
||||
|
||||
is_same = (!stricmp(this->nick, newnick.c_str()) ? 1 : 0);
|
||||
|
||||
if (this->prev)
|
||||
this->prev->next = this->next;
|
||||
else
|
||||
@@ -109,19 +99,6 @@ void User::SetNewNick(const std::string &newnick)
|
||||
if (*list)
|
||||
(*list)->prev = this;
|
||||
*list = this;
|
||||
|
||||
/* Only if old and new nick aren't the same; no need to waste time */
|
||||
if (!is_same)
|
||||
{
|
||||
if (this->na)
|
||||
this->na->u = NULL;
|
||||
this->na = findnick(this->nick);
|
||||
if (this->na) {
|
||||
this->na->u = this;
|
||||
this->nc = this->na->nc;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void User::SetDisplayedHost(const std::string &shost)
|
||||
@@ -209,13 +186,14 @@ void User::SetRealname(const std::string &srealname)
|
||||
if (this->realname)
|
||||
delete [] this->realname;
|
||||
this->realname = sstrdup(srealname.c_str());
|
||||
NickAlias *na = findnick(this->nick);
|
||||
|
||||
if (this->na && (nick_identified(this) ||
|
||||
(!(this->na->nc->flags & NI_SECURE) && nick_recognized(this))))
|
||||
if (na && (nick_identified(this) ||
|
||||
(!(this->nc->flags & NI_SECURE) && nick_recognized(this))))
|
||||
{
|
||||
if (this->na->last_realname)
|
||||
delete [] this->na->last_realname;
|
||||
this->na->last_realname = sstrdup(srealname.c_str());
|
||||
if (na->last_realname)
|
||||
delete [] na->last_realname;
|
||||
na->last_realname = sstrdup(srealname.c_str());
|
||||
}
|
||||
|
||||
if (debug)
|
||||
@@ -287,9 +265,6 @@ User::~User()
|
||||
/* Cancel pending nickname enforcers, etc */
|
||||
cancel_user(this);
|
||||
|
||||
if (this->na)
|
||||
this->na->u = NULL;
|
||||
|
||||
if (debug >= 2)
|
||||
alog("debug: User::~User(): free founder data");
|
||||
ci = this->founder_chans;
|
||||
@@ -300,9 +275,6 @@ User::~User()
|
||||
ci = ci2;
|
||||
}
|
||||
|
||||
if (this->nickTrack)
|
||||
delete [] this->nickTrack;
|
||||
|
||||
if (debug >= 2)
|
||||
alog("debug: User::~User(): delete from list");
|
||||
|
||||
@@ -343,7 +315,7 @@ void User::SendMessage(const char *source, const std::string &msg)
|
||||
* - The user is registered and has set /ns set msg on
|
||||
*/
|
||||
if (UsePrivmsg &&
|
||||
((!this->na && NSDefFlags & NI_MSG) || (this->na && this->na->nc->flags & NI_MSG)))
|
||||
((!this->nc && NSDefFlags & NI_MSG) || (this->nc && this->nc->flags & NI_MSG)))
|
||||
{
|
||||
ircdproto->SendPrivmsg(findbot(source), this->nick, "%s", msg.c_str());
|
||||
}
|
||||
@@ -363,14 +335,16 @@ void User::SendMessage(const char *source, const std::string &msg)
|
||||
*/
|
||||
void update_host(User * user)
|
||||
{
|
||||
if (user->na && (nick_identified(user)
|
||||
|| (!(user->na->nc->flags & NI_SECURE)
|
||||
&& nick_recognized(user)))) {
|
||||
if (user->na->last_usermask)
|
||||
delete [] user->na->last_usermask;
|
||||
NickCore *nc = findcore(user->nick);
|
||||
if (nick_identified(user) || (nc && !(nc->flags & NI_SECURE) && nick_recognized(user)))
|
||||
{
|
||||
NickAlias *na = findnick(user->nick);
|
||||
|
||||
user->na->last_usermask = new char[user->GetIdent().length() + user->GetDisplayedHost().length() + 2];
|
||||
sprintf(user->na->last_usermask, "%s@%s", user->GetIdent().c_str(),
|
||||
if (na->last_usermask)
|
||||
delete [] na->last_usermask;
|
||||
|
||||
na->last_usermask = new char[user->GetIdent().length() + user->GetDisplayedHost().length() + 2];
|
||||
sprintf(na->last_usermask, "%s@%s", user->GetIdent().c_str(),
|
||||
user->GetDisplayedHost().c_str());
|
||||
}
|
||||
}
|
||||
@@ -524,7 +498,7 @@ User *next_uid()
|
||||
/* Handle a server NICK command. */
|
||||
|
||||
User *do_nick(const char *source, const char *nick, const char *username, const char *host,
|
||||
const char *server, const char *realname, time_t ts, uint32 svid,
|
||||
const char *server, const char *realname, time_t ts,
|
||||
uint32 ip, const char *vhost, const char *uid)
|
||||
{
|
||||
User *user = NULL;
|
||||
@@ -658,33 +632,9 @@ User *do_nick(const char *source, const char *nick, const char *username, const
|
||||
user->hostip = NULL;
|
||||
}
|
||||
|
||||
if (svid == 0) {
|
||||
display_news(user, NEWS_LOGON);
|
||||
display_news(user, NEWS_RANDOM);
|
||||
}
|
||||
|
||||
if (svid == ts && user->na) {
|
||||
/* Timestamp and svid match, and nick is registered; automagically identify the nick */
|
||||
user->svid = svid;
|
||||
user->na->status |= NS_IDENTIFIED;
|
||||
check_memos(user);
|
||||
nc_changed = 0;
|
||||
|
||||
/* Start nick tracking if available */
|
||||
if (NSNickTracking)
|
||||
nsStartNickTracking(user);
|
||||
|
||||
} else if (svid != 1) {
|
||||
/* Resets the svid because it doesn't match */
|
||||
user->svid = 1;
|
||||
|
||||
ircdproto->SendSVID(user->nick, user->timestamp);
|
||||
|
||||
} else {
|
||||
user->svid = 1;
|
||||
}
|
||||
display_news(user, NEWS_LOGON);
|
||||
display_news(user, NEWS_RANDOM);
|
||||
send_event(EVENT_NEWNICK, 1, nick);
|
||||
|
||||
} else {
|
||||
/* An old user changing nicks. */
|
||||
if (ircd->ts6)
|
||||
@@ -725,10 +675,10 @@ User *do_nick(const char *source, const char *nick, const char *username, const
|
||||
/* Update this only if nicks aren't the same */
|
||||
user->my_signon = time(NULL);
|
||||
|
||||
old_na = user->na;
|
||||
old_na = findnick(user->nick);
|
||||
if (old_na) {
|
||||
if (nick_recognized(user))
|
||||
user->na->last_seen = time(NULL);
|
||||
old_na->last_seen = time(NULL);
|
||||
status = old_na->status & NS_TRANSGROUP;
|
||||
cancel_user(user);
|
||||
}
|
||||
@@ -736,62 +686,61 @@ User *do_nick(const char *source, const char *nick, const char *username, const
|
||||
user->SetNewNick(nick);
|
||||
send_event(EVENT_CHANGE_NICK, 1, nick);
|
||||
|
||||
if ((old_na ? old_na->nc : NULL) ==
|
||||
(user->na ? user->na->nc : NULL))
|
||||
if ((old_na ? old_na->nc : NULL) == user->nc)
|
||||
nc_changed = 0;
|
||||
|
||||
if (!nc_changed && (user->na))
|
||||
user->na->status |= status;
|
||||
else {
|
||||
if (!nc_changed)
|
||||
{
|
||||
NickAlias *tmp = findnick(user->nick);
|
||||
if (tmp)
|
||||
tmp->status |= status;
|
||||
}
|
||||
else
|
||||
{
|
||||
ircdproto->SendUnregisteredNick(user);
|
||||
}
|
||||
}
|
||||
|
||||
if (ircd->sqline) {
|
||||
if (ircd->sqline)
|
||||
{
|
||||
if (!is_oper(user) && check_sqline(user->nick, 1))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} /* if (!*source) */
|
||||
|
||||
/* Check for nick tracking to bypass identification */
|
||||
if (NSNickTracking && nsCheckNickTracking(user)) {
|
||||
user->na->status |= NS_IDENTIFIED;
|
||||
NickAlias *ntmp = findnick(user->nick);
|
||||
if (ntmp && user->nc == ntmp->nc)
|
||||
{
|
||||
ntmp->status |= NS_IDENTIFIED;
|
||||
nc_changed = 0;
|
||||
}
|
||||
|
||||
if (nc_changed || !nick_recognized(user)) {
|
||||
if (nc_changed || !nick_recognized(user))
|
||||
{
|
||||
if (validate_user(user))
|
||||
check_memos(user);
|
||||
}
|
||||
else
|
||||
{
|
||||
char tsbuf[16];
|
||||
ntmp->last_seen = time(NULL);
|
||||
|
||||
} else {
|
||||
if (nick_identified(user)) {
|
||||
char tsbuf[16];
|
||||
user->na->last_seen = time(NULL);
|
||||
if (ntmp->last_usermask)
|
||||
delete [] ntmp->last_usermask;
|
||||
ntmp->last_usermask = new char[user->GetIdent().length() + user->GetDisplayedHost().length() + 2];
|
||||
sprintf(ntmp->last_usermask, "%s@%s",
|
||||
user->GetIdent().c_str(), user->GetDisplayedHost().c_str());
|
||||
|
||||
if (user->na->last_usermask)
|
||||
delete [] user->na->last_usermask;
|
||||
user->na->last_usermask = new char[user->GetIdent().length() + user->GetDisplayedHost().length() + 2];
|
||||
sprintf(user->na->last_usermask, "%s@%s",
|
||||
user->GetIdent().c_str(), user->GetDisplayedHost().c_str());
|
||||
|
||||
snprintf(tsbuf, sizeof(tsbuf), "%lu",
|
||||
static_cast<unsigned long>(user->timestamp));
|
||||
ircdproto->SendSVID2(user, tsbuf);
|
||||
|
||||
alog("%s: %s!%s@%s automatically identified for nick %s",
|
||||
s_NickServ, user->nick, user->GetIdent().c_str(),
|
||||
user->host, user->nick);
|
||||
}
|
||||
alog("%s: %s!%s@%s automatically identified for nick %s", s_NickServ, user->nick, user->GetIdent().c_str(), user->host, user->nick);
|
||||
}
|
||||
|
||||
/* Bahamut sets -r on every nick changes, so we must test it even if nc_changed == 0 */
|
||||
if (ircd->check_nick_id) {
|
||||
if (nick_identified(user)) {
|
||||
char tsbuf[16];
|
||||
snprintf(tsbuf, sizeof(tsbuf), "%lu",
|
||||
static_cast<unsigned long>(user->timestamp));
|
||||
ircdproto->SendSVID3(user, tsbuf);
|
||||
if (ircd->check_nick_id)
|
||||
{
|
||||
if (nick_identified(user))
|
||||
{
|
||||
// XXX: I assume we need to reset +r on here.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -839,7 +788,7 @@ void do_quit(const char *source, int ac, const char **av)
|
||||
if (debug) {
|
||||
alog("debug: %s quits", source);
|
||||
}
|
||||
if ((na = user->na) && (!(na->status & NS_FORBIDDEN))
|
||||
if ((na = findnick(user->nick)) && (!(na->status & NS_FORBIDDEN))
|
||||
&& (!(na->nc->flags & NI_SUSPENDED))
|
||||
&& (na->status & (NS_IDENTIFIED | NS_RECOGNIZED))) {
|
||||
na->last_seen = time(NULL);
|
||||
@@ -875,7 +824,7 @@ void do_kill(const char *nick, const char *msg)
|
||||
if (debug) {
|
||||
alog("debug: %s killed", nick);
|
||||
}
|
||||
if ((na = user->na) && (!(na->status & NS_FORBIDDEN))
|
||||
if ((na = findnick(user->nick)) && (!(na->status & NS_FORBIDDEN))
|
||||
&& (!(na->nc->flags & NI_SUSPENDED))
|
||||
&& (na->status & (NS_IDENTIFIED | NS_RECOGNIZED))) {
|
||||
na->last_seen = time(NULL);
|
||||
|
||||
Reference in New Issue
Block a user