diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/command.c | 78 | ||||
-rw-r--r-- | src/config.c | 14 | ||||
-rw-r--r-- | src/gui/curses/gui-display.c | 10 | ||||
-rw-r--r-- | src/irc/irc-commands.c | 201 | ||||
-rw-r--r-- | src/irc/irc-server.c | 14 | ||||
-rw-r--r-- | src/weechat.c | 4 | ||||
-rw-r--r-- | src/weechat.h | 1 |
7 files changed, 163 insertions, 159 deletions
diff --git a/src/command.c b/src/command.c index 9eb4c7af5..7af320ac9 100644 --- a/src/command.c +++ b/src/command.c @@ -526,20 +526,18 @@ exec_weechat_command (t_irc_server *server, char *string) if (weechat_commands[i].min_arg == weechat_commands[i].max_arg) gui_printf (NULL, - _("%s wrong argument count for " - WEECHAT_NAME " command '%s' " + _("%s wrong argument count for %s command '%s' " "(expected: %d arg%s)\n"), - WEECHAT_ERROR, + WEECHAT_ERROR, WEECHAT_NAME, command + 1, weechat_commands[i].max_arg, (weechat_commands[i].max_arg > 1) ? "s" : ""); else gui_printf (NULL, - _("%s wrong argument count for " - WEECHAT_NAME " command '%s' " + _("%s wrong argument count for %s command '%s' " "(expected: between %d and %d arg%s)\n"), - WEECHAT_ERROR, + WEECHAT_ERROR, WEECHAT_NAME, command + 1, weechat_commands[i].min_arg, weechat_commands[i].max_arg, @@ -556,8 +554,8 @@ exec_weechat_command (t_irc_server *server, char *string) (ptr_args); if (return_code < 0) gui_printf (NULL, - _("%s " WEECHAT_NAME " command \"%s\" failed\n"), - WEECHAT_ERROR, command + 1); + _("%s %s command \"%s\" failed\n"), + WEECHAT_ERROR, WEECHAT_NAME, command + 1); } if (argv) { @@ -753,8 +751,8 @@ weechat_cmd_alias (char *arguments) pos++; if (!pos[0]) { - gui_printf (NULL, _("%s missing arguments for \"alias\" command\n"), - WEECHAT_ERROR); + gui_printf (NULL, _("%s missing arguments for \"%s\" command\n"), + WEECHAT_ERROR, "alias"); return -1; } index_command_new (arguments); @@ -765,8 +763,8 @@ weechat_cmd_alias (char *arguments) } else { - gui_printf (NULL, _("%s missing arguments for \"alias\" command\n"), - WEECHAT_ERROR); + gui_printf (NULL, _("%s missing arguments for \"%s\" command\n"), + WEECHAT_ERROR, "alias"); return -1; } } @@ -804,8 +802,8 @@ weechat_cmd_clear (int argc, char **argv) else { gui_printf (NULL, - _("unknown parameter \"%s\" for /clear command\n"), - argv[0]); + _("unknown parameter \"%s\" for \"%s\" command\n"), + argv[0], "clear"); return -1; } } @@ -907,7 +905,7 @@ weechat_cmd_help (int argc, char **argv) if (argc == 0) { gui_printf (NULL, - _("> List of " WEECHAT_NAME " internal commands:\n")); + _("> List of %s internal commands:\n"), WEECHAT_NAME); for (i = 0; weechat_commands[i].command_name; i++) gui_printf (NULL, " %s - %s\n", weechat_commands[i].command_name, @@ -927,8 +925,8 @@ weechat_cmd_help (int argc, char **argv) { gui_printf (NULL, - _("> Help on " WEECHAT_NAME " internal command '%s':\n"), - weechat_commands[i].command_name); + _("> Help on %s internal command '%s':\n"), + WEECHAT_NAME, weechat_commands[i].command_name); gui_printf (NULL, _("Syntax: /%s %s\n"), weechat_commands[i].command_name, @@ -1010,12 +1008,12 @@ weechat_cmd_server (int argc, char **argv) irc_display_prefix (NULL, PREFIX_INFO); gui_printf_color (NULL, COLOR_WIN_CHAT, - " Autoconnect: %s\n", + _(" Autoconnect: %s\n"), (ptr_server->autoconnect) ? _("yes") : _("no")); irc_display_prefix (NULL, PREFIX_INFO); gui_printf_color (NULL, COLOR_WIN_CHAT, - " Hostname : %s\n", + _(" Hostname : %s\n"), ptr_server->address); irc_display_prefix (NULL, PREFIX_INFO); gui_printf_color (NULL, @@ -1090,14 +1088,14 @@ weechat_cmd_server (int argc, char **argv) if (argc < 2) { gui_printf (NULL, - _("%s missing servername for \"/server del\" command\n"), - WEECHAT_ERROR); + _("%s missing servername for \"%s\" command\n"), + WEECHAT_ERROR, "server del"); return -1; } if (argc > 2) gui_printf (NULL, - _("%s too much arguments for \"/server del\" command, ignoring arguments\n"), - WEECHAT_WARNING); + _("%s too much arguments for \"%s\" command, ignoring arguments\n"), + WEECHAT_WARNING, "server del"); /* look for server by name */ server_found = NULL; @@ -1113,8 +1111,8 @@ weechat_cmd_server (int argc, char **argv) if (!server_found) { gui_printf (NULL, - _("%s server \"%s\" not found for \"/server del\" command\n"), - WEECHAT_ERROR, argv[1]); + _("%s server \"%s\" not found for \"%s\" command\n"), + WEECHAT_ERROR, argv[1], "server del"); return -1; } @@ -1136,8 +1134,8 @@ weechat_cmd_server (int argc, char **argv) if (argc < 3) { gui_printf (NULL, - _("%s missing parameters for \"/server command\"\n"), - WEECHAT_ERROR); + _("%s missing parameters for \"%s\" command\n"), + WEECHAT_ERROR, "server"); server_destroy (&server); return -1; } @@ -1169,8 +1167,8 @@ weechat_cmd_server (int argc, char **argv) if (i == (argc - 1)) { gui_printf (NULL, - _("%s missing password for \"-pwd\" parameter\n"), - WEECHAT_ERROR); + _("%s missing password for \"%s\" parameter\n"), + WEECHAT_ERROR, "-pwd"); server_destroy (&server); return -1; } @@ -1181,8 +1179,8 @@ weechat_cmd_server (int argc, char **argv) if (i >= (argc - 3)) { gui_printf (NULL, - _("%s missing nick(s) for \"-nicks\" parameter\n"), - WEECHAT_ERROR); + _("%s missing nick(s) for \"%s\" parameter\n"), + WEECHAT_ERROR, "-nicks"); server_destroy (&server); return -1; } @@ -1195,8 +1193,8 @@ weechat_cmd_server (int argc, char **argv) if (i == (argc - 1)) { gui_printf (NULL, - _("%s missing password for \"-username\" parameter\n"), - WEECHAT_ERROR); + _("%s missing password for \"%s\" parameter\n"), + WEECHAT_ERROR, "-username"); server_destroy (&server); return -1; } @@ -1207,8 +1205,8 @@ weechat_cmd_server (int argc, char **argv) if (i == (argc - 1)) { gui_printf (NULL, - _("%s missing password for \"-realname\" parameter\n"), - WEECHAT_ERROR); + _("%s missing password for \"%s\" parameter\n"), + WEECHAT_ERROR, "-realname"); server_destroy (&server); return -1; } @@ -1219,8 +1217,8 @@ weechat_cmd_server (int argc, char **argv) if (i == (argc - 1)) { gui_printf (NULL, - _("%s missing command for \"-command\" parameter\n"), - WEECHAT_ERROR); + _("%s missing command for \"%s\" parameter\n"), + WEECHAT_ERROR, "-command"); server_destroy (&server); return -1; } @@ -1231,8 +1229,8 @@ weechat_cmd_server (int argc, char **argv) if (i == (argc - 1)) { gui_printf (NULL, - _("%s missing password for \"-autojoin\" parameter\n"), - WEECHAT_ERROR); + _("%s missing password for \"%s\" parameter\n"), + WEECHAT_ERROR, "-autojoin"); server_destroy (&server); return -1; } @@ -1356,7 +1354,7 @@ weechat_cmd_set (int argc, char **argv) } } } - gui_printf (NULL, _("(TODO) \"/set\" command not developed!\n")); + gui_printf (NULL, "(TODO) \"/set\" command not developed!\n"); return 0; } diff --git a/src/config.c b/src/config.c index 703e5d4d1..7678a208d 100644 --- a/src/config.c +++ b/src/config.c @@ -935,12 +935,14 @@ config_create_default () return -1; } - printf (_(WEECHAT_NAME ": creating default config file...\n")); + printf (_("%s: creating default config file...\n"), WEECHAT_NAME); log_printf (_("creating default config file\n")); current_time = time (NULL); - sprintf (line, _("#\n# " WEECHAT_NAME " configuration file, created by " - WEECHAT_NAME " " WEECHAT_VERSION " on %s#\n"), ctime (¤t_time)); + sprintf (line, _("#\n# %s configuration file, created by " + "%s v%s on %s#\n"), + WEECHAT_NAME, WEECHAT_NAME, WEECHAT_VERSION, + ctime (¤t_time)); fputs (line, file); for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++) @@ -1070,8 +1072,10 @@ config_write (char *config_name) log_printf (_("saving config to disk\n")); current_time = time (NULL); - sprintf (line, _("#\n# " WEECHAT_NAME " configuration file, created by " - WEECHAT_NAME " " WEECHAT_VERSION " on %s#\n"), ctime (¤t_time)); + sprintf (line, _("#\n# %s configuration file, created by " + "%s v%s on %s#\n"), + WEECHAT_NAME, WEECHAT_NAME, WEECHAT_VERSION, + ctime (¤t_time)); fputs (line, file); for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++) diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c index ac146ccce..b6ee1323f 100644 --- a/src/gui/curses/gui-display.c +++ b/src/gui/curses/gui-display.c @@ -752,6 +752,7 @@ void gui_draw_window_status (t_gui_window *window) { t_gui_window *ptr_win; + char format_more[32]; /* TODO: manage splitted windows! */ if (window != gui_current_window) @@ -853,9 +854,12 @@ gui_draw_window_status (t_gui_window *window) /* display "*MORE*" if last line is not displayed */ gui_window_set_color (window->win_status, COLOR_WIN_STATUS_MORE); if (window->sub_lines > 0) - mvwprintw (window->win_status, 0, COLS - 7, "-MORE-"); + mvwprintw (window->win_status, 0, COLS - 7, _("-MORE-")); else - mvwprintw (window->win_status, 0, COLS - 7, " "); + { + sprintf (format_more, "%%-%ds", strlen (_("-MORE"))); + mvwprintw (window->win_status, 0, COLS - 7, format_more, " "); + } wrefresh (window->win_status); refresh (); @@ -1639,7 +1643,7 @@ gui_new_message (t_gui_window *window) } else { - log_printf ("not enough memory!\n"); + log_printf (_("not enough memory!\n")); return NULL; } return new_message; diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c index 00ef9c7b5..f70bc2730 100644 --- a/src/irc/irc-commands.c +++ b/src/irc/irc-commands.c @@ -331,11 +331,6 @@ irc_recv_command (t_irc_server *server, { int i, cmd_found; - #if DEBUG >= 2 - gui_printf (server->window, "recv_irc_command: cmd=%s args=%s\n", - command, arguments); - #endif - if (command == NULL) return -2; @@ -375,8 +370,8 @@ irc_login (t_irc_server *server) if (!hostname[0]) strcpy (hostname, _("unknown")); gui_printf (server->window, - _(WEECHAT_NAME ": using local hostname \"%s\"\n"), - hostname); + _("%s: using local hostname \"%s\"\n"), + WEECHAT_NAME, hostname); server_sendf (server, "NICK %s\r\n" "USER %s %s %s :%s\r\n", @@ -492,8 +487,8 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv) } else gui_printf (server->window, - _("%s \"deop\" command can only be executed in a channel window\n"), - WEECHAT_ERROR); + _("%s \"%s\" command can only be executed in a channel window\n"), + WEECHAT_ERROR, "deop"); return 0; } @@ -516,8 +511,8 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv) else { gui_printf (server->window, - _("%s \"devoice\" command can only be executed in a channel window\n"), - WEECHAT_ERROR); + _("%s \"%s\" command can only be executed in a channel window\n"), + WEECHAT_ERROR, "devoice"); return -1; } return 0; @@ -565,8 +560,8 @@ irc_cmd_send_kick (t_irc_server *server, char *arguments) else { gui_printf (server->window, - _("%s \"kick\" command can only be executed in a channel window\n"), - WEECHAT_ERROR); + _("%s \"%s\" command can only be executed in a channel window\n"), + WEECHAT_ERROR, "kick"); return -1; } } @@ -608,8 +603,8 @@ irc_cmd_send_me (t_irc_server *server, char *arguments) if (WIN_IS_SERVER(gui_current_window)) { gui_printf (server->window, - _("%s \"me\" command can not be executed on a server window\n"), - WEECHAT_ERROR); + _("%s \"%s\" command can not be executed on a server window\n"), + WEECHAT_ERROR, "me"); return -1; } server_sendf (server, "PRIVMSG %s :\01ACTION %s\01\r\n", @@ -665,8 +660,8 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments) if (WIN_IS_SERVER(gui_current_window)) { gui_printf (server->window, - _("%s \"msg *\" command can not be executed on a server window\n"), - WEECHAT_ERROR); + _("%s \"%s\" command can not be executed on a server window\n"), + WEECHAT_ERROR, "msg *"); return -1; } ptr_channel = CHANNEL(gui_current_window); @@ -681,8 +676,8 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments) } else gui_printf (server->window, - _("%s nick not found for \"msg\" command\n"), - WEECHAT_ERROR); + _("%s nick not found for \"%s\" command\n"), + WEECHAT_ERROR, "msg"); server_sendf (server, "PRIVMSG %s :%s\r\n", ptr_channel->name, pos); } else @@ -703,8 +698,8 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments) } else gui_printf (server->window, - _("%s nick not found for \"msg\" command\n"), - WEECHAT_ERROR); + _("%s nick not found for \"%s\" command\n"), + WEECHAT_ERROR, "msg"); } server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos); } @@ -747,8 +742,8 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments) else { gui_printf (server->window, - _("%s wrong argument count for \"msg\" command\n"), - WEECHAT_ERROR); + _("%s wrong argument count for \"%s\" command\n"), + WEECHAT_ERROR, "msg"); return -1; } return 0; @@ -768,8 +763,8 @@ irc_cmd_send_names (t_irc_server *server, char *arguments) if (!WIN_IS_CHANNEL(gui_current_window)) { gui_printf (server->window, - _("%s \"names\" command can only be executed in a channel window\n"), - WEECHAT_ERROR); + _("%s \"%s\" command can only be executed in a channel window\n"), + WEECHAT_ERROR, "names"); return -1; } else @@ -822,8 +817,8 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv) else { gui_printf (server->window, - _("%s \"op\" command can only be executed in a channel window\n"), - WEECHAT_ERROR); + _("%s \"%s\" command can only be executed in a channel window\n"), + WEECHAT_ERROR, "op"); return -1; } return 0; @@ -871,8 +866,8 @@ irc_cmd_send_part (t_irc_server *server, char *arguments) if (WIN_IS_SERVER(gui_current_window)) { gui_printf (server->window, - _("%s \"part\" command can not be executed on a server window\n"), - WEECHAT_ERROR); + _("%s \"%s\" command can not be executed on a server window\n"), + WEECHAT_ERROR, "part"); return -1; } channel_name = CHANNEL(gui_current_window)->name; @@ -884,8 +879,8 @@ irc_cmd_send_part (t_irc_server *server, char *arguments) if (WIN_IS_SERVER(gui_current_window)) { gui_printf (server->window, - _("%s \"part\" command can not be executed on a server window\n"), - WEECHAT_ERROR); + _("%s \"%s\" command can not be executed on a server window\n"), + WEECHAT_ERROR, "part"); return -1; } if (WIN_IS_PRIVATE(gui_current_window)) @@ -1032,8 +1027,8 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments) if (WIN_IS_SERVER(gui_current_window)) { gui_printf (server->window, - _("%s \"topic\" command can not be executed on a server window\n"), - WEECHAT_ERROR); + _("%s \"%s\" command can not be executed on a server window\n"), + WEECHAT_ERROR, "topic"); return -1; } channel_name = CHANNEL(gui_current_window)->name; @@ -1071,7 +1066,7 @@ irc_cmd_send_version (t_irc_server *server, char *arguments) else { irc_display_prefix (server->window, PREFIX_INFO); - gui_printf (server->window, "%s, compiled on %s %s\n", + gui_printf (server->window, _("%s, compiled on %s %s\n"), WEECHAT_NAME_AND_VERSION, __DATE__, __TIME__); server_sendf (server, "VERSION\r\n"); @@ -1098,8 +1093,8 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv) else { gui_printf (server->window, - _("%s \"voice\" command can only be executed in a channel window\n"), - WEECHAT_ERROR); + _("%s \"%s\" command can only be executed in a channel window\n"), + WEECHAT_ERROR, "voice"); return -1; } return 0; @@ -1259,8 +1254,8 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments) if (!ptr_channel) { gui_printf (server->window, - _("%s channel not found for \"kick\" command\n"), - WEECHAT_ERROR); + _("%s channel not found for \"%s\" command\n"), + WEECHAT_ERROR, "kick"); return -1; } @@ -1291,8 +1286,8 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments) else { gui_printf (server->window, - _("%s nick not found for \"kick\" command\n"), - WEECHAT_ERROR); + _("%s nick not found for \"%s\" command\n"), + WEECHAT_ERROR, "kick"); return -1; } ptr_nick = nick_search (ptr_channel, pos_nick); @@ -1320,8 +1315,8 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments) if (host == NULL) { gui_printf (server->window, - _("%s \"mode\" command received without host\n"), - WEECHAT_ERROR); + _("%s \"%s\" command received without host\n"), + WEECHAT_ERROR, "mode"); return -1; } @@ -1334,8 +1329,8 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments) if (!pos) { gui_printf (server->window, - _("%s \"mode\" command received without channel or nickname\n"), - WEECHAT_ERROR); + _("%s \"%s\" command received without channel or nickname\n"), + WEECHAT_ERROR, "mode"); return -1; } pos[0] = '\0'; @@ -1475,8 +1470,8 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments) else { gui_printf (server->window, - _("%s channel not found for \"mode\" command\n"), - WEECHAT_ERROR); + _("%s channel not found for \"%s\" command\n"), + WEECHAT_ERROR, "mode"); return -1; } } @@ -1504,8 +1499,8 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments) if (host == NULL) { gui_printf (server->window, - _("%s \"nick\" command received without host\n"), - WEECHAT_ERROR); + _("%s \"%s\" command received without host\n"), + WEECHAT_ERROR, "nick"); return -1; } @@ -1586,8 +1581,8 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments) else { gui_printf (server->window, - _("%s nickname not found for \"notice\" command\n"), - WEECHAT_ERROR); + _("%s nickname not found for \"%s\" command\n"), + WEECHAT_ERROR, "notice"); return -1; } irc_display_prefix (server->window, PREFIX_SERVER); @@ -1598,9 +1593,9 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments) if (pos2) pos2[0] = '\0'; gui_printf_color (server->window, COLOR_WIN_CHAT, "CTCP "); - gui_printf_color (server->window, COLOR_WIN_CHAT_CHANNEL, "VERSION"); - gui_printf_color (server->window, COLOR_WIN_CHAT, " reply from "); - gui_printf_color (server->window, COLOR_WIN_CHAT_NICK, "%s", host); + gui_printf_color (server->window, COLOR_WIN_CHAT_CHANNEL, "VERSION "); + gui_printf_color (server->window, COLOR_WIN_CHAT, _("reply from")); + gui_printf_color (server->window, COLOR_WIN_CHAT_NICK, " %s", host); gui_printf_color (server->window, COLOR_WIN_CHAT, ": %s\n", pos); } else @@ -1623,8 +1618,8 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments) if (!host || !arguments) { gui_printf (server->window, - _("%s \"part\" command received without host or channel\n"), - WEECHAT_ERROR); + _("%s \"%s\" command received without host or channel\n"), + WEECHAT_ERROR, "part"); return -1; } @@ -1697,8 +1692,8 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments) else { gui_printf (server->window, - _("%s channel not found for \"part\" command\n"), - WEECHAT_ERROR); + _("%s channel not found for \"%s\" command\n"), + WEECHAT_ERROR, "part"); return -1; } @@ -1738,8 +1733,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments) if (host == NULL) { gui_printf (server->window, - _("%s \"privmsg\" command received without host\n"), - WEECHAT_ERROR); + _("%s \"%s\" command received without host\n"), + WEECHAT_ERROR, "privmsg"); return -1; } @@ -1795,8 +1790,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments) else { gui_printf (server->window, - _("%s nick not found for \"privmsg\" command\n"), - WEECHAT_ERROR); + _("%s nick not found for \"%s\" command\n"), + WEECHAT_ERROR, "privmsg"); return -1; } } @@ -1804,8 +1799,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments) else { gui_printf (server->window, - _("%s channel not found for \"privmsg\" command\n"), - WEECHAT_ERROR); + _("%s channel not found for \"%s\" command\n"), + WEECHAT_ERROR, "privmsg"); return -1; } } @@ -1831,12 +1826,12 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments) buf = (struct utsname *) malloc (sizeof (struct utsname)); uname (buf); server_sendf (server, - "NOTICE %s :\01VERSION " - WEECHAT_NAME " v" - WEECHAT_VERSION " compiled on " __DATE__ - ", \"%s\" running %s %s on a %s\01\r\n", - host, &buf->nodename, &buf->sysname, - &buf->release, &buf->machine); + _("NOTICE %s :%sVERSION %s v%s" + " compiled on %s, host \"%s\" is running " + "%s %s / %s%s"), + host, "\01", WEECHAT_NAME, WEECHAT_VERSION, __DATE__, + &buf->nodename, &buf->sysname, + &buf->release, &buf->machine, "\01\r\n"); free (buf); irc_display_prefix (server->window, PREFIX_INFO); gui_printf_color (server->window, @@ -1887,8 +1882,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments) else { gui_printf (server->window, - _("%s cannot parse \"privmsg\" command\n"), - WEECHAT_ERROR); + _("%s cannot parse \"%s\" command\n"), + WEECHAT_ERROR, "privmsg"); return -1; } } @@ -1910,8 +1905,8 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments) if (host == NULL) { gui_printf (server->window, - _("%s \"quit\" command received without host\n"), - WEECHAT_ERROR); + _("%s \"%s\" command received without host\n"), + WEECHAT_ERROR, "quit"); return -1; } @@ -1940,11 +1935,11 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments) gui_printf_color (ptr_channel->window, COLOR_WIN_CHAT_HOST, "%s", pos + 1); gui_printf_color (ptr_channel->window, - COLOR_WIN_CHAT_DARK, ")"); + COLOR_WIN_CHAT_DARK, ") "); gui_printf_color (ptr_channel->window, - COLOR_WIN_CHAT, _(" has quit ")); + COLOR_WIN_CHAT, _("has quit")); gui_printf_color (ptr_channel->window, - COLOR_WIN_CHAT_DARK, "("); + COLOR_WIN_CHAT_DARK, " ("); gui_printf_color (ptr_channel->window, COLOR_WIN_CHAT, "%s", arguments); @@ -2062,8 +2057,8 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments) if (!string_is_channel (arguments)) { gui_printf (server->window, - _("%s \"topic\" command received without channel\n"), - WEECHAT_ERROR); + _("%s \"%s\" command received without channel\n"), + WEECHAT_ERROR, "topic"); return -1; } @@ -2122,7 +2117,7 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments) } /* - * irc_cmd_recv_004: '004' command (connected to irc server ?????) + * irc_cmd_recv_004: '004' command (connected to irc server) */ int @@ -2766,8 +2761,8 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments) else { gui_printf (server->window, - _("%s channel not found for \"332\" command\n"), - WEECHAT_ERROR); + _("%s channel not found for \"%s\" command\n"), + WEECHAT_ERROR, "332"); return -1; } } @@ -2775,8 +2770,8 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments) else { gui_printf (server->window, - _("%s cannot identify channel for \"332\" command\n"), - WEECHAT_ERROR); + _("%s cannot identify channel for \"%s\" command\n"), + WEECHAT_ERROR, "332"); return -1; } return 0; @@ -2831,32 +2826,32 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments) else { gui_printf (server->window, - _("%s channel not found for \"333\" command\n"), - WEECHAT_ERROR); + _("%s channel not found for \"%s\" command\n"), + WEECHAT_ERROR, "333"); return -1; } } else { gui_printf (server->window, - _("%s cannot identify date/time for \"333\" command\n"), - WEECHAT_ERROR); + _("%s cannot identify date/time for \"%s\" command\n"), + WEECHAT_ERROR, "333"); return -1; } } else { gui_printf (server->window, - _("%s cannot identify nickname for \"333\" command\n"), - WEECHAT_ERROR); + _("%s cannot identify nickname for \"%s\" command\n"), + WEECHAT_ERROR, "333"); return -1; } } else { gui_printf (server->window, - _("%s cannot identify channel for \"333\" command\n"), - WEECHAT_ERROR); + _("%s cannot identify channel for \"%s\" command\n"), + WEECHAT_ERROR, "333"); return -1; } return 0; @@ -2931,8 +2926,8 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments) if (pos[0] != ':') { gui_printf (server->window, - _("%s cannot parse \"353\" command\n"), - WEECHAT_ERROR); + _("%s cannot parse \"%s\" command\n"), + WEECHAT_ERROR, "353"); return -1; } pos++; @@ -2971,8 +2966,8 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments) else { gui_printf (server->window, - _("%s cannot parse \"353\" command\n"), - WEECHAT_ERROR); + _("%s cannot parse \"%s\" command\n"), + WEECHAT_ERROR, "353"); return -1; } return 0; @@ -3113,10 +3108,9 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments) if (strcmp (server->nick, server->nick1) == 0) { gui_printf (server->window, - _(WEECHAT_NAME - ": nickname \"%s\" is already in use, " + _("%s: nickname \"%s\" is already in use, " "trying 2nd nickname \"%s\"\n"), - server->nick, server->nick2); + WEECHAT_NAME, server->nick, server->nick2); free (server->nick); server->nick = strdup (server->nick2); } @@ -3125,19 +3119,18 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments) if (strcmp (server->nick, server->nick2) == 0) { gui_printf (server->window, - _(WEECHAT_NAME - ": nickname \"%s\" is already in use, " + _("%s: nickname \"%s\" is already in use, " "trying 3rd nickname \"%s\"\n"), - server->nick, server->nick3); + WEECHAT_NAME, server->nick, server->nick3); free (server->nick); server->nick = strdup (server->nick3); } else { gui_printf (server->window, - _(WEECHAT_NAME - ": all declared nicknames are already in use, " - "closing connection with server!\n")); + _("%s: all declared nicknames are already in use, " + "closing connection with server!\n"), + WEECHAT_NAME); server_disconnect (server); return 0; } diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c index d84956ef0..acc6f5a88 100644 --- a/src/irc/irc-server.c +++ b/src/irc/irc-server.c @@ -95,7 +95,7 @@ server_alloc () /* alloc memory for new server */ if ((new_server = (t_irc_server *) malloc (sizeof (t_irc_server))) == NULL) { - fprintf (stderr, _("%s cannot allocate new server"), WEECHAT_ERROR); + fprintf (stderr, _("%s cannot allocate new server\n"), WEECHAT_ERROR); return NULL; } @@ -479,9 +479,9 @@ server_connect (t_irc_server *server) int server_pipe[2]; gui_printf (server->window, - _(WEECHAT_NAME ": connecting to %s:%d...\n"), - server->address, server->port); - log_printf ("connecting to server %s:%d...\n", + _("%s: connecting to %s:%d...\n"), + WEECHAT_NAME, server->address, server->port); + log_printf (_("connecting to server %s:%d...\n"), server->address, server->port); server->is_connected = 0; @@ -503,7 +503,7 @@ server_connect (t_irc_server *server) (server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set, sizeof (set)) == -1) gui_printf (server->window, - _("%s cannot set socket option 'SO_REUSEADDR'\n"), + _("%s cannot set socket option \"SO_REUSEADDR\"\n"), WEECHAT_ERROR); set = 1; if (setsockopt @@ -551,7 +551,7 @@ server_connect (t_irc_server *server) /* connection to server */ gui_printf (server->window, - _(WEECHAT_NAME ": server IP is: %s\n"), ip_address); + _("%s: server IP is: %s\n"), WEECHAT_NAME, ip_address); error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr)); if (error != 0) @@ -585,7 +585,7 @@ server_disconnect (t_irc_server *server) ptr_channel = ptr_channel->next_channel) { irc_display_prefix (ptr_channel->window, PREFIX_INFO); - gui_printf (ptr_channel->window, "Disconnected from server!\n"); + gui_printf (ptr_channel->window, _("Disconnected from server!\n")); } /* close communication with server */ diff --git a/src/weechat.c b/src/weechat.c index b04549482..8ced99156 100644 --- a/src/weechat.c +++ b/src/weechat.c @@ -227,6 +227,10 @@ main (int argc, char *argv[]) { t_irc_server *ptr_server; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, "/usr/share/locale"); + textdomain (PACKAGE); + /* initialize variables */ wee_init_vars (); diff --git a/src/weechat.h b/src/weechat.h index 32dab0a54..6754b00b2 100644 --- a/src/weechat.h +++ b/src/weechat.h @@ -27,6 +27,7 @@ #include <locale.h> #include <libintl.h> +#define PACKAGE "weechat" #define _(string) gettext(string) #define N_(string) (string) |