* Fix typos in several message strings, and clarify others.
* Typecast first argument of gethostbyaddr() to quash warnings.
* Load languages in finalization, not initialization, and do not crash
when running off the end of a localized strings.db file.
* Show the LANGUAGE option in NickServ SET response.
* Remove mention of GHOST command when !enable_ghost.
* Only initialize alloc_argc when !defined(NDEBUG)
git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-31
{ "CSMSG_MODE_LOCKED", "Modes conflicting with $b%s$b are not allowed in %s." },
{ "CSMSG_CANNOT_SET", "That setting is above your current level, so you cannot change it." },
{ "CSMSG_OWNER_DEFAULTS", "You must have access 500 in %s to reset it to the default options." },
- { "CSMSG_CONFIRM_DEFAULTS", "To reset %s's settings to the defaults, you muse use 'set defaults %s'." },
+ { "CSMSG_CONFIRM_DEFAULTS", "To reset %s's settings to the defaults, you must use 'set defaults %s'." },
{ "CSMSG_SETTINGS_DEFAULTED", "All settings for %s have been reset to default values." },
{ "CSMSG_BAD_SETLEVEL", "You cannot change any setting to above your level." },
{ "CSMSG_BAD_GIVEVOICE", "You cannot change GiveVoice to above GiveOps (%d)." },
{ "CSMSG_CTCPREACTION_LONGBAN", "Long timed ban on disallowed CTCPs" },
{ "CSMSG_INVITED_USER", "Invited $b%s$b to join %s." },
- { "CSMSG_INVITING_YOU", "$b%s$b invites you to join %s%s%s" },
- { "CSMSG_ALREADY_PRESENT", "%s is $balready in %s$b." },
+ { "CSMSG_INVITING_YOU_REASON", "$b%s$b invites you to join %s: %s" },
+ { "CSMSG_INVITING_YOU", "$b%s$b invites you to join %s." },
+ { "CSMSG_ALREADY_PRESENT", "%s is already in $b%s$b." },
{ "CSMSG_YOU_ALREADY_PRESENT", "You are already in $b%s$b." },
{ "CSMSG_LOW_CHANNEL_ACCESS", "You lack sufficient access in %s to use this command." },
if(user != invite)
{
- char *reason = (argc > 2) ? unsplit_string(argv + 2, argc - 2, NULL) : "";
- send_message(invite, chanserv, "CSMSG_INVITING_YOU", user->nick, channel->name, (argc > 2) ? ": " : ".", reason);
+ if(argc > 2)
+ {
+ char *reason = unsplit_string(argv + 2, argc - 2, NULL);
+ send_message(invite, chanserv, "CSMSG_INVITING_YOU_REASON", user->nick, channel->name, reason);
+ }
+ else
+ send_message(invite, chanserv, "CSMSG_INVITING_YOU", user->nick, channel->name);
}
irc_invite(chanserv, invite, channel);
if(argc > 1)
struct in_addr in;
struct hostent *he;
if (inet_aton(hostname+1, &in)
- && (he = gethostbyaddr(&in, sizeof(in), AF_INET))) {
+ && (he = gethostbyaddr((char*)&in, sizeof(in), AF_INET))) {
res = malloc((hostname - target) + 2 + strlen(he->h_name));
sprintf(res, "%.*s@%s", hostname - target, target, he->h_name);
return res;
{
struct language *lang = calloc(1, sizeof(*lang));
lang->name = strdup(name);
+ lang->parent = language_find("C");
if (!languages) {
languages = dict_new();
dict_set_free_data(languages, language_free);
{
dict_iterator_t it, it2;
struct record_data *rd;
- const char *msgid;
char *msg;
- int diff, extra, missing;
+ int extra, missing;
extra = missing = 0;
- for (it = dict_first(dict), it2 = dict_first(lang_C->messages); it || it2; ) {
- msgid = iter_key(it);
- if (it && it2)
- diff = irccasecmp(msgid, iter_key(it2));
- else if (it)
- diff = -1;
- else
- diff = 1;
+ for (it = dict_first(dict), it2 = dict_first(lang_C->messages); it; ) {
+ const char *msgid = iter_key(it);
+ int diff = it2 ? irccasecmp(msgid, iter_key(it2)) : -1;
if (diff < 0) {
extra++;
it = iter_next(it);
it2 = iter_next(it2);
continue;
}
- msgid = iter_key(it);
rd = iter_data(it);
switch (rd->type) {
case RECDB_QSTRING:
log_module(MAIN_LOG, LOG_WARNING, "Unsupported record type for message %s in language %s", msgid, lang->name);
continue;
}
- dict_insert(lang->messages, iter_key(it2), msg);
+ dict_insert(lang->messages, msgid, msg);
it = iter_next(it);
it2 = iter_next(it2);
}
+ while (it2) {
+ missing++;
+ it2 = iter_next(it2);
+ }
log_module(MAIN_LOG, LOG_WARNING, "In language %s, %d extra and %d missing messages", lang->name, extra, missing);
}
return lang;
}
+static void language_read_list(void)
+{
+ struct dirent *dirent;
+ DIR *dir;
+
+ if (!(dir = opendir("languages")))
+ return;
+ while ((dirent = readdir(dir)))
+ language_alloc(dirent->d_name);
+ closedir(dir);
+}
+
static void language_read_all(void)
{
struct string_list *slist;
void helpfile_init(void)
{
message_register_table(msgtab);
+ language_read_list();
+}
+
+void helpfile_finalize(void)
+{
language_read_all();
reg_exit_func(language_cleanup);
}
#define handle_find_message(HANDLE, MSGID) language_find_message((HANDLE) ? (HANDLE)->language : lang_C, (MSGID))
#define user_find_message(USER, MSGID) language_find_message((USER)->handle_info ? (USER)->handle_info->language : lang_C, (MSGID))
void helpfile_init(void);
+void helpfile_finalize(void);
struct helpfile *open_helpfile(const char *fname, expand_func_t expand);
void close_helpfile(struct helpfile *hf);
{ "MSG_COMMAND_PRIVILEGED", "$b%s$b is a privileged command." },
{ "MSG_COMMAND_DISABLED", "$b%s$b is a disabled command." },
{ "MSG_SETTING_PRIVILEGED", "$b%s$b is a privileged setting." },
- { "MSG_REGISTER_HANDLE", "You must first register a account with $b$N$b." },
{ "MSG_AUTHENTICATE", "You must first authenticate with $b$N$b." },
{ "MSG_USER_AUTHENTICATE", "%s must first authenticate with $b$N$b." },
{ "MSG_SET_EMAIL_ADDR", "You must first set your account's email address. (Contact network staff if you cannot auth to your account.)" },
message_register_table(msgtab);
modcmd_finalize();
saxdb_finalize();
+ helpfile_finalize();
modules_finalize();
/* The first exit func to be called *should* be saxdb_write_all(). */
static struct modcmd *bind_command, *help_command, *version_command;
static const struct message_entry msgtab[] = {
{ "MCMSG_VERSION", "$b"PACKAGE_STRING"$b ("CODENAME"), Built: " __DATE__ ", " __TIME__"." },
- { "MCMSG_BARE_FLAG", "Flag %.*s must be preceeded by a + or -." },
+ { "MCMSG_BARE_FLAG", "Flag %.*s must be preceded by a + or -." },
{ "MCMSG_UNKNOWN_FLAG", "Unknown module flag %.*s." },
{ "MCMSG_BAD_OPSERV_LEVEL", "Invalid $O access level %s." },
{ "MCMSG_BAD_CHANSERV_LEVEL", "Invalid $C access level %s." },
{ "NSEMAIL_EMAIL_CHANGE_BODY_NEW", "This email has been sent to verify that your email address belongs to the same person as account %5$s on %1$s. The SECOND HALF of your cookie is %2$.*6$s.\nTo verify your address as associated with this account, log on to %1$s and type the following command:\n /msg %3$s@%4$s COOKIE %5$s ?????%2$.*6$s\n(Replace the ????? with the FIRST HALF of the cookie, as sent to your OLD email address.)\nIf you did NOT request this email address to be associated with this account, you do not need to do anything. Please contact the %1$s staff if you have questions." },
{ "NSEMAIL_EMAIL_CHANGE_BODY_OLD", "This email has been sent to verify that you want to change your email for account %5$s on %1$s from this address to %7$s. The FIRST HALF of your cookie is %2$.*6$s\nTo verify your new address as associated with this account, log on to %1$s and type the following command:\n /msg %3$s@%4$s COOKIE %5$s %2$.*6$s?????\n(Replace the ????? with the SECOND HALF of the cookie, as sent to your NEW email address.)\nIf you did NOT request this change of email address, you do not need to do anything. Please contact the %1$s staff if you have questions." },
{ "NSEMAIL_EMAIL_VERIFY_SUBJECT", "Email address verification for %s" },
- { "NSEMAIL_EMAIL_VERIFY_BODY", "This email has been sent to verify that this address belongs to the same person as %5$s on %1$s. Your cookie is %2$s.\nTo verify your address as associated with this account, log on to %1$s and type the following command:\n /msg %3$s@%4$s COOKIE %5$s %1$s\nIf you did NOT request this email address to be associated with this account, you do not need to do anything. Please contact the %1$s staff if you have questions." },
+ { "NSEMAIL_EMAIL_VERIFY_BODY", "This email has been sent to verify that this address belongs to the same person as %5$s on %1$s. Your cookie is %2$s.\nTo verify your address as associated with this account, log on to %1$s and type the following command:\n /msg %3$s@%4$s COOKIE %5$s %2$s\nIf you did NOT request this email address to be associated with this account, you do not need to do anything. Please contact the %1$s staff if you have questions." },
{ "NSEMAIL_ALLOWAUTH_SUBJECT", "Authentication allowed for %s" },
{ "NSEMAIL_ALLOWAUTH_BODY", "This email has been sent to let you authenticate (auth) to account %5$s on %1$s. Your cookie is %2$s.\nTo auth to that account, log on to %1$s and type the following command:\n /msg %3$s@%4$s COOKIE %5$s %1$s\nIf you did NOT request this authorization, you do not need to do anything. Please contact the %1$s staff if you have questions." },
{ "CHECKPASS_YES", "Yes." },
unsigned int i;
char *set_display[] = {
"INFO", "WIDTH", "TABLEWIDTH", "COLOR", "PRIVMSG", "STYLE",
- "EMAIL", "ANNOUNCEMENTS", "MAXLOGINS"
+ "EMAIL", "ANNOUNCEMENTS", "MAXLOGINS", "LANGUAGE"
};
send_message(user, nickserv, "NSMSG_SETTING_LIST");
" SET Set per-account options.",
" UNREGISTER Unregister an account.",
" RENAME Renames an account",
- " GHOST Disconnects your old clients",
" ACCOUNT FLAGS Definition for each account flag"
);
};
else
res = calloc(1, sizeof(*res));
if (res) {
+#if !defined(NDEBUG)
res->alloc_argc = argc;
+#endif
res->argc = argc;
}
return res;