*
* x3 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
#include "conf.h"
#include "global.h"
+#include "hash.h"
#include "modcmd.h"
#include "nickserv.h"
#include "saxdb.h"
{ "GMSG_MOTD_HEADER", "$bNetwork Announcements$b" },
{ "GMSG_MOTD_BAR", "---------------------------------------" },
{ "GMSG_MOTD_FOOTER", "--------------- Thank You--------------" },
+
+ /* These definitions are for other files that make use of global
+ * notices. Make sure you grep for them if you ever add args
+ * to the notice.
+ */
+ /* chanserv.c */
+ { "CSMSG_REGISTERED_TO", "%s registered to %s by %s." },
+ { "CSMSG_CHANNEL_MOVED", "%s moved to %s by %s." },
+ { "CSMSG_SUSPENSION_MODIFIED", "%s suspension modified by %s." },
+ { "CSMSG_SUSPENDED_BY", "%s suspended by %s." },
+ { "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." },
+ { "HSMSG_SUSPENDED_BY", "%s suspended by %s. (HelpServ)" },
+ { "HSMSG_UNSUSPENDED_BY", "%s unsuspended by %s. (HelpServ)" },
+
+ /* 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 }
};
}
}
+void
+global_message_args(long targets, const char *language_entry, ...)
+{
+ struct globalMessage *message = NULL;
+ va_list arg_list;
+ dict_iterator_t it;
+ char response[MAXLEN];
+ const char *fmt;
+
+ if(!targets || !global)
+ return;
+
+ fmt = strdup(language_entry);
+
+ /* Notice users/opers/helpers */
+ for (it = dict_first(clients); it; it = iter_next(it)) {
+ struct userNode *luser = iter_data(it);
+
+ language_entry = user_find_message(luser, fmt);
+
+ va_start(arg_list, language_entry);
+ vsnprintf(response, MAXLEN-2, language_entry, arg_list);
+ response[MAXLEN-1] = 0;
+
+ if (message)
+ message_del(message);
+
+ message = message_add(targets | MESSAGE_OPTION_SOURCELESS, now, 0, "", response);
+ if (!message)
+ continue;
+
+ /* opers */
+ if(message->flags & MESSAGE_RECIPIENT_OPERS && IsOper(luser)) {
+ if(luser->uplink != self)
+ notice_target(luser->nick, message);
+
+ if ((message->flags & MESSAGE_RECIPIENT_LUSERS) || (message->flags & MESSAGE_RECIPIENT_HELPERS))
+ continue;
+ }
+
+ /* helpers */
+ if (message->flags & MESSAGE_RECIPIENT_HELPERS && IsHelper(luser)) {
+ notice_target(luser->nick, message);
+
+ if (message->flags & MESSAGE_RECIPIENT_LUSERS)
+ continue;
+ }
+
+ /* users */
+ if (message->flags & MESSAGE_RECIPIENT_LUSERS)
+ notice_target(luser->nick, message);
+ }
+
+ message_del(message);
+}
+
void
global_message(long targets, char *text)
{