X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/4b2dcc0db0eef47b66068352a43312948bba7595..63c0b8ad3980b46f5c9052c1966a36ce15f6e440:/src/proto-p10.c?ds=sidebyside diff --git a/src/proto-p10.c b/src/proto-p10.c index c77124e..b7b0864 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -343,6 +343,9 @@ static const char *his_servername; static const char *his_servercomment; static int extended_accounts; +/* These correspond to 1 << X: 012345678901234567 */ +const char irc_user_mode_chars[] = "o iw dkgn I"; + static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip); extern int off_channel; @@ -578,41 +581,9 @@ irc_user(struct userNode *user) return; irc_p10_ntop(b64ip, &user->ip); if (user->modes) { - int modelen; char modes[32]; - modelen = 0; - if (IsOper(user)) - modes[modelen++] = 'o'; - if (IsInvisible(user)) - modes[modelen++] = 'i'; - if (IsWallOp(user)) - modes[modelen++] = 'w'; - if (IsService(user)) - modes[modelen++] = 'k'; - if (IsDeaf(user)) - modes[modelen++] = 'd'; - if (IsGlobal(user)) - modes[modelen++] = 'g'; - // sethost - reed/apples - // if (IsHelperIrcu(user)) - if (IsSetHost(user)) - modes[modelen++] = 'h'; - if (IsFakeHost(user)) - modes[modelen++] = 'f'; - if (IsHiddenHost(user)) - modes[modelen++] = 'x'; - if (IsBotM(user)) - modes[modelen++] = 'B'; - if (IsHideChans(user)) - modes[modelen++] = 'n'; - if (IsHideIdle(user)) - modes[modelen++] = 'I'; - if (IsXtraOp(user)) - modes[modelen++] = 'X'; - - modes[modelen] = 0; - + irc_user_modes(user, modes, sizeof(modes)); /* we don't need to put the + in modes because it's in the format string. */ putsock("%s " P10_NICK " %s %d " FMT_TIME_T " %s %s +%s %s %s :%s", user->uplink->numeric, user->nick, user->uplink->hops+1, user->timestamp, user->ident, user->hostname, modes, b64ip, user->numeric, user->info); @@ -1068,7 +1039,7 @@ irc_svspart(struct userNode *from, struct userNode *who, struct chanNode *to) } void -irc_svsquit(struct userNode *from, struct userNode *who, char *reason) +irc_svsquit(struct userNode *from, struct userNode *who, char const *reason) { putsock("%s " P10_SVSQUIT " %s :%s", from->uplink->numeric, who->numeric, reason); } @@ -1395,7 +1366,6 @@ static CMD_FUNC(cmd_eob) { struct server *sender; dict_iterator_t it; - unsigned int ii; if (!(sender = GetServerH(origin))) return 0; @@ -1416,8 +1386,7 @@ static CMD_FUNC(cmd_eob) } sender->self_burst = 0; recalc_bursts(sender); - for (ii=0; iinumeric, target->numeric, (add == PRIV_ADD) ? "+" : "-", flag); } +void +irc_raw_privs(struct userNode *target, const char *privs) +{ + putsock("%s " P10_PRIVS " %s %s", self->numeric, target->numeric, privs); +} + static CMD_FUNC(cmd_privs) { char *tstr = NULL; @@ -2500,6 +2475,7 @@ parse_cleanup(void) { unsigned int nn; free(of_list); + free(of_list_extra); free(privmsg_funcs); num_privmsg_funcs = 0; free(notice_funcs); @@ -3008,7 +2984,7 @@ static struct userNode* AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip) { struct userNode *oldUser, *uNode; - unsigned int n, ignore_user, dummy; + unsigned int ignore_user, dummy; char *tstr; int type; @@ -3106,8 +3082,7 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char * } if (IsLocal(uNode)) irc_user(uNode); - for (n=0; (ndead; n++) - nuf_list[n](uNode); + call_new_user_funcs(uNode); if ((uNode->loc == 1) && (uNode->handle_info)) send_func_list(uNode); @@ -3119,7 +3094,6 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char * void DelUser(struct userNode* user, struct userNode *killer, int announce, const char *why) { - unsigned int n; verify(user); @@ -3135,8 +3109,7 @@ DelUser(struct userNode* user, struct userNode *killer, int announce, const char /* Call these in reverse order so ChanServ can update presence information before NickServ nukes the handle_info. */ - for (n = duf_used; n > 0; ) - duf_list[--n](user, killer, why); + call_del_user_funcs(user, killer, why); user->uplink->clients--; user->uplink->users[user->num_local] = NULL;