From 83a576f5a3e128554968fbbf32439da77b1150d5 Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 1 May 2004 11:17:11 +0000 Subject: [PATCH] introduce unreg_privmsg_func, fix minor autoinvite issue, alter account-finding on local services clients * introduce unreg_privmsg_func: unreg_privmsg_func()/unreg_notice_func() - both of which reverse the effect of reg_privmsg_func()/reg_notice_func() * fix minor autoinvite issue: UserAutoInvite (aka: '!uset autoinvite ..') no longer invites you to channels you weren't in if the server you are on just reconnected to the network * alter account-finding on local services clients: non +k users on the local services server are now no longer referred to as services (at least not in regard to accounts..) git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-57 --- ChangeLog | 19 +++++++++++++++++++ src/chanserv.c | 3 ++- src/nickserv.c | 5 ++++- src/proto-common.c | 10 ++++++++++ src/proto-p10.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/proto.h | 4 ++++ srvx.conf.example | 4 ++++ 7 files changed, 88 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ef5895..b5c8193 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,25 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2004-srvx/srvx--devo--1.3 # +2004-05-01 11:17:11 GMT adam patch-57 + + Summary: + introduce unreg_privmsg_func, fix minor autoinvite issue, alter account-finding on local services clients + Revision: + srvx--devo--1.3--patch-57 + + * introduce unreg_privmsg_func: unreg_privmsg_func()/unreg_notice_func() - both of which reverse the effect of reg_privmsg_func()/reg_notice_func() + + * fix minor autoinvite issue: UserAutoInvite (aka: '!uset autoinvite ..') no longer invites you to channels you weren't in if the server you are on just reconnected to the network + + * alter account-finding on local services clients: non +k users on the local services server are now no longer referred to as services (at least not in regard to accounts..) + + + modified files: + ChangeLog src/chanserv.c src/nickserv.c src/proto-common.c + src/proto-p10.c src/proto.h srvx.conf.example + + 2004-04-29 01:57:00 GMT Michael Poole patch-56 Summary: diff --git a/src/chanserv.c b/src/chanserv.c index bceca0d..75f7ee2 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -5914,7 +5914,8 @@ handle_auth(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle)) if(!IsUserSuspended(channel) && IsUserAutoInvite(channel) && (channel->access >= channel->channel->lvlOpts[lvlInviteMe]) - && !self->burst) + && !self->burst + && !user->uplink->burst) irc_invite(chanserv, user, cn); continue; } diff --git a/src/nickserv.c b/src/nickserv.c index d88d204..241df1e 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -673,7 +673,10 @@ smart_get_handle_info(struct userNode *service, struct userNode *user, const cha return 0; } if (IsLocal(target)) { - send_message(user, service, "NSMSG_USER_IS_SERVICE", target->nick); + if (IsService(target)) + send_message(user, service, "NSMSG_USER_IS_SERVICE", target->nick); + else + send_message(user, service, "MSG_USER_AUTHENTICATE", target->nick); return 0; } if (!(hi = target->handle_info)) { diff --git a/src/proto-common.c b/src/proto-common.c index 2be1929..f556045 100644 --- a/src/proto-common.c +++ b/src/proto-common.c @@ -370,6 +370,10 @@ static CMD_FUNC(cmd_whois) { struct userNode *from; struct userNode *who; +#ifdef WITH_PROTOCOL_P10 + extern char *his_servername; + extern char *his_servercomment; +#endif if (argc < 3) return 0; @@ -386,7 +390,13 @@ static CMD_FUNC(cmd_whois) return 1; } irc_numeric(from, RPL_WHOISUSER, "%s %s %s * :%s", who->nick, who->ident, who->hostname, who->info); +#ifdef WITH_PROTOCOL_P10 + if (his_servername && his_servercomment) + irc_numeric(from, RPL_WHOISSERVER, "%s %s :%s", who->nick, his_servername, his_servercomment); + else +#endif irc_numeric(from, RPL_WHOISSERVER, "%s %s :%s", who->nick, who->uplink->name, who->uplink->description); + if (IsOper(who)) { irc_numeric(from, RPL_WHOISOPERATOR, "%s :is a megalomaniacal power hungry tyrant", who->nick); } diff --git a/src/proto-p10.c b/src/proto-p10.c index ac7ad8b..4340ff5 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -287,6 +287,9 @@ static privmsg_func_t *notice_funcs; static unsigned int num_notice_funcs; static struct dict *unbursted_channels; +char *his_servername; +char *his_servercomment; + 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); /* Numerics can be XYY, XYYY, or XXYYY; with X's identifying the @@ -1383,6 +1386,8 @@ init_parse(void) const char *str, *desc; int numnick, usermask, max_users; char numer[COMBO_NUMERIC_LEN+1]; + extern char *his_servername; + extern char *his_servercomment; /* read config items */ str = conf_get_data("server/ping_freq", RECDB_QSTRING); @@ -1405,6 +1410,10 @@ init_parse(void) inttobase64(numer, (numnick << 12) + (usermask & 0x00fff), 3); else inttobase64(numer, (numnick << 18) + (usermask & 0x3ffff), 5); + str = conf_get_data("server/his_servername", RECDB_QSTRING); + his_servername = str ? strdup(str) : NULL; + str = conf_get_data("server/his_servercomment", RECDB_QSTRING); + his_servercomment = str ? strdup(str) : NULL; str = conf_get_data("server/hostname", RECDB_QSTRING); desc = conf_get_data("server/description", RECDB_QSTRING); if (!str || !desc) { @@ -2343,6 +2352,24 @@ reg_privmsg_func(struct userNode *user, privmsg_func_t handler) privmsg_funcs[numeric] = handler; } +void +unreg_privmsg_func(struct userNode *user, privmsg_func_t handler) +{ + unsigned int x; + + if (!user || handler) + return; /* this really only works with users */ + + memset(privmsg_funcs+user->num_local, 0, sizeof(privmsg_func_t)); + + for (x = user->num_local+1; x < num_privmsg_funcs; x++) + memmove(privmsg_funcs+x-1, privmsg_funcs+x, sizeof(privmsg_func_t)); + + privmsg_funcs = realloc(privmsg_funcs, num_privmsg_funcs*sizeof(privmsg_func_t)); + num_privmsg_funcs--; +} + + void reg_notice_func(struct userNode *user, privmsg_func_t handler) { @@ -2358,6 +2385,24 @@ reg_notice_func(struct userNode *user, privmsg_func_t handler) notice_funcs[numeric] = handler; } +void +unreg_notice_func(struct userNode *user, privmsg_func_t handler) +{ + unsigned int x; + + if (!user || handler) + return; /* this really only works with users */ + + memset(notice_funcs+user->num_local, 0, sizeof(privmsg_func_t)); + + for (x = user->num_local+1; x < num_notice_funcs; x++) + memmove(notice_funcs+x-1, notice_funcs+x, sizeof(privmsg_func_t)); + + memset(notice_funcs+user->num_local, 0, sizeof(privmsg_func_t)); + notice_funcs = realloc(notice_funcs, num_notice_funcs*sizeof(privmsg_func_t)); + num_notice_funcs--; +} + void reg_oper_func(oper_func_t handler) { diff --git a/src/proto.h b/src/proto.h index 8355925..bb06785 100644 --- a/src/proto.h +++ b/src/proto.h @@ -87,6 +87,8 @@ struct cManagerNode #ifdef WITH_PROTOCOL_P10 struct server* GetServerN(const char *numeric); struct userNode* GetUserN(const char *numeric); +extern char *his_servername; +extern char *his_servercomment; #endif /* Basic protocol parsing support. */ @@ -102,6 +104,8 @@ struct userNode *get_chanmsg_bot(unsigned char prefix); typedef void (*privmsg_func_t) (struct userNode *user, struct userNode *target, char *text, int server_qualified); void reg_privmsg_func(struct userNode *user, privmsg_func_t handler); void reg_notice_func(struct userNode *user, privmsg_func_t handler); +void unreg_privmsg_func(struct userNode *user, privmsg_func_t handler); +void unreg_notice_func(struct userNode *user, privmsg_func_t handler); typedef void (*oper_func_t) (struct userNode *user); void reg_oper_func(oper_func_t handler); diff --git a/srvx.conf.example b/srvx.conf.example index 3243d38..e0304fa 100644 --- a/srvx.conf.example +++ b/srvx.conf.example @@ -295,6 +295,10 @@ "max_cycles" "30"; // max uplink cycles before giving up // Admin information is traditionally: location, location, email "admin" ("IRC Network", "Gotham City, GO", "Mr Commissioner "); + /* the following two settings are for ircu's HEAD_IN_SAND features, and are equivelent to + * the F: lines in ircu's ircd.conf. both can be disabled by commenting them out. */ + "his_servername" "*.Generic.NET"; // hidden server name, shown in remote /whois requests + "his_servercomment" "The Generic, Boring IRC Network"; }; // controlling how services (mostly NickServ) send mail -- 2.20.1