From: sirvulcan Date: Tue, 1 Aug 2006 04:49:57 +0000 (+0000) Subject: Changed the last of the global_message uses to global_message_arg's. X-Git-Tag: 1.9~475 X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/commitdiff_plain/57692f5ecc15a370b650c4e61fb44db1db4598a1 Changed the last of the global_message uses to global_message_arg's. --- diff --git a/ChangeLog b/ChangeLog index 17c7609..be1c155 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,19 @@ /*********************************************************************** X3 ChangeLog +2006-08-01 Neil Spierling + + * src/global.c: Added language strings for mod-helpserv.c, opserv.c, + spamserv.c, nickserv.c. + + * src/mod-helpserv.c: Changed global_message uses to global_message_arg's. + + * src/nickserv.c: Changed global_message uses to global_message_arg's. + + * src/opserv.c: Changed global_message uses to global_message_arg's. + + * src/spamserv.c: Changed global_message uses to global_message_arg's. + 2006-08-01 Neil Spierling * src/chanserv.c: Changed global_message uses to global_message_arg's. diff --git a/src/global.c b/src/global.c index 6944caa..63702a6 100644 --- a/src/global.c +++ b/src/global.c @@ -75,10 +75,31 @@ static const struct message_entry msgtab[] = { { "CSMSG_UNSUSPENDED_BY", "%s unsuspended by %s." }, { "CSMSG_OWNERSHIP_TRANSFERRED", "%s ownership transferred to %s by %s." }, + /* mod-helpserv.c */ + { "HSMSG_BOT_RENAMED", "HelpServ bot %s (in %s) renamed to %s by %s." }, + { "HSMSG_BOT_MOVED", "HelpServ %s (%s) moved to %s by %s." }, + { "HSMSG_BOT_REGISTERED", "HelpServ %s (%s) registered to %s by %s." }, + { "HSMSG_BOT_EXPIRED", "HelpServ %s (%s) expired at request of %s." }, + { "HSMSG_BOT_UNREGISTERED", "HelpServ %s (%s) unregistered by %s." }, + + /* nickserv.c */ + { "NSMSG_ACCOUNT_RENAMED", "%s renamed account %s to %s." }, + { "NSMSG_ACCOUNT_MERGED", "%s (%s) merged account %s into %s." }, + /* opserv.c */ { "DEFCON_NETWORK_CHANGED", "Network DefCon level has changed to level %d" }, { "DEFCON_OPER_LEVEL_CHANGE", "%s is changing the DefCon level to %d" }, { "DEFCON_TIMEOUT_LEVEL_CHANGE", "The DefCon has changed back to level %d (timeout)" }, + { "OSMSG_CHANNEL_ACTIVITY_WARN", "Channel activity warning for channel %s: %s" }, + + /* spamserv.c */ + { "SSMSG_CHANNEL_MERGED", "$X (channel %s) merged into %s by %s." }, + { "SSMSG_CHANNEL_MOVED", "$X (channel %s) moved into %s by %s." }, + { "SSMSG_UNREG_MANUAL", "$X (channel %s) %s by %s." }, + { "SSMSG_REG_EXPIRED", "$X (channel %s) registration expired." }, + { "SSMSG_LOST_ALL_USERS", "$X (channel %s) lost all users." }, + { "SSMSG_REGISTERED_BY", "$X (channel %s) registered by %s." }, + { "SSMSG_UNREGISTERED_BY", "$X (channel %s) unregistered by %s." }, { NULL, NULL } }; diff --git a/src/mod-helpserv.c b/src/mod-helpserv.c index dcfe35d..2557458 100644 --- a/src/mod-helpserv.c +++ b/src/mod-helpserv.c @@ -2216,7 +2216,7 @@ static HELPSERV_FUNC(cmd_move) { REQUIRE_PARMS(2); if (is_valid_nick(argv[1])) { - char *newnick = argv[1], oldnick[NICKLEN], reason[MAXLEN]; + char *newnick = argv[1], oldnick[NICKLEN]; strcpy(oldnick, hs->helpserv->nick); @@ -2231,8 +2231,8 @@ static HELPSERV_FUNC(cmd_move) { helpserv_notice(user, "HSMSG_RENAMED", oldnick, newnick); - snprintf(reason, MAXLEN, "HelpServ bot %s (in %s) renamed to %s by %s.", oldnick, hs->helpchan->name, newnick, user->nick); - global_message(MESSAGE_RECIPIENT_OPERS, reason); + global_message_args(MESSAGE_RECIPIENT_OPERS, "HSMSG_BOT_RENAMED", oldnick, + hs->helpchan->name, newnick, user->nick); return 1; } else if (IsChannelName(argv[1])) { @@ -2282,8 +2282,8 @@ static HELPSERV_FUNC(cmd_move) { } helpserv_botlist_append(botlist, hs); - snprintf(reason, MAXLEN, "HelpServ %s (%s) moved to %s by %s.", hs->helpserv->nick, oldchan, newchan, user->nick); - global_message(MESSAGE_RECIPIENT_OPERS, reason); + global_message_args(MESSAGE_RECIPIENT_OPERS, "HSMSG_BOT_MOVED", hs->helpserv->nick, + oldchan, newchan, user->nick); return 1; } else { @@ -2659,7 +2659,7 @@ static struct helpserv_bot *register_helpserv(const char *nick, const char *help } static HELPSERV_FUNC(cmd_register) { - char *nick, *helpchan, reason[MAXLEN]; + char *nick, *helpchan; struct handle_info *handle; REQUIRE_PARMS(4); @@ -2695,9 +2695,9 @@ static HELPSERV_FUNC(cmd_register) { helpserv_notice(user, "HSMSG_REG_SUCCESS", handle->handle, nick); - snprintf(reason, MAXLEN, "HelpServ %s (%s) registered to %s by %s.", nick, hs->helpchan->name, handle->handle, user->nick); /* Not sent to helpers, since they can't register HelpServ */ - global_message(MESSAGE_RECIPIENT_OPERS, reason); + global_message_args(MESSAGE_RECIPIENT_OPERS, "HSMSG_BOT_REGISTERED", nick, + hs->helpchan->name, handle->handle, user->nick); return 1; } @@ -2738,8 +2738,7 @@ static void helpserv_unregister(struct helpserv_bot *bot, const char *quit_fmt, snprintf(reason, sizeof(reason), quit_fmt, actor); DelUser(bot->helpserv, NULL, 1, reason); dict_remove(helpserv_bots_dict, botname); - snprintf(reason, sizeof(reason), global_fmt, botname, channame, actor); - global_message(MESSAGE_RECIPIENT_OPERS, reason); + global_message_args(MESSAGE_RECIPIENT_OPERS, global_fmt, botname, channame, actor); } static HELPSERV_FUNC(cmd_unregister) { @@ -2751,7 +2750,7 @@ static HELPSERV_FUNC(cmd_unregister) { log_audit(HS_LOG, LOG_COMMAND, user, hs->helpserv, hs->helpchan->name, 0, "unregister CONFIRM"); } - helpserv_unregister(hs, "Unregistered by %s", "HelpServ %s (%s) unregistered by %s.", user->nick); + helpserv_unregister(hs, "Unregistered by %s", "HSMSG_BOT_UNREGISTERED", user->nick); return from_opserv; } @@ -2767,7 +2766,7 @@ static HELPSERV_FUNC(cmd_expire) { next = iter_next(it); if ((unsigned int)(now - bot->last_active) < helpserv_conf.expire_age) continue; - helpserv_unregister(bot, "Registration expired due to inactivity", "HelpServ %s (%s) expired at request of %s.", user->nick); + helpserv_unregister(bot, "Registration expired due to inactivity", "HSMSG_BOT_EXPIRED", user->nick); count++; } helpserv_notice(user, "HSMSG_EXPIRATION_DONE", count); diff --git a/src/nickserv.c b/src/nickserv.c index 19bb174..ccd9748 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -1810,7 +1810,7 @@ static NICKSERV_FUNC(cmd_rename_handle) { struct handle_info *hi; struct userNode *uNode; - char msgbuf[MAXLEN], *old_handle; + char *old_handle; unsigned int nn; NICKSERV_MIN_PARMS(3); @@ -1835,8 +1835,6 @@ static NICKSERV_FUNC(cmd_rename_handle) dict_insert(nickserv_handle_dict, hi->handle, hi); for (nn=0; nnhandle_info->handle, old_handle, hi->handle); - if (nickserv_conf.sync_log) { for (uNode = hi->users; uNode; uNode = uNode->next_authed) @@ -1846,7 +1844,9 @@ static NICKSERV_FUNC(cmd_rename_handle) } reply("NSMSG_HANDLE_CHANGED", old_handle, hi->handle); - global_message(MESSAGE_RECIPIENT_STAFF, msgbuf); + global_message_args(MESSAGE_RECIPIENT_OPERS, "NSMSG_ACCOUNT_RENAMED", + user->handle_info->handle, old_handle, hi->handle); + free(old_handle); return 1; } @@ -3439,7 +3439,6 @@ static NICKSERV_FUNC(cmd_merge) struct userNode *last_user; struct userData *cList, *cListNext; unsigned int ii, jj, n; - char buffer[MAXLEN]; NICKSERV_MIN_PARMS(3); @@ -3550,9 +3549,9 @@ static NICKSERV_FUNC(cmd_merge) hi_to->fakehost = strdup(hi_from->fakehost); /* Notify of success. */ - sprintf(buffer, "%s (%s) merged account %s into %s.", user->nick, user->handle_info->handle, hi_from->handle, hi_to->handle); reply("NSMSG_HANDLES_MERGED", hi_from->handle, hi_to->handle); - global_message(MESSAGE_RECIPIENT_STAFF, buffer); + global_message_args(MESSAGE_RECIPIENT_OPERS, "NSMSG_ACCOUNT_MERGED", user->nick, + user->handle_info->handle, hi_from->handle, hi_to->handle); /* Unregister the "from" handle. */ nickserv_unregister_handle(hi_from, NULL, cmd->parent->bot); diff --git a/src/opserv.c b/src/opserv.c index 3566c9a..64982be 100644 --- a/src/opserv.c +++ b/src/opserv.c @@ -867,9 +867,7 @@ static MODCMD_FUNC(cmd_warn) dict_insert(opserv_chan_warn, strdup(argv[1]), reason); reply("OSMSG_WARN_ADDED", argv[1], reason); if (dict_find(channels, argv[1], NULL)) { - message = alloca(strlen(reason) + strlen(argv[1]) + 55); - sprintf(message, "Channel activity warning for channel %s: %s", argv[1], reason); - global_message(MESSAGE_RECIPIENT_OPERS, message); + global_message_args(MESSAGE_RECIPIENT_OPERS, "OSMSG_CHANNEL_ACTIVITY_WARN" argv[1], reason); } return 1; } @@ -2490,9 +2488,7 @@ opserv_channel_check(struct chanNode *newchan) } /* if ((warning = dict_find(opserv_chan_warn, newchan->name, NULL))) { - char message[MAXLEN]; - snprintf(message, sizeof(message), "Channel activity warning for channel %s: %s", newchan->name, warning); - global_message(MESSAGE_RECIPIENT_OPERS, message); + global_message_args(MESSAGE_RECIPIENT_OPERS, "OSMSG_CHANNEL_ACTIVITY_WARN", newchan->name, warning); } */ diff --git a/src/spamserv.c b/src/spamserv.c index a8e0a8b..0907929 100644 --- a/src/spamserv.c +++ b/src/spamserv.c @@ -316,11 +316,14 @@ spamserv_cs_move_merge(struct userNode *user, struct chanNode *channel, struct c spamserv_part_channel(channel, reason); if(move) - snprintf(reason, sizeof(reason), "$X (channel %s) moved to %s by %s.", channel->name, target->name, user->handle_info->handle); + global_message_args(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, + "SSMSG_CHANNEL_MOVED", channel->name, target->name, + user->handle_info->handle); else - snprintf(reason, sizeof(reason), "$X (channel %s) merged into %s by %s.", channel->name, target->name, user->handle_info->handle); + global_message_args(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, + "SSMSG_CHANNEL_MERGED", channel->name, target->name, + user->handle_info->handle); - global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, reason); return 1; } @@ -334,20 +337,23 @@ spamserv_cs_unregister(struct userNode *user, struct chanNode *channel, enum cs_ if(cInfo) { - char global[MAXLEN], partmsg[MAXLEN]; + char partmsg[MAXLEN]; switch (type) { case manually: - snprintf(global, sizeof(global), "$X (channel %s) %s by %s.", channel->name, reason, user->handle_info->handle); + global_message_args(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, "SSMSG_UNREG_MANUAL", + channel->name, reason, user->handle_info->handle); snprintf(partmsg, sizeof(partmsg), "%s %s by %s.", channel->name, reason, user->handle_info->handle); break; case expire: - snprintf(global, sizeof(global), "$X (channel %s) registration expired.", channel->name); + global_message_args(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, "SSMSG_REG_EXPIRED", + channel->name); snprintf(partmsg, sizeof(partmsg), "%s registration expired.", channel->name); break; case lost_all_users: - snprintf(global, sizeof(global), "$X (channel %s) lost all users.", channel->name); + global_message_args(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, "SSMSG_LOST_ALL_USERS", + channel->name); snprintf(partmsg, sizeof(partmsg), "%s lost all users.", channel->name); break; } @@ -356,7 +362,6 @@ spamserv_cs_unregister(struct userNode *user, struct chanNode *channel, enum cs_ spamserv_part_channel(channel, partmsg); spamserv_unregister_channel(cInfo); - global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, global); } } @@ -1128,7 +1133,6 @@ static SPAMSERV_FUNC(cmd_register) { struct chanInfo *cInfo; - char reason[MAXLEN]; if(!channel || !channel->channel_info) { @@ -1162,8 +1166,8 @@ SPAMSERV_FUNC(cmd_register) spamserv_join_channel(cInfo->channel); - snprintf(reason, sizeof(reason), "%s (channel %s) registered by %s.", spamserv->nick, channel->name, user->handle_info->handle); - global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, reason); + global_message_args(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, "SSMSG_REGISTERED_BY", + channel->name, user->handle_info->handle); ss_reply("SSMSG_REG_SUCCESS", channel->name); return 1; @@ -1212,8 +1216,8 @@ SPAMSERV_FUNC(cmd_unregister) spamserv_unregister_channel(cInfo); - snprintf(reason, sizeof(reason), "%s (channel %s) unregistered by %s.", spamserv->nick, channel->name, user->handle_info->handle); - global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, reason); + global_message_args(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, "SSMSG_UNREGISTERED_BY", + channel->name, user->handle_info->handle); ss_reply("SSMSG_UNREG_SUCCESS", channel->name); return 1;