[srvx-commits] CVS: services/src main.c,1.130,1.131 opserv.c,1.257,1.258 proto-bahamut.c,1.9,1.10 pr
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2002-08-04 21:13:00
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv21766/src
Modified Files:
main.c opserv.c proto-bahamut.c proto-common.c proto-p10.c
proto.h
Log Message:
make irc_squit() take a second message (so ?die, ?restart don't show the issuing user's name)
opserv.c: fix channel-requiring commands to be permanently marked as such
Index: main.c
===================================================================
RCS file: /cvsroot/srvx/services/src/main.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -C2 -r1.130 -r1.131
*** main.c 4 Aug 2002 13:55:06 -0000 1.130
--- main.c 4 Aug 2002 21:12:57 -0000 1.131
***************
*** 203,207 ****
if(oldUplink)
{
! irc_squit(self, "Uplinks updated; selecting new uplink.");
}
--- 203,207 ----
if(oldUplink)
{
! irc_squit(self, "Uplinks updated; selecting new uplink.", NULL);
}
***************
*** 389,393 ****
log(MAIN_LOG, LOG_INFO, "%s -- exiting.\n", strsignal(x));
#endif
! irc_squit(self, "Exiting on signal from console.");
quit_services = 1;
}
--- 389,393 ----
log(MAIN_LOG, LOG_INFO, "%s -- exiting.\n", strsignal(x));
#endif
! irc_squit(self, "Exiting on signal from console.", NULL);
quit_services = 1;
}
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.257
retrieving revision 1.258
diff -C2 -r1.257 -r1.258
*** opserv.c 4 Aug 2002 20:11:18 -0000 1.257
--- opserv.c 4 Aug 2002 21:12:57 -0000 1.258
***************
*** 679,683 ****
(void)user;(void)channel;(void)argc;(void)argv;
! irc_squit(self, "Reconnecting.");
return 1;
--- 679,683 ----
(void)user;(void)channel;(void)argc;(void)argv;
! irc_squit(self, "Reconnecting.", NULL);
return 1;
***************
*** 767,771 ****
uplink_select(argv[1]);
! irc_squit(self, "Reconnecting.");
return 1;
--- 767,771 ----
uplink_select(argv[1]);
! irc_squit(self, "Reconnecting.", NULL);
return 1;
***************
*** 781,787 ****
reason = alloca(strlen(argv[1]) + strlen(user->nick) + 20);
sprintf(reason, "Disconnected by %s [%s]", user->nick, argv[1]);
!
! irc_squit(self, reason);
!
quit_services = 1;
return 1;
--- 781,785 ----
reason = alloca(strlen(argv[1]) + strlen(user->nick) + 20);
sprintf(reason, "Disconnected by %s [%s]", user->nick, argv[1]);
! irc_squit(self, reason, argv[1]);
quit_services = 1;
return 1;
***************
*** 799,804 ****
reason = alloca(strlen(argv[1]) + strlen(user->nick) + 17);
sprintf(reason, "Restarted by %s [%s]", user->nick, argv[1]);
!
! irc_squit(self, reason);
/* Append a NULL to the end of argv[]. */
--- 797,801 ----
reason = alloca(strlen(argv[1]) + strlen(user->nick) + 17);
sprintf(reason, "Restarted by %s [%s]", user->nick, argv[1]);
! irc_squit(self, reason, argv[1]);
/* Append a NULL to the end of argv[]. */
***************
*** 2518,2533 ****
opserv_define_func(const char *name, modcmd_func_t *func, int min_level, int reqchan)
{
! char buf[16], *flags;
sprintf(buf, "%d", min_level);
switch (reqchan) {
- default: case 0: flags = NULL; break;
case 1: flags = "+acceptchan"; break;
! case 2: flags = "+channel"; break;
! case 3: flags = "+channel,+acceptpluschan"; break;
}
if (flags) {
! return modcmd_register(opserv_module, name, func, 0, 0, "level", buf, "flags", flags, NULL);
} else {
! return modcmd_register(opserv_module, name, func, 0, 0, "level", buf, NULL);
}
}
--- 2515,2530 ----
opserv_define_func(const char *name, modcmd_func_t *func, int min_level, int reqchan)
{
! char buf[16], *flags = NULL;
! unsigned int iflags = 0;
sprintf(buf, "%d", min_level);
switch (reqchan) {
case 1: flags = "+acceptchan"; break;
! case 3: flags = "+acceptpluschan"; /* fall through */
! case 2: iflags = MODCMD_REQUIRE_CHANNEL; break;
}
if (flags) {
! return modcmd_register(opserv_module, name, func, 0, iflags, "level", buf, "flags", flags, NULL);
} else {
! return modcmd_register(opserv_module, name, func, 0, iflags, "level", buf, NULL);
}
}
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** proto-bahamut.c 4 Aug 2002 13:55:06 -0000 1.9
--- proto-bahamut.c 4 Aug 2002 21:12:57 -0000 1.10
***************
*** 76,80 ****
if (!serv) return;
if (announce && (serv->uplink == self) && (serv != self->uplink)) {
! irc_squit(serv, message);
}
for (nn=serv->children.used; nn>0;) {
--- 76,80 ----
if (!serv) return;
if (announce && (serv->uplink == self) && (serv != self->uplink)) {
! irc_squit(serv, message, NULL);
}
for (nn=serv->children.used; nn>0;) {
***************
*** 106,109 ****
--- 106,110 ----
}
}
+ if (strlen(nick) > nicklen) return 0;
return 1;
}
***************
*** 125,134 ****
}
- if (strlen(nick) > nicklen) {
- log(MAIN_LOG, LOG_ERROR, "AddUser(%p, %s, ...): nick too long (detected max is %d)\n", uplink, nick, nicklen);
- irc_squit(self, "Nick too long; see main.log for details");
- return NULL;
- }
-
uNode = calloc(1, sizeof(*uNode));
safestrncpy(uNode->nick, nick, sizeof(uNode->nick));
--- 126,129 ----
***************
*** 296,305 ****
void
! irc_squit(struct server *srv, const char *message) {
/* If we're leaving the network, QUIT all our clients. */
if ((srv == self) && (cManager.uplink->state == CONNECTED)) {
dict_iterator_t it;
for (it = dict_first(srv->users); it; it = iter_next(it)) {
! irc_quit(iter_data(it), message);
}
}
--- 291,301 ----
void
! irc_squit(struct server *srv, const char *message, const char *service_message) {
! if (!service_message) service_message = message;
/* If we're leaving the network, QUIT all our clients. */
if ((srv == self) && (cManager.uplink->state == CONNECTED)) {
dict_iterator_t it;
for (it = dict_first(srv->users); it; it = iter_next(it)) {
! irc_quit(iter_data(it), service_message);
}
}
Index: proto-common.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-common.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** proto-common.c 4 Aug 2002 13:55:06 -0000 1.6
--- proto-common.c 4 Aug 2002 21:12:57 -0000 1.7
***************
*** 347,351 ****
timeouts per time period exceeds some amount, the uplink could
be marked as unavalable.*/
! irc_squit(self, "Ping timeout.");
}
--- 347,351 ----
timeouts per time period exceeds some amount, the uplink could
be marked as unavalable.*/
! irc_squit(self, "Ping timeout.", NULL);
}
***************
*** 361,365 ****
this happens, though there should be a way of resetting
the flag. */
! irc_squit(self, "Incorrect password received.");
return 1;
}
--- 361,365 ----
this happens, though there should be a way of resetting
the flag. */
! irc_squit(self, "Incorrect password received.", NULL);
return 1;
}
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** proto-p10.c 4 Aug 2002 13:55:06 -0000 1.8
--- proto-p10.c 4 Aug 2002 21:12:57 -0000 1.9
***************
*** 295,300 ****
void
! irc_squit(struct server *srv, const char *message)
{
/* Are we leaving the network? */
if (srv == self && cManager.uplink->state == CONNECTED) {
--- 295,302 ----
void
! irc_squit(struct server *srv, const char *message, const char *service_message)
{
+ if (!service_message) service_message = message;
+
/* Are we leaving the network? */
if (srv == self && cManager.uplink->state == CONNECTED) {
***************
*** 304,308 ****
for (i = 0; i <= self->num_mask; i++) {
if (!self->users[i]) continue;
! irc_quit(self->users[i], message);
}
}
--- 306,310 ----
for (i = 0; i <= self->num_mask; i++) {
if (!self->users[i]) continue;
! irc_quit(self->users[i], service_message);
}
}
***************
*** 699,703 ****
(void)origin; (void)argc; (void)argv;
change_nicklen(9);
! irc_squit(self, "Got erroneous nickname, truncating nicks");
return 1;
}
--- 701,705 ----
(void)origin; (void)argc; (void)argv;
change_nicklen(9);
! irc_squit(self, "Got erroneous nickname, truncating nicks.", NULL);
return 1;
}
***************
*** 1438,1442 ****
* (This code is only to handle killing juped servers.) */
if (announce && (serv->uplink == self) && (serv != self->uplink)) {
! irc_squit(serv, message);
}
--- 1440,1444 ----
* (This code is only to handle killing juped servers.) */
if (announce && (serv->uplink == self) && (serv != self->uplink)) {
! irc_squit(serv, message, NULL);
}
***************
*** 1501,1504 ****
--- 1503,1507 ----
if (!isalnum(*nick) && !strchr("{|}~[\\]^-_`", *nick)) return 0;
}
+ if (strlen(nick) > nicklen) return 0;
return 1;
}
***************
*** 1528,1537 ****
if (!is_valid_nick(nick)) {
log(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): invalid nickname detected.\n", uplink, nick);
- return NULL;
- }
-
- if (strlen(nick) > nicklen) {
- log(MAIN_LOG, LOG_ERROR, "AddUser(%p, %s, ...): nick too long (detected max is %d)\n", uplink, nick, nicklen);
- irc_squit(self, "Nick too long; see main.log for details");
return NULL;
}
--- 1531,1534 ----
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -r1.55 -r1.56
*** proto.h 30 Jul 2002 02:15:11 -0000 1.55
--- proto.h 4 Aug 2002 21:12:57 -0000 1.56
***************
*** 123,127 ****
void irc_pong(const char *data);
void irc_quit(struct userNode *user, const char *message);
! void irc_squit(struct server *srv, const char *message);
/* messages */
--- 123,127 ----
void irc_pong(const char *data);
void irc_quit(struct userNode *user, const char *message);
! void irc_squit(struct server *srv, const char *message, const char *service_message);
/* messages */
|