[srvx-commits] CVS: services/src messages.h,1.15.2.5,1.15.2.6 opserv.c,1.187.2.45,1.187.2.46 opserv.
Brought to you by:
entrope
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv32490/src
Modified Files:
Tag: rel-1_0
messages.h opserv.c opserv.help parse.c proto.c proto.h
Log Message:
define "?stats glines" and "?gsync" commands, and parse the response from the uplink
Index: messages.h
===================================================================
RCS file: /cvsroot/srvx/services/src/messages.h,v
retrieving revision 1.15.2.5
retrieving revision 1.15.2.6
diff -C2 -r1.15.2.5 -r1.15.2.6
*** messages.h 2001/08/05 03:20:13 1.15.2.5
--- messages.h 2001/08/16 02:39:18 1.15.2.6
***************
*** 50,53 ****
--- 50,54 ----
#define MSG_NICK_UNKNOWN "User with nick $b%s$b does not exist."
#define MSG_CHANNEL_UNKNOWN "Channel with name $b%s$b does not exist."
+ #define MSG_SERVER_UNKNOWN "Server with name $b%s$b does not exist or is not linked."
#define MSG_NICKS_UNKNOWN "Some of the nicks provided are nonexistent."
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.187.2.45
retrieving revision 1.187.2.46
diff -C2 -r1.187.2.45 -r1.187.2.46
*** opserv.c 2001/08/12 23:02:29 1.187.2.45
--- opserv.c 2001/08/16 02:39:18 1.187.2.46
***************
*** 167,170 ****
--- 167,171 ----
#define OSMSG_DISABLED_LIST "Disabled commands: %s"
#define OSMSG_BADWORD_LIST "Bad words: %s"
+ #define OSMSG_GLINE_COUNT "There are %d glines active on the network."
#define OSMSG_BEGIN_LINKS "Server link info:"
#define OSMSG_LINK_INFO "Hub: %s Link: %s"
***************
*** 226,229 ****
--- 227,231 ----
#define OSMSG_NOT_IP "You must provide a valid IPv4 address."
#define OSMSG_BAD_ACTION "Unrecognized trace action '%s'."
+ #define OSMSG_GSYNC_RUNNING "Synchronizing glines from %s."
#define OSMSG_GTRACE_FORMAT "%s (by %s, expires %s): %s"
#define OSMSG_ALIAS_CREATED "Added %s alias '%s' for '%s'."
***************
*** 1477,1480 ****
--- 1479,1488 ----
static void
+ cmd_stats_glines(struct userNode *user)
+ {
+ opserv_notice(user, OSMSG_GLINE_COUNT, gline_count());
+ }
+
+ static void
trace_links(struct userNode *user, struct server *server, int allow_self)
{
***************
*** 1649,1653 ****
OPSERV_MIN_PARMS(2, false);
if (!strcasecmp(argv[1], "bad")) cmd_stats_bad(user);
! /* else if (!strcasecmp(argv[1], "glines")) cmd_stats_glines(user); */
else if (!strcasecmp(argv[1], "links")) cmd_stats_links(user);
else if (!strcasecmp(argv[1], "max")) cmd_stats_max(user);
--- 1657,1661 ----
OPSERV_MIN_PARMS(2, false);
if (!strcasecmp(argv[1], "bad")) cmd_stats_bad(user);
! else if (!strcasecmp(argv[1], "glines")) cmd_stats_glines(user);
else if (!strcasecmp(argv[1], "links")) cmd_stats_links(user);
else if (!strcasecmp(argv[1], "max")) cmd_stats_max(user);
***************
*** 3164,3167 ****
--- 3172,3193 ----
}
+ static OPSERV_FUNC(cmd_gsync)
+ {
+ struct server *src;
+ (void)channel;
+ if (argc > 1) {
+ src = GetServerH(argv[1]);
+ if (!src) {
+ opserv_notice(user, MSG_SERVER_UNKNOWN, argv[1]);
+ return 0;
+ }
+ } else {
+ src = self->uplink;
+ }
+ irc_stats(opserv, src, 'G');
+ opserv_notice(user, OSMSG_GSYNC_RUNNING, src->name);
+ return 1;
+ }
+
static void
gtrace_print_func(struct gline *gline, void *extra)
***************
*** 3858,3861 ****
--- 3884,3888 ----
opserv_define_func("TRACE GAG", NULL, 600);
opserv_define_func("TRACE KILL", NULL, 600);
+ opserv_define_func("GSYNC", cmd_gsync, 600);
opserv_define_func("GTRACE", cmd_gtrace, 100);
opserv_define_func("TIMECMD", cmd_timecmd, 1);
Index: opserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.help,v
retrieving revision 1.24.2.12
retrieving revision 1.24.2.13
diff -C2 -r1.24.2.12 -r1.24.2.13
*** opserv.help 2001/08/13 19:21:18 1.24.2.12
--- opserv.help 2001/08/16 02:39:18 1.24.2.13
***************
*** 286,289 ****
--- 286,290 ----
"Displays statistics about a specified subject. Subjects include:",
"$bBAD$b: Current list of bad words.",
+ "$bGLINES$b: Reports the current number of glines.",
"$bLINKS$b: Information about the link to the network.",
"$bMAX$b: The max clients seen on the network.",
Index: parse.c
===================================================================
RCS file: /cvsroot/srvx/services/src/Attic/parse.c,v
retrieving revision 1.113.2.15
retrieving revision 1.113.2.16
diff -C2 -r1.113.2.15 -r1.113.2.16
*** parse.c 2001/08/07 12:38:23 1.113.2.15
--- parse.c 2001/08/16 02:39:18 1.113.2.16
***************
*** 519,522 ****
--- 519,529 ----
}
+ static CMD_FUNC(cmd_num_gline)
+ {
+ if (argc < 7) return 0;
+ gline_add(argv[0]+1, argv[4], atoi(argv[5])-now, argv[6], 0);
+ return 1;
+ }
+
static CMD_FUNC(cmd_quit)
{
***************
*** 812,815 ****
--- 819,825 ----
dict_insert(irc_func_dict, "332", cmd_num_topic);
dict_insert(irc_func_dict, "333", cmd_num_topic);
+ /* "stats g" responses */
+ dict_insert(irc_func_dict, "247", cmd_num_gline);
+ dict_insert(irc_func_dict, "219", cmd_dummy); /* "End of /STATS report" */
/* other numeric responses we might get */
dict_insert(irc_func_dict, "401", cmd_dummy); /* target left network */
Index: proto.c
===================================================================
RCS file: /cvsroot/srvx/services/src/Attic/proto.c,v
retrieving revision 1.68.2.8
retrieving revision 1.68.2.9
diff -C2 -r1.68.2.8 -r1.68.2.9
*** proto.c 2001/08/02 03:06:30 1.68.2.8
--- proto.c 2001/08/16 02:39:18 1.68.2.9
***************
*** 650,653 ****
--- 650,659 ----
void
+ irc_stats(struct userNode *from, struct server *target, char type)
+ {
+ putsock("%s STATS %c :%s", from->numeric, type, target->numeric);
+ }
+
+ void
irc_part(struct userNode *who, struct chanNode *what, const char *reason)
{
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.24.2.3
retrieving revision 1.24.2.4
diff -C2 -r1.24.2.3 -r1.24.2.4
*** proto.h 2001/07/29 14:31:21 1.24.2.3
--- proto.h 2001/08/16 02:39:18 1.24.2.4
***************
*** 125,128 ****
--- 125,129 ----
void irc_kill(struct userNode *from, struct userNode *target, const char *message);
void irc_raw(const char *what);
+ void irc_stats(struct userNode *from, struct server *target, char type);
#endif /* !defined(PROTO_H) */
|