move server join/part notices from statserv to connectserv

This commit is contained in:
Mark 2004-01-09 23:47:26 +00:00
parent 25811b56aa
commit 1cdc5c8db9
6 changed files with 56 additions and 19 deletions

View file

@ -1,6 +1,9 @@
ConnectServ Module for NeoStats 2.x ChangeLog
Shmad & ^Enigma^
==============================================================================
* Version 1.13 * Mark (M) * January 9, 2004
- New SERVWATCH option to track server joins/quits (M)
* Version 1.12 * Fish (F) * December 28, 2003
- Gecos is echoed in signon/signoff now (F)

View file

@ -112,6 +112,8 @@ static int cs_user_smodes(char **av, int ac);
static int cs_del_user(char **av, int ac);
static int cs_user_kill(char **av, int ac);
static int cs_user_nick(char **av, int ac);
static int cs_server_join(char **av, int ac);
static int cs_server_quit(char **av, int ac);
static void LoadConfig(void);
@ -123,6 +125,7 @@ struct cs_cfg {
int kill_watch;
int mode_watch;
int nick_watch;
int serv_watch;
int modnum;
char user[MAXUSER];
char host[MAXHOST];
@ -154,6 +157,7 @@ static bot_setting cs_settings[]=
{"KILLWATCH", &cs_cfg.kill_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "KillWatch", NULL, cs_help_set_killwatch },
{"MODEWATCH", &cs_cfg.mode_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "ModeWatch", NULL, cs_help_set_modewatch },
{"NICKWATCH", &cs_cfg.nick_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "NickWatch", NULL, cs_help_set_nickwatch },
{"SERVWATCH", &cs_cfg.serv_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "ServWatch", NULL, cs_help_set_servwatch },
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL },
};
@ -182,6 +186,8 @@ EventFnList __module_events[] = {
{EVENT_SIGNOFF, cs_del_user},
{EVENT_KILL, cs_user_kill},
{EVENT_NICKCHANGE, cs_user_nick},
{EVENT_NEWSERVER, cs_server_join},
{EVENT_SQUIT, cs_server_quit},
{NULL, NULL}
};
@ -717,6 +723,9 @@ static void LoadConfig(void)
if(GetConf((void *) &cs_cfg.nick_watch, CFGBOOL, "NickWatch")<= 0) {
cs_cfg.nick_watch = 1;
}
if(GetConf((void *) &cs_cfg.serv_watch, CFGBOOL, "ServWatch")<= 0) {
cs_cfg.serv_watch = 1;
}
if(GetConf((void *) &temp, CFGSTR, "Nick") < 0) {
#if !defined(HYBRID7)
strlcpy(s_ConnectServ , "ConnectServ", MAXNICK);
@ -751,3 +760,35 @@ static void LoadConfig(void)
free(temp);
}
}
static int cs_server_join(char **av, int ac)
{
Server *s;
SET_SEGV_LOCATION();
if (!cs_online ||!cs_cfg.serv_watch)
return 1;
s = findserver(av[0]);
if (!s)
return 0;
chanalert (s_ConnectServ, "\2SERVER\2 %s has joined the Network at %s",
s->name, s->uplink);
return 1;
}
static int cs_server_quit(char **av, int ac);
{
Server *s;
SET_SEGV_LOCATION();
if (!cs_online ||!cs_cfg.serv_watch)
return 1;
s = findserver(av[0]);
if (!s)
return 0;
chanalert (s_ConnectServ, "\2SERVER\2 %s has left the Network at %s",
s->name, s->uplink);
return 1;
}

View file

@ -61,3 +61,8 @@ const char *cs_help_set_nickwatch[] = {
"events to the services channel.",
NULL
};
const char *cs_help_set_servwatch[] = {
"SERVWATCH <ON/OFF> whether to echo server",
"joins and quits to the services channel.",
NULL
};

View file

@ -4,10 +4,12 @@ Shmad & ^Enigma & Fish^
(S) denotes Shmad (E) denotes ^Enigma^
(F) denotes Fish (M) denotes Mark
* Revision 810 * Nov 23rd, 2003 (M)
* Revision 810 * January 9, 2004 (M)
- removed fopen attempt on old system of dl/statserv/html/index.tpl.
- improved error message for failed open of template and output file
- begin reworking announcement code for wallops
- move SERVER join/quit anouncements to ConnectServ since it is not really a
StatServ task
* Revision 810 * Nov 23rd, 2003 (M)
- change SSMNAME to __module_info.module_name to be consistent with other modules (M)

View file

@ -63,20 +63,6 @@ announce_record(const char *msg, ...)
return 1;
}
static int
announce_server_join_part(const char *msg, ...)
{
va_list ap;
if (ok_to_wallop() > 0) {
va_start (ap, msg);
ircvsnprintf (announce_buf, BUFSIZE, msg, ap);
va_end (ap);
chanalert (s_StatServ, "%s", announce_buf);
}
return 1;
}
static int
announce_lag(const char *msg, ...)
{
@ -298,8 +284,6 @@ int s_new_server(char **av, int ac)
daily.servers = stats_network.servers;
daily.t_servers = me.now;
}
announce_server_join_part("\2SERVER\2 %s has joined the Network at %s",
s->name, s->uplink);
return 1;
}
@ -314,8 +298,6 @@ int s_del_server(char **av, int ac)
if (!s)
return 0;
DecreaseServers();
announce_server_join_part("\2SERVER\2 %s has left the Network at %s",
s->name, s->uplink);
ss = findstats(s->name);
if (s->name != me.uplink)
ss->numsplits = ss->numsplits + 1;

View file

@ -757,6 +757,10 @@ Description:
NICKWATCH <ON|OFF>
echo nickname changes.
SERVWATCH <ON|OFF>
echo server joins/quits.
Example:
/msg ConnectServ SET NICKWATCH ON