* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#include "../ChangeLog"
#include "chanserv.h"
#include "conf.h"
#include "compat.h"
#include "opserv.h"
#include "saxdb.h"
#include "timeq.h"
+#include "version.h"
struct pending_template {
if (arg[1] == '$') {
new_argv[new_argc++] = arg + 1;
} else if (isdigit(arg[1])) {
- unsigned int lbound, ubound, jj;
+ unsigned int lbound = 0;
+ unsigned int ubound = 0;
+ unsigned int jj = 0;
char *end_num;
lbound = strtoul(arg+1, &end_num, 10);
struct svccmd *cmd;
unsigned int cmd_arg, perms, flags, options, result;
char channel_name[CHANNELLEN+1];
+ char *new_argv[MAXNUMPARAMS]; /* for aliases */
options = (server_qualified ? SVCCMD_QUALIFIED : 0) | SVCCMD_DEBIT | SVCCMD_NOISY;
/* Find the command argument. */
/* Expand the alias arguments, if there are any. */
if (cmd->alias.used) {
- char *new_argv[MAXNUMPARAMS];
int res;
res = svccmd_expand_alias(cmd, user, argc, argv, new_argv);
safestrncpy(channel_name, channel->name, sizeof(channel_name));
else
channel_name[0] = 0;
- if (!(result = cmd->command->func(user, channel, argc, argv, cmd)))
+
+ /* Call the function here */
+ if (!(result = cmd->command->func(user, channel, argc, argv, cmd)))
return 0;
+
if (!(flags & MODCMD_NO_LOG)) {
enum log_severity slvl;
if (result & CMD_LOG_OVERRIDE)
}
static int
-svccmd_invoke(struct userNode *user, struct service *service, struct chanNode *channel, const char *text, int server_qualified) {
+svccmd_invoke(struct userNode *user, struct service *service, struct chanNode *channel, const char *text, int server_qualified, int chanmsg) {
unsigned int argc;
char *argv[MAXNUMPARAMS];
char tmpline[MAXLEN];
if (!*text)
return 0;
if (service->privileged) {
+ /* Silently return if the message is a channel message (trigger) */
+ if (chanmsg && (!IsOper(user) || !user->handle_info || HANDLE_FLAGGED(user->handle_info, OPER_SUSPENDED)))
+ return 0;
if (!IsOper(user)) {
send_message(user, service->bot, "MSG_SERVICE_PRIVILEGED", service->bot->nick);
return 0;
return argc ? svccmd_invoke_argv(user, service, channel, argc, argv, server_qualified) : 0;
}
-char *cvs_verstring() {
- static char verstring[MAXLEN] = { 0 };
-
- if(!*verstring) {
- char *svn = NULL, *svnver = NULL, *svndate = NULL, *v = 0, ver[MAXLEN];
- int vc = 0;
-
- strcpy(ver, CVS_VERSION);
- for (svn = x3_strtok(&v, ver, " "); svn;
- svn = x3_strtok(&v, 0, " ")) {
- if (vc == 2)
- svnver = svn;
- else if (vc == 3)
- svndate = svn;
- vc++;
- }
- sprintf(verstring, "%s %s", svnver, svndate);
- }
- return verstring;
-}
-
-
void
modcmd_privmsg(struct userNode *user, struct userNode *bot, const char *text, int server_qualified) {
struct service *service;
snprintf(response, sizeof(response), "\x01USERINFO %s\x01", bot->info);
irc_notice_user(bot, user, response);
} else if (!irccasecmp(text, "VERSION")) {
- snprintf(response, sizeof(response), "\x01VERSION %s+[%s]\x01", PACKAGE_STRING, cvs_verstring());
+ snprintf(response, sizeof(response), "\x01VERSION %s+[%s]\x01", PACKAGE_STRING, cvs_version);
irc_notice_user(bot, user, response);
} else if (!irccasecmp(text, "GENDER")) {
snprintf(response, sizeof(response), "\x01GENDER ummm im still deciding\x01");
if (service->msg_hook && service->msg_hook(user, bot, text, server_qualified))
return;
- svccmd_invoke(user, service, NULL, text, server_qualified);
+ svccmd_invoke(user, service, NULL, text, server_qualified, 0);
}
void
struct service *service;
if (!(service = dict_find(services, bot->nick, NULL)))
return;
- svccmd_invoke(user, service, chan, text, 0);
+ svccmd_invoke(user, service, chan, text, 0, 1);
(void)is_notice;
}
continue;
} else if (isdigit(argv[arg][1])) {
char *end_num;
- unsigned long tmp;
- tmp = strtoul(argv[arg]+1, &end_num, 10);
+ strtoul(argv[arg]+1, &end_num, 10);
switch (end_num[0]) {
case 0:
continue;
unsplit_string(argv+1, argc-1, cmd_text);
gettimeofday(&start, NULL);
- svccmd_invoke(user, cmd->parent, channel, cmd_text, 0);
+ svccmd_invoke(user, cmd->parent, channel, cmd_text, 0, 0);
gettimeofday(&stop, NULL);
stop.tv_sec -= start.tv_sec;
stop.tv_usec -= start.tv_usec;
}
static MODCMD_FUNC(cmd_version) {
- send_message_type(4, user, cmd->parent->bot, "$b"PACKAGE_STRING"+[%s]$b (Based on srvx 1.3.x), Built: "__DATE__", "__TIME__".", cvs_verstring());
+ send_message_type(4, user, cmd->parent->bot, "$b"PACKAGE_STRING"+[%s]$b (Based on srvx 1.3.x), Built: "__DATE__", "__TIME__".", cvs_version);
send_message_type(4, user, cmd->parent->bot, "See $bCREDITS$b for more information.");
return 1;
}
send_message_type(4, user, cmd->parent->bot, "OSI Certified is a certification mark of the Open Source Initiative.");
send_message_type(4, user, cmd->parent->bot, "$b$b");
send_message_type(4, user, cmd->parent->bot, "The srvx 1.3.x Development Team includes Paul Chang, Adrian Dewhurst, Miles Peterson, Michael Poole and others.");
- send_message_type(4, user, cmd->parent->bot, "The X3 Development Team includes Alex Schumann, Reed Loden, Neil Spierling.");
- send_message_type(4, user, cmd->parent->bot, "The X3 Development Team can be reached at http://evilnet.sourceforge.net or in #evilnet on irc.afternet.org.");
+ send_message_type(4, user, cmd->parent->bot, "The X3 Development Team includes Alex Schumann, Reed Loden, Neil Spierling, Matthew Beeching.");
+ send_message_type(4, user, cmd->parent->bot, "The X3 Development Team can be reached at https://github.com/evilnet/x3/ or in #evilnet on irc.afternet.org.");
send_message_type(4, user, cmd->parent->bot, "$b$b");
send_message_type(4, user, cmd->parent->bot, "Thanks goes to ThiefMaster, Joe Hansche (joeatrr), Martijn Smit (wasted), and to any other people who have contributed to X3.");
send_message_type(4, user, cmd->parent->bot, "This program is free software; see COPYING in the distribution files.");