diff options
Diffstat (limited to 'src')
65 files changed, 223 insertions, 175 deletions
diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c index 235a9fc4..8d1ac3eb 100644 --- a/src/core/chat-commands.c +++ b/src/core/chat-commands.c @@ -321,7 +321,7 @@ static void cmd_quit(const char *data) signal_emit("gui exit", 0); } -/* SYNTAX: MSG [-<server tag>] [-channel | -nick] <targets> <message> */ +/* SYNTAX: MSG [-<server tag>] [-channel | -nick] *|<targets> <message> */ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item) { GHashTable *optlist; diff --git a/src/core/commands.h b/src/core/commands.h index c68c5b24..d65185e5 100644 --- a/src/core/commands.h +++ b/src/core/commands.h @@ -158,7 +158,7 @@ char *cmd_get_quoted_param(char **data); /* get parameters from command - you should point free_me somewhere and cmd_params_free() it after you don't use any of the parameters anymore. - Returns TRUE if all ok, FALSE if error occured. */ + Returns TRUE if all ok, FALSE if error occurred. */ int cmd_get_params(const char *data, gpointer *free_me, int count, ...); void cmd_params_free(void *free_me); diff --git a/src/core/expandos.c b/src/core/expandos.c index bed6c5eb..1fc517af 100644 --- a/src/core/expandos.c +++ b/src/core/expandos.c @@ -57,7 +57,7 @@ static char *last_sent_msg, *last_sent_msg_body; static char *last_privmsg_from, *last_public_from; static char *sysname, *sysrelease, *sysarch; -static const char *timestamp_format; +static char *timestamp_format; static int timestamp_seconds; static time_t last_timestamp; @@ -567,7 +567,9 @@ static int sig_timer(void) static void read_settings(void) { - timestamp_format = settings_get_str("timestamp_format"); + g_free_not_null(timestamp_format); + timestamp_format = g_strdup(settings_get_str("timestamp_format")); + timestamp_seconds = strstr(timestamp_format, "%r") != NULL || strstr(timestamp_format, "%s") != NULL || @@ -708,14 +710,18 @@ void expandos_deinit(void) g_free_not_null(char_expandos[n]); g_hash_table_foreach_remove(expandos, free_expando, NULL); - g_hash_table_destroy(expandos); + g_hash_table_destroy(expandos); - g_free_not_null(last_sent_msg); g_free_not_null(last_sent_msg_body); - g_free_not_null(last_privmsg_from); g_free_not_null(last_public_from); - g_free_not_null(sysname); g_free_not_null(sysrelease); - g_free_not_null(sysarch); + g_free_not_null(last_sent_msg); + g_free_not_null(last_sent_msg_body); + g_free_not_null(last_privmsg_from); + g_free_not_null(last_public_from); + g_free_not_null(sysname); + g_free_not_null(sysrelease); + g_free_not_null(sysarch); + g_free_not_null(timestamp_format); - g_source_remove(timer_tag); + g_source_remove(timer_tag); signal_remove("message public", (SIGNAL_FUNC) sig_message_public); signal_remove("message private", (SIGNAL_FUNC) sig_message_private); signal_remove("message own_private", (SIGNAL_FUNC) sig_message_own_private); diff --git a/src/core/log.c b/src/core/log.c index 263b3526..d4d3853e 100644 --- a/src/core/log.c +++ b/src/core/log.c @@ -41,7 +41,7 @@ static const char *log_item_types[] = { NULL }; -const char *log_timestamp; +static char *log_timestamp; static int log_file_create_mode; static int log_dir_create_mode; static int rotate_tag; @@ -558,13 +558,15 @@ static void log_read_config(void) static void read_settings(void) { - log_timestamp = settings_get_str("log_timestamp"); + g_free_not_null(log_timestamp); + log_timestamp = g_strdup(settings_get_str("log_timestamp")); + log_file_create_mode = octal2dec(settings_get_int("log_create_mode")); - log_dir_create_mode = log_file_create_mode; - if (log_file_create_mode & 0400) log_dir_create_mode |= 0100; - if (log_file_create_mode & 0040) log_dir_create_mode |= 0010; - if (log_file_create_mode & 0004) log_dir_create_mode |= 0001; + log_dir_create_mode = log_file_create_mode; + if (log_file_create_mode & 0400) log_dir_create_mode |= 0100; + if (log_file_create_mode & 0040) log_dir_create_mode |= 0010; + if (log_file_create_mode & 0004) log_dir_create_mode |= 0001; } void log_init(void) @@ -595,7 +597,9 @@ void log_deinit(void) while (logs != NULL) log_close(logs->data); + g_free_not_null(log_timestamp); + signal_remove("setup changed", (SIGNAL_FUNC) read_settings); - signal_remove("setup reread", (SIGNAL_FUNC) log_read_config); - signal_remove("irssi init finished", (SIGNAL_FUNC) log_read_config); + signal_remove("setup reread", (SIGNAL_FUNC) log_read_config); + signal_remove("irssi init finished", (SIGNAL_FUNC) log_read_config); } diff --git a/src/core/net-nonblock.h b/src/core/net-nonblock.h index 32cfac70..af5968c8 100644 --- a/src/core/net-nonblock.h +++ b/src/core/net-nonblock.h @@ -29,7 +29,7 @@ int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe, int reverse_lookup); /* Get host's name, call func when finished */ int net_gethostbyaddr_nonblock(IPADDR *ip, NET_HOST_CALLBACK func, void *data); -/* get the resolved IP address. returns -1 if some error occured with read() */ +/* get the resolved IP address. returns -1 if some error occurred with read() */ int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec); /* Connect to server, call func when finished */ diff --git a/src/core/net-sendbuffer.c b/src/core/net-sendbuffer.c index 9d4b0e37..39257486 100644 --- a/src/core/net-sendbuffer.c +++ b/src/core/net-sendbuffer.c @@ -109,7 +109,7 @@ static int buffer_add(NET_SENDBUF_REC *rec, const void *data, int size) /* Send data, if all of it couldn't be sent immediately, it will be resent automatically after a while. Returns -1 if some unrecoverable error - occured. */ + occurred. */ int net_sendbuffer_send(NET_SENDBUF_REC *rec, const void *data, int size) { int ret; diff --git a/src/core/net-sendbuffer.h b/src/core/net-sendbuffer.h index 785f59ae..bdeb7156 100644 --- a/src/core/net-sendbuffer.h +++ b/src/core/net-sendbuffer.h @@ -24,7 +24,7 @@ void net_sendbuffer_destroy(NET_SENDBUF_REC *rec, int close); /* Send data, if all of it couldn't be sent immediately, it will be resent automatically after a while. Returns -1 if some unrecoverable error - occured. */ + occurred. */ int net_sendbuffer_send(NET_SENDBUF_REC *rec, const void *data, int size); int net_sendbuffer_receive_line(NET_SENDBUF_REC *rec, char **str, int read_socket); diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c index 768fd540..e16403ec 100644 --- a/src/core/network-openssl.c +++ b/src/core/network-openssl.c @@ -475,7 +475,7 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_ g_error("Could not allocate memory for SSL context"); return NULL; } - SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2); + SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); SSL_CTX_set_default_passwd_cb(ctx, get_pem_password_callback); SSL_CTX_set_default_passwd_cb_userdata(ctx, (void *)mypass); diff --git a/src/core/network.c b/src/core/network.c index 3659ab36..bfaa47fb 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -624,7 +624,7 @@ const char *net_gethosterror(int error) int net_hosterror_notfound(int error) { #ifdef HAVE_IPV6 -#ifdef EAI_NODATA /* NODATA is depricated */ +#ifdef EAI_NODATA /* NODATA is deprecated */ return error != 1 && (error == EAI_NONAME || error == EAI_NODATA); #else return error != 1 && (error == EAI_NONAME); diff --git a/src/core/nicklist.c b/src/core/nicklist.c index a5f25f34..b1c9ecef 100644 --- a/src/core/nicklist.c +++ b/src/core/nicklist.c @@ -342,7 +342,7 @@ GSList *nicklist_get_same_unique(SERVER_REC *server, void *id) return rec.list; } -/* nick record comparision for sort functions */ +/* nick record comparison for sort functions */ int nicklist_compare(NICK_REC *p1, NICK_REC *p2, const char *nick_prefix) { int i; diff --git a/src/core/query-rec.h b/src/core/query-rec.h index fc08d2ef..59519ad4 100644 --- a/src/core/query-rec.h +++ b/src/core/query-rec.h @@ -7,5 +7,5 @@ char *server_tag; time_t last_unread_msg; unsigned int unwanted:1; /* TRUE if the other side closed or - some error occured (DCC chats!) */ + some error occurred (DCC chats!) */ unsigned int destroying:1; diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c index 0a08b461..d99a5405 100644 --- a/src/core/servers-reconnect.c +++ b/src/core/servers-reconnect.c @@ -253,6 +253,9 @@ static void sig_reconnect(SERVER_REC *server) conn->port = server->connrec->port; conn->password = g_strdup(server->connrec->password); + if (strchr(conn->address, '/') != NULL) + conn->unix_socket = TRUE; + server_reconnect_add(conn, (server->connect_time == 0 ? time(NULL) : server->connect_time) + reconnect_time); server_connect_unref(conn); diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index 0819ff1a..27d9f1f0 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -122,6 +122,9 @@ static void server_setup_fill(SERVER_CONNECT_REC *conn, conn->address = g_strdup(address); if (port > 0) conn->port = port; + if (strchr(address, '/') != NULL) + conn->unix_socket = TRUE; + if (!conn->nick) conn->nick = g_strdup(settings_get_str("nick")); conn->username = g_strdup(settings_get_str("user_name")); conn->realname = g_strdup(settings_get_str("real_name")); diff --git a/src/core/servers.c b/src/core/servers.c index 06f82d4d..6eaad191 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -218,9 +218,7 @@ static void server_real_connect(SERVER_REC *server, IPADDR *ip, return; if (ip != NULL) { - own_ip = ip == NULL ? NULL : - (IPADDR_IS_V6(ip) ? server->connrec->own_ip6 : - server->connrec->own_ip4); + own_ip = IPADDR_IS_V6(ip) ? server->connrec->own_ip6 : server->connrec->own_ip4; port = server->connrec->proxy != NULL ? server->connrec->proxy_port : server->connrec->port; handle = server->connrec->use_ssl ? diff --git a/src/fe-common/core/chat-completion.c b/src/fe-common/core/chat-completion.c index d3e018ad..c37c77cd 100644 --- a/src/fe-common/core/chat-completion.c +++ b/src/fe-common/core/chat-completion.c @@ -40,7 +40,7 @@ static int keep_privates_count, keep_publics_count; static int completion_lowercase; -static const char *completion_char, *cmdchars; +static char *completion_char, *cmdchars; static GSList *global_lastmsgs; static int completion_auto, completion_strict; @@ -574,7 +574,7 @@ GList *completion_get_aliases(const char *word) list = g_list_append(list, g_strdup(node->key)); } - + return list; } @@ -781,7 +781,7 @@ GList *completion_get_servers(const char *word) for (tmp = setupservers; tmp != NULL; tmp = tmp->next) { SERVER_SETUP_REC *rec = tmp->data; - if (g_ascii_strncasecmp(rec->address, word, len) == 0) + if (g_ascii_strncasecmp(rec->address, word, len) == 0) list = g_list_append(list, g_strdup(rec->address)); } @@ -814,12 +814,12 @@ GList *completion_get_targets(const char *word) list = g_list_append(list, g_strdup(node->key)); } - + return list; } static void sig_complete_connect(GList **list, WINDOW_REC *window, - const char *word, const char *line, + const char *word, const char *line, int *want_space) { g_return_if_fail(list != NULL); @@ -895,7 +895,7 @@ static void sig_complete_alias(GList **list, WINDOW_REC *window, int *want_space) { const char *definition; - + g_return_if_fail(list != NULL); g_return_if_fail(word != NULL); g_return_if_fail(line != NULL); @@ -905,7 +905,7 @@ static void sig_complete_alias(GList **list, WINDOW_REC *window, *list = g_list_append(NULL, g_strdup(definition)); signal_stop(); } - } else { + } else { *list = completion_get_aliases(word); if (*list != NULL) signal_stop(); } @@ -965,7 +965,7 @@ static void sig_complete_target(GList **list, WINDOW_REC *window, int *want_space) { const char *definition; - + g_return_if_fail(list != NULL); g_return_if_fail(word != NULL); g_return_if_fail(line != NULL); @@ -975,7 +975,7 @@ static void sig_complete_target(GList **list, WINDOW_REC *window, *list = g_list_append(NULL, g_strdup(definition)); signal_stop(); } - } else { + } else { *list = completion_get_targets(word); if (*list != NULL) signal_stop(); } @@ -1126,11 +1126,16 @@ static void read_settings(void) keep_privates_count = settings_get_int("completion_keep_privates"); keep_publics_count = settings_get_int("completion_keep_publics"); completion_lowercase = settings_get_bool("completion_nicks_lowercase"); - completion_char = settings_get_str("completion_char"); - cmdchars = settings_get_str("cmdchars"); + completion_auto = settings_get_bool("completion_auto"); completion_strict = settings_get_bool("completion_strict"); + g_free_not_null(completion_char); + completion_char = g_strdup(settings_get_str("completion_char")); + + g_free_not_null(cmdchars); + cmdchars = g_strdup(settings_get_str("cmdchars")); + if (*completion_char == '\0') { /* this would break.. */ completion_auto = FALSE; @@ -1220,4 +1225,7 @@ void chat_completion_deinit(void) signal_remove("server disconnected", (SIGNAL_FUNC) sig_server_disconnected); signal_remove("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed); signal_remove("setup changed", (SIGNAL_FUNC) read_settings); + + g_free_not_null(completion_char); + g_free_not_null(cmdchars); } diff --git a/src/fe-common/core/command-history.c b/src/fe-common/core/command-history.c index afe19aa7..37405c43 100644 --- a/src/fe-common/core/command-history.c +++ b/src/fe-common/core/command-history.c @@ -45,7 +45,7 @@ void command_history_add(HISTORY_REC *history, const char *text) if (link != NULL && strcmp(link->data, text) == 0) return; /* same as previous entry */ - if (settings_get_int("max_command_history") < 1 || + if (settings_get_int("max_command_history") < 1 || history->lines < settings_get_int("max_command_history")) history->lines++; else { @@ -78,12 +78,12 @@ HISTORY_REC *command_history_find_name(const char *name) for (tmp = histories; tmp != NULL; tmp = tmp->next) { HISTORY_REC *rec = tmp->data; - + if (rec->name != NULL && g_ascii_strcasecmp(rec->name, name) == 0) return rec; } - + return NULL; } @@ -135,7 +135,7 @@ const char *command_history_next(WINDOW_REC *window, const char *text) GList *pos; history = command_history_current(window); - pos = history->pos; + pos = history->pos; if (pos != NULL) history->pos = history->pos->next; @@ -160,21 +160,21 @@ void command_history_clear_pos_func(HISTORY_REC *history, gpointer user_data) void command_history_clear_pos(WINDOW_REC *window) { - g_slist_foreach(histories, + g_slist_foreach(histories, (GFunc) command_history_clear_pos_func, NULL); } HISTORY_REC *command_history_create(const char *name) { HISTORY_REC *rec; - + rec = g_new0(HISTORY_REC, 1); - + if (name != NULL) rec->name = g_strdup(name); histories = g_slist_append(histories, rec); - + return rec; } diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c index 75147fdb..aefd1034 100644 --- a/src/fe-common/core/fe-channels.c +++ b/src/fe-common/core/fe-channels.c @@ -403,7 +403,7 @@ static void display_sorted_nicks(CHANNEL_REC *channel, GSList *nicklist) nickmode[0] = rec->prefixes[0]; else nickmode[0] = ' '; - + if (linebuf_size < columns[col]-item_extra+1) { linebuf_size = (columns[col]-item_extra+1)*2; linebuf = g_realloc(linebuf, linebuf_size); diff --git a/src/fe-common/core/fe-ignore.c b/src/fe-common/core/fe-ignore.c index 96242f9e..1a0b8339 100644 --- a/src/fe-common/core/fe-ignore.c +++ b/src/fe-common/core/fe-ignore.c @@ -65,7 +65,7 @@ static void ignore_print(int index, IGNORE_REC *rec) } if (rec->fullword) g_string_append(options, "-full "); if (rec->replies) g_string_append(options, "-replies "); - if (rec->servertag != NULL) + if (rec->servertag != NULL) g_string_append_printf(options, "-network %s ", rec->servertag); if (rec->pattern != NULL) g_string_append_printf(options, "-pattern %s ", rec->pattern); @@ -137,7 +137,7 @@ static void cmd_ignore(const char *data) /* Allow -ircnet for backwards compatibility */ if (!servertag) servertag = g_hash_table_lookup(optlist, "ircnet"); - + if (*mask == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); if (*levels == '\0') levels = "ALL"; level = level2bits(levels, NULL); diff --git a/src/fe-common/core/fe-log.c b/src/fe-common/core/fe-log.c index 5ee72d8b..9d68faf9 100644 --- a/src/fe-common/core/fe-log.c +++ b/src/fe-common/core/fe-log.c @@ -43,11 +43,11 @@ static int autolog_level; static int autoremove_tag; -static const char *autolog_path; +static char *autolog_path; static THEME_REC *log_theme; static int skip_next_printtext; -static const char *log_theme_name; +static char *log_theme_name; static int log_dir_create_mode; @@ -675,9 +675,11 @@ static void sig_theme_destroyed(THEME_REC *theme) static void read_settings(void) { int old_autolog = autolog_level; - int log_file_create_mode; + int log_file_create_mode; + + g_free_not_null(autolog_path); + autolog_path = g_strdup(settings_get_str("autolog_path")); - autolog_path = settings_get_str("autolog_path"); autolog_level = !settings_get_bool("autolog") ? 0 : settings_get_level("autolog_level"); @@ -687,9 +689,14 @@ static void read_settings(void) /* write to log files with different theme? */ if (log_theme_name != NULL) signal_remove("print format", (SIGNAL_FUNC) sig_print_format); - log_theme_name = settings_get_str("log_theme"); - if (*log_theme_name == '\0') + + g_free_not_null(log_theme_name); + log_theme_name = g_strdup(settings_get_str("log_theme")); + + if (*log_theme_name == '\0') { + g_free(log_theme_name); log_theme_name = NULL; + } else signal_add("print format", (SIGNAL_FUNC) sig_print_format); @@ -752,7 +759,7 @@ void fe_log_deinit(void) { g_source_remove(autoremove_tag); if (log_theme_name != NULL) - signal_remove("print format", (SIGNAL_FUNC) sig_print_format); + signal_remove("print format", (SIGNAL_FUNC) sig_print_format); command_unbind("log", (SIGNAL_FUNC) cmd_log); command_unbind("log open", (SIGNAL_FUNC) cmd_log_open); @@ -776,4 +783,7 @@ void fe_log_deinit(void) if (autolog_ignore_targets != NULL) g_strfreev(autolog_ignore_targets); + + g_free_not_null(autolog_path); + g_free_not_null(log_theme_name); } diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c index 95d9a9d8..1d44bdd9 100644 --- a/src/fe-common/core/fe-messages.c +++ b/src/fe-common/core/fe-messages.c @@ -92,7 +92,7 @@ char *expand_emphasis(WI_ITEM_REC *item, const char *text) use emphasis on them. */ int found; char c; - char *end2; + char *end2; /* check if _foo_ is a nick */ c = end[1]; @@ -234,7 +234,7 @@ static void sig_message_public(SERVER_REC *server, const char *msg, for_me ? TXT_PUBMSG_ME_CHANNEL : TXT_PUBMSG_CHANNEL, printnick, target, msg, nickmode); - } + } g_free_not_null(nickmode); g_free_not_null(freemsg); @@ -242,13 +242,16 @@ static void sig_message_public(SERVER_REC *server, const char *msg, } static void sig_message_private(SERVER_REC *server, const char *msg, - const char *nick, const char *address) + const char *nick, const char *address, const char *target) { QUERY_REC *query; char *freemsg = NULL; int level = MSGLEVEL_MSGS; - query = query_find(server, nick); + /* own message returned by bouncer? */ + int own = (!strcmp(nick, server->nick)); + + query = query_find(server, own ? target : nick); if (settings_get_bool("emphasis")) msg = freemsg = expand_emphasis((WI_ITEM_REC *) query, msg); @@ -256,9 +259,15 @@ static void sig_message_private(SERVER_REC *server, const char *msg, if (ignore_check(server, nick, address, NULL, msg, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; - printformat(server, nick, level, - query == NULL ? TXT_MSG_PRIVATE : - TXT_MSG_PRIVATE_QUERY, nick, address, msg); + if (own) { + printformat(server, target, level, + query == NULL ? TXT_OWN_MSG_PRIVATE : + TXT_OWN_MSG_PRIVATE_QUERY, target, msg, server->nick); + } else { + printformat(server, nick, level, + query == NULL ? TXT_MSG_PRIVATE : + TXT_MSG_PRIVATE_QUERY, nick, address, msg); + } g_free_not_null(freemsg); } diff --git a/src/fe-common/core/fe-queries.c b/src/fe-common/core/fe-queries.c index 7599fb23..5cdf87ee 100644 --- a/src/fe-common/core/fe-queries.c +++ b/src/fe-common/core/fe-queries.c @@ -326,12 +326,15 @@ static int sig_query_autoclose(void) } static void sig_message_private(SERVER_REC *server, const char *msg, - const char *nick, const char *address) + const char *nick, const char *address, const char *target) { QUERY_REC *query; + /* own message returned by bouncer? */ + int own = (!strcmp(nick, server->nick)); + /* create query window if needed */ - query = privmsg_get_query(server, nick, FALSE, MSGLEVEL_MSGS); + query = privmsg_get_query(server, own ? target : nick, FALSE, MSGLEVEL_MSGS); /* reset the query's last_unread_msg timestamp */ if (query != NULL) diff --git a/src/fe-common/core/fe-windows.c b/src/fe-common/core/fe-windows.c index bf9d7154..1049137f 100644 --- a/src/fe-common/core/fe-windows.c +++ b/src/fe-common/core/fe-windows.c @@ -184,7 +184,7 @@ void window_change_server(WINDOW_REC *window, void *server) if (window->active_server != active) { window->active_server = active; signal_emit("window server changed", 2, window, active); - } + } } void window_set_refnum(WINDOW_REC *window, int refnum) diff --git a/src/fe-common/core/hilight-text.h b/src/fe-common/core/hilight-text.h index d54ec4b5..1692b8ab 100644 --- a/src/fe-common/core/hilight-text.h +++ b/src/fe-common/core/hilight-text.h @@ -42,7 +42,7 @@ HILIGHT_REC *hilight_match(SERVER_REC *server, const char *channel, HILIGHT_REC *hilight_match_nick(SERVER_REC *server, const char *channel, const char *nick, const char *address, int level, const char *msg); - + char *hilight_get_color(HILIGHT_REC *rec); void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec); diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c index a5eaa38f..466a2825 100644 --- a/src/fe-common/core/printtext.c +++ b/src/fe-common/core/printtext.c @@ -170,13 +170,13 @@ static void print_line(TEXT_DEST_REC *dest, const char *text) g_return_if_fail(dest != NULL); g_return_if_fail(text != NULL); - + theme = window_get_theme(dest->window); tmp = format_get_level_tag(theme, dest); str = !theme->info_eol ? format_add_linestart(text, tmp) : format_add_lineend(text, tmp); g_free_not_null(tmp); - + /* send both the formatted + stripped (for logging etc.) */ stripped = strip_codes(str); signal_emit_id(signal_print_text, 3, dest, str, stripped); diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c index d92d23fe..c0741cef 100644 --- a/src/fe-common/core/themes.c +++ b/src/fe-common/core/themes.c @@ -385,7 +385,7 @@ char *theme_format_expand_get(THEME_REC *theme, const char **format) &dummy, &dummy, 0); continue; } - + if (braces == 0) { (*format)++; break; diff --git a/src/fe-common/core/wcwidth.c b/src/fe-common/core/wcwidth.c index 4ebfaca9..80d20fa1 100644 --- a/src/fe-common/core/wcwidth.c +++ b/src/fe-common/core/wcwidth.c @@ -187,7 +187,7 @@ int mk_wcwidth(unichar ucs) /* if we arrive here, ucs is not a combining or C0/C1 control character */ - return 1 + + return 1 + (ucs >= 0x1100 && (ucs <= 0x115f || /* Hangul Jamo init. consonants */ ucs == 0x2329 || ucs == 0x232a || diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index a975fe5c..61357324 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -529,7 +529,7 @@ static void cmd_window_item_goto(const char *data, SERVER_REC *server) GSList *tmp; void *free_arg; char *target; - + if (!cmd_get_params(data, &free_arg, 1, &target)) return; diff --git a/src/fe-common/core/windows-layout.c b/src/fe-common/core/windows-layout.c index 65741a73..54d7dcbf 100644 --- a/src/fe-common/core/windows-layout.c +++ b/src/fe-common/core/windows-layout.c @@ -68,7 +68,7 @@ static void sig_layout_restore_item(WINDOW_REC *window, const char *type, (SIGNAL_FUNC) signal_query_created_curwin); restore_win = window; - + protocol = chat_protocol_find(chat_type); if (protocol == NULL) window_bind_add(window, tag, name); diff --git a/src/fe-common/irc/dcc/fe-dcc-chat-messages.c b/src/fe-common/irc/dcc/fe-dcc-chat-messages.c index 93e10943..45791f56 100644 --- a/src/fe-common/irc/dcc/fe-dcc-chat-messages.c +++ b/src/fe-common/irc/dcc/fe-dcc-chat-messages.c @@ -60,7 +60,7 @@ static void sig_message_dcc_own_action(CHAT_DCC_REC *dcc, const char *msg) format_create_dest_tag(&dest, dcc->server, dcc->servertag, tag, MSGLEVEL_DCCMSGS | MSGLEVEL_ACTIONS | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT, NULL); - + printformat_dest(&dest, query != NULL ? IRCTXT_OWN_DCC_ACTION_QUERY : IRCTXT_OWN_DCC_ACTION, dcc->mynick, dcc->id, msg); g_free(tag); diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index d1cd12d4..d6c02d9f 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -118,7 +118,7 @@ static void event_who(IRC_SERVER_REC *server, const char *data) while (*realname != '\0' && *realname != ' ') realname++; if (*realname == ' ') *realname++ = '\0'; - + recoded = recode_in(SERVER(server), realname, nick); printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_WHO, channel, nick, stat, hops, user, host, recoded, serv); diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c index 765b5340..b380c214 100644 --- a/src/fe-common/irc/fe-irc-commands.c +++ b/src/fe-common/irc/fe-irc-commands.c @@ -115,9 +115,9 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server, if (*target == '\0' || *msg == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - + signal_emit("message irc own_notice", 3, server, msg, target); - + cmd_params_free(free_arg); } diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c index a8d52745..e0849c75 100644 --- a/src/fe-common/irc/fe-irc-messages.c +++ b/src/fe-common/irc/fe-irc-messages.c @@ -87,7 +87,7 @@ static void sig_message_own_public(SERVER_REC *server, const char *msg, g_free(nickmode); signal_stop(); } - + } /* received msg to all ops in channel */ @@ -160,6 +160,7 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg, const char *oldtarget; char *freemsg = NULL; int level; + int own = FALSE; oldtarget = target; target = skip_target(IRC_SERVER(server), target); @@ -174,10 +175,12 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; - if (ischannel(*target)) + if (ischannel(*target)) { item = irc_channel_find(server, target); - else - item = privmsg_get_query(SERVER(server), nick, FALSE, level); + } else { + own = (!strcmp(nick, server->nick)); + item = privmsg_get_query(SERVER(server), own ? nick : target, FALSE, level); + } if (settings_get_bool("emphasis")) msg = freemsg = expand_emphasis(item, msg); @@ -195,13 +198,21 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg, nick, oldtarget, msg); } } else { - /* private action */ - printformat(server, nick, MSGLEVEL_ACTIONS | MSGLEVEL_MSGS, - item == NULL ? IRCTXT_ACTION_PRIVATE : - IRCTXT_ACTION_PRIVATE_QUERY, - nick, address == NULL ? "" : address, msg); + if (own) { + /* own action bounced */ + printformat(server, target, + MSGLEVEL_ACTIONS | MSGLEVEL_MSGS, + item != NULL && oldtarget == target ? IRCTXT_OWN_ACTION : IRCTXT_OWN_ACTION_TARGET, + server->nick, msg, oldtarget); + } else { + /* private action */ + printformat(server, nick, MSGLEVEL_ACTIONS | MSGLEVEL_MSGS, + item == NULL ? IRCTXT_ACTION_PRIVATE : + IRCTXT_ACTION_PRIVATE_QUERY, + nick, address == NULL ? "" : address, msg); + } } - + g_free_not_null(freemsg); } @@ -219,7 +230,7 @@ static void sig_message_irc_notice(SERVER_REC *server, const char *msg, { const char *oldtarget; int level = MSGLEVEL_NOTICES; - + oldtarget = target; target = skip_target(IRC_SERVER(server), target); diff --git a/src/fe-common/irc/fe-irc-server.c b/src/fe-common/irc/fe-irc-server.c index fbfe4d9d..abde1112 100644 --- a/src/fe-common/irc/fe-irc-server.c +++ b/src/fe-common/irc/fe-irc-server.c @@ -63,7 +63,7 @@ static void sig_server_add_fill(IRC_SERVER_SETUP_REC *rec, char *value; value = g_hash_table_lookup(optlist, "network"); - /* For backwards compatibility, also allow the old name 'ircnet'. + /* For backwards compatibility, also allow the old name 'ircnet'. But of course only if -network was not given. */ if (!value) value = g_hash_table_lookup(optlist, "ircnet"); @@ -121,7 +121,7 @@ static void cmd_server_list(const char *data) g_string_append_printf(str, "ssl_cafile: %s, ", rec->ssl_cafile); if (rec->ssl_capath) g_string_append_printf(str, "ssl_capath: %s, ", rec->ssl_capath); - + } if (rec->max_cmds_at_once > 0) g_string_append_printf(str, "cmdmax: %d, ", rec->max_cmds_at_once); diff --git a/src/fe-common/irc/fe-whois.c b/src/fe-common/irc/fe-whois.c index c5726124..a9c3775e 100644 --- a/src/fe-common/irc/fe-whois.c +++ b/src/fe-common/irc/fe-whois.c @@ -92,7 +92,7 @@ static void event_whois_oper(IRC_SERVER_REC *server, const char *data) params = event_get_params(data, 3, NULL, &nick, &type); - /* Bugfix: http://bugs.irssi.org/?do=details&id=99 + /* Bugfix: http://bugs.irssi.org/?do=details&task_id=99 * Author: Geert Hauwaerts <geert@irssi.org> * Date: Wed Sep 15 20:17:24 CEST 2004 */ @@ -409,8 +409,8 @@ void fe_whois_init(void) signal_add("event 311", (SIGNAL_FUNC) event_whois); signal_add("event 312", (SIGNAL_FUNC) event_whois_server); - /* readding this events fixes the printing of /whois -yes * - Bug http://bugs.irssi.org/?do=details&id=123 */ + /* readding this events fixes the printing of /whois -yes * + Bug http://bugs.irssi.org/?do=details&task_id=123 */ signal_add("event 317", (SIGNAL_FUNC) event_whois_idle); signal_add("event 319", (SIGNAL_FUNC) event_whois_channels); signal_add("event 313", (SIGNAL_FUNC) event_whois_oper); diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c index f123ce4c..17a7c507 100644 --- a/src/fe-text/gui-entry.c +++ b/src/fe-text/gui-entry.c @@ -226,8 +226,8 @@ static void gui_entry_draw_from(GUI_ENTRY_REC *entry, int pos) int i; int xpos, end_xpos; - xpos = entry->xpos + entry->promptlen + - pos2scrpos(entry, pos + entry->scrstart) - + xpos = entry->xpos + entry->promptlen + + pos2scrpos(entry, pos + entry->scrstart) - pos2scrpos(entry, entry->scrstart); end_xpos = entry->xpos + entry->width; @@ -730,7 +730,7 @@ void gui_entry_transpose_words(GUI_ENTRY_REC *entry) g_free(second); } - + gui_entry_redraw_from(entry, spos1); gui_entry_fix_cursor(entry); gui_entry_draw(entry); diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c index 337d0739..547d39c9 100644 --- a/src/fe-text/gui-printtext.c +++ b/src/fe-text/gui-printtext.c @@ -120,6 +120,7 @@ void gui_printtext_after_time(TEXT_DEST_REC *dest, LINE_REC *prev, const char *s gui->insert_after_time = time; format_send_to_gui(dest, str); gui->use_insert_after = FALSE; + signal_emit("gui print text after finished", 3, dest->window, gui->insert_after, prev); } void gui_printtext_after(TEXT_DEST_REC *dest, LINE_REC *prev, const char *str) diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c index c0524247..77033d7a 100644 --- a/src/fe-text/irssi.c +++ b/src/fe-text/irssi.c @@ -346,9 +346,9 @@ int main(int argc, char **argv) before this call. locales aren't actually used for anything else than autodetection - of UTF-8 currently.. + of UTF-8 currently.. - furthermore to get the users's charset with g_get_charset() properly + furthermore to get the users's charset with g_get_charset() properly you have to call setlocale(LC_ALL, "") */ setlocale(LC_ALL, ""); diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c index ef5abc55..b340553f 100644 --- a/src/fe-text/statusbar.c +++ b/src/fe-text/statusbar.c @@ -668,7 +668,7 @@ void statusbar_item_default_handler(SBAR_ITEM_REC *item, int get_size_only, int escape_vars) { SERVER_REC *server; - WI_ITEM_REC *wiitem; + WI_ITEM_REC *wiitem; char *tmpstr, *tmpstr2; theme_rm_col reset; strcpy(reset.m, "n"); diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index 29d3f7eb..ded79c28 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -390,7 +390,8 @@ void term_set_color(TERM_WINDOW *window, int col) } /* set background color */ - if (window && (term_color256map[bg&0xff]&8) == window->term->TI_colors) + if (window && window->term->TI_colors && + (term_color256map[bg&0xff]&8) == window->term->TI_colors) col |= ATTR_BLINK; if (col & ATTR_BLINK) current_term->set_blink(current_term); @@ -413,7 +414,8 @@ void term_set_color(TERM_WINDOW *window, int col) terminfo_set_reverse(); /* bold */ - if (window && (term_color256map[fg&0xff]&8) == window->term->TI_colors) + if (window && window->term->TI_colors && + (term_color256map[fg&0xff]&8) == window->term->TI_colors) col |= ATTR_BOLD; if (col & ATTR_BOLD) terminfo_set_bold(); diff --git a/src/fe-text/textbuffer-view.c b/src/fe-text/textbuffer-view.c index 3099ee3e..e2e3707b 100644 --- a/src/fe-text/textbuffer-view.c +++ b/src/fe-text/textbuffer-view.c @@ -1228,7 +1228,7 @@ void textbuffer_view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line) void textbuffer_view_remove_lines_by_level(TEXT_BUFFER_VIEW_REC *view, int level) { LINE_REC *line, *next; - + term_refresh_freeze(); line = textbuffer_view_get_lines(view); diff --git a/src/fe-text/textbuffer-view.h b/src/fe-text/textbuffer-view.h index ab6786e0..21a9bde6 100644 --- a/src/fe-text/textbuffer-view.h +++ b/src/fe-text/textbuffer-view.h @@ -72,7 +72,7 @@ struct _TEXT_BUFFER_VIEW_REC { /* how many empty lines are in screen. a screenful when started or used /CLEAR */ - int empty_linecount; + int empty_linecount; /* window is at the bottom of the text buffer */ unsigned int bottom:1; /* if !bottom - new text has been printed since we were at bottom */ diff --git a/src/fe-text/tparm.c b/src/fe-text/tparm.c index 3f58e6f3..97c790da 100644 --- a/src/fe-text/tparm.c +++ b/src/fe-text/tparm.c @@ -153,7 +153,7 @@ static int termcap; all terminfo codes are invalid unless something has been pushed on the stack and termcap strings will never push things on the stack (%p isn't used by termcap). So where we have a choice we make the - decision by wether or not somthing has been pushed on the stack. + decision by whether or not somthing has been pushed on the stack. The static variable termcap keeps track of this; it starts out set to 1 and is incremented as each argument processed by a termcap % code, however if something is pushed on the stack it's set to 0 and the @@ -170,7 +170,7 @@ static int termcap; %c output pop as a char %'c' push character constant c. %{n} push decimal constant n. - %p[1-9] push paramter [1-9] + %p[1-9] push parameter [1-9] %g[a-z] push variable [a-z] %P[a-z] put pop in variable [a-z] %l push the length of pop (a string) @@ -188,7 +188,7 @@ static int termcap; %O logical or pop and pop and push the result %! push the logical not of pop %? condition %t if_true [%e if_false] %; - if condtion evaulates as true then evaluate if_true, + if condition evaulates as true then evaluate if_true, else evaluate if_false. elseif's can be done: %? cond %t true [%e cond2 %t true2] ... [%e condN %t trueN] [%e false] %; %i add one to parameters 1 and 2. (ANSI) @@ -208,7 +208,7 @@ static int termcap; (UW) %sx subtract parameter FROM the character x %>xy if parameter > character x then add character y to parameter %B convert to BCD (parameter = (parameter/10)*16 + parameter%16) - %D Delta Data encode (parameter = parameter - 2*(paramter%16)) + %D Delta Data encode (parameter = parameter - 2*(parameter%16)) %i increment the first two parameters by one %n xor the first two parameters by 0140 (GNU) %m xor the first two parameters by 0177 @@ -216,7 +216,7 @@ static int termcap; (GNU) %b backup to previous parameter (GNU) %f skip this parameter - Note the two definitions of %a, the GNU defintion is used if the characters + Note the two definitions of %a, the GNU definition is used if the characters after the 'a' are valid, otherwise the UW definition is used. (GNU) used by GNU Emacs termcap libraries @@ -316,7 +316,7 @@ char *tparm(const char *str, ...) { if ((sp[1] == 'p' || sp[1] == 'c') && sp[2] != '\0' && fmt == NULL) { /* GNU aritmitic parameter, what they - realy need is terminfo. */ + really need is terminfo. */ int val, lc; if (sp[1] == 'p' && getarg(termcap - 1 + sp[2] - '@', diff --git a/src/irc/core/bans.c b/src/irc/core/bans.c index de799812..d8d5d448 100644 --- a/src/irc/core/bans.c +++ b/src/irc/core/bans.c @@ -309,7 +309,7 @@ static void cmd_unban(const char *data, IRC_SERVER_REC *server, void *item) ban = g_strdup(BAN_LAST); command_set_ban(ban ? ban : data, server, item, FALSE, 0); - + g_free(ban); cmd_params_free(free_arg); diff --git a/src/irc/core/channel-events.c b/src/irc/core/channel-events.c index 9198ed82..6fdfeef3 100644 --- a/src/irc/core/channel-events.c +++ b/src/irc/core/channel-events.c @@ -123,10 +123,10 @@ static void channel_change_topic(IRC_SERVER_REC *server, const char *channel, { CHANNEL_REC *chanrec; char *recoded = NULL; - + chanrec = channel_find(SERVER(server), channel); if (chanrec == NULL) return; - /* the topic may be send out encoded, so we need to + /* the topic may be send out encoded, so we need to recode it back or /topic <tab> will not work properly */ recoded = recode_in(SERVER(server), topic, channel); if (topic != NULL) { @@ -137,7 +137,7 @@ static void channel_change_topic(IRC_SERVER_REC *server, const char *channel, g_free_not_null(chanrec->topic_by); chanrec->topic_by = g_strdup(setby); - + chanrec->topic_time = settime; signal_emit("channel topic changed", 1, chanrec); diff --git a/src/irc/core/channel-rejoin.c b/src/irc/core/channel-rejoin.c index d518f0c2..68a1dee1 100644 --- a/src/irc/core/channel-rejoin.c +++ b/src/irc/core/channel-rejoin.c @@ -84,7 +84,7 @@ static int channel_rejoin(IRC_SERVER_REC *server, const char *channel) channel_destroy(CHANNEL(chanrec)); return 0; } - + rec = rejoin_find(server, channel); if (rec != NULL) { /* already exists */ diff --git a/src/irc/core/channels-query.c b/src/irc/core/channels-query.c index 48ba5703..857ebaf0 100644 --- a/src/irc/core/channels-query.c +++ b/src/irc/core/channels-query.c @@ -311,7 +311,7 @@ static void channel_checksync(IRC_CHANNEL_REC *channel) signal_emit("channel sync", 1, channel); } -/* Error occured when trying to execute query - abort and try again. */ +/* Error occurred when trying to execute query - abort and try again. */ static void query_current_error(IRC_SERVER_REC *server) { SERVER_QUERY_REC *rec; diff --git a/src/irc/core/irc-channels.c b/src/irc/core/irc-channels.c index dd6e29ce..e38cb98b 100644 --- a/src/irc/core/irc-channels.c +++ b/src/irc/core/irc-channels.c @@ -114,7 +114,7 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data, use_keys = TRUE; key = schannel->password; } else key = NULL; - + g_string_append_printf(outkeys, "%s,", get_join_key(key)); channame = channel + (channel[0] == '!' && channel[1] == '!'); @@ -126,11 +126,11 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data, if (*tmpkey != NULL) tmpkey++; - + tmpstr = tmp; tmpstr++; cmdlen = outchans->len-1; - + if (use_keys) cmdlen += outkeys->len; if (*tmpstr != NULL) @@ -138,8 +138,8 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data, strlen(*tmpstr)+1; if (*tmpkey != NULL) cmdlen += strlen(*tmpkey); - - /* don't try to send too long lines + + /* don't try to send too long lines make sure it's not longer than 510 so 510 - strlen("JOIN ") = 505 */ if (cmdlen < 505) diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index 239c5a64..7c3d3f5f 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -790,7 +790,7 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server, bancmd = *banmasks == '\0'? NULL : g_strdup_printf("%s %s", channel->name, banmasks); - + if (settings_get_bool("kick_first_on_kickban")) { signal_emit("command kick", 3, kickcmd, server, channel); if (bancmd != NULL) @@ -894,7 +894,7 @@ static void cmd_accept(const char *data, IRC_SERVER_REC *server) { CMD_IRC_SERVER(server); - if (*data == '\0') + if (*data == '\0') irc_send_cmd(server, "ACCEPT *"); else irc_send_cmdv(server, "ACCEPT %s", data); @@ -905,7 +905,7 @@ static void cmd_unsilence(const char *data, IRC_SERVER_REC *server) { CMD_IRC_SERVER(server); - if (*data == '\0') + if (*data == '\0') cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS); irc_send_cmdv(server, "SILENCE -%s", data); diff --git a/src/irc/core/irc-nicklist.c b/src/irc/core/irc-nicklist.c index da9d4aca..5438509e 100644 --- a/src/irc/core/irc-nicklist.c +++ b/src/irc/core/irc-nicklist.c @@ -195,7 +195,7 @@ static void event_end_of_names(IRC_SERVER_REC *server, const char *data) IRC_CHANNEL_REC *chanrec; NICK_REC *ownnick; int nicks; - + g_return_if_fail(server != NULL); params = event_get_params(data, 2, NULL, &channel); @@ -384,7 +384,7 @@ static void event_nick_in_use(IRC_SERVER_REC *server, const char *data) cmd = g_strdup_printf("NICK %s", server->nick); irc_send_cmd_now(server, cmd); - g_free(cmd); + g_free(cmd); } static void event_target_unavailable(IRC_SERVER_REC *server, const char *data) diff --git a/src/irc/core/irc-servers-reconnect.c b/src/irc/core/irc-servers-reconnect.c index 1587d4e6..b0aad26f 100644 --- a/src/irc/core/irc-servers-reconnect.c +++ b/src/irc/core/irc-servers-reconnect.c @@ -71,7 +71,7 @@ static void sig_connected(IRC_SERVER_REC *server) return; if (server->connrec->away_reason != NULL) - irc_server_send_away(server, server->connrec->away_reason); + irc_server_send_away(server, server->connrec->away_reason); } static void event_nick_collision(IRC_SERVER_REC *server, const char *data) diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index 13784f88..27878989 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -178,23 +178,15 @@ static char **split_message(SERVER_REC *server, const char *target, const char *msg) { IRC_SERVER_REC *ircserver = IRC_SERVER(server); - int userhostlen = MAX_USERHOST_LEN; g_return_val_if_fail(ircserver != NULL, NULL); g_return_val_if_fail(target != NULL, NULL); g_return_val_if_fail(msg != NULL, NULL); - /* - * If we have joined a channel, userhost will be set, so we can - * calculate the exact maximum length. - */ - if (ircserver->userhost != NULL) - userhostlen = strlen(ircserver->userhost); - - /* length calculation shamelessly stolen from splitlong.pl */ + /* length calculation shamelessly stolen from splitlong_safe.pl */ return split_line(SERVER(server), msg, target, 510 - strlen(":! PRIVMSG :") - - strlen(ircserver->nick) - userhostlen - + strlen(ircserver->nick) - MAX_USERHOST_LEN - strlen(target)); } @@ -458,18 +450,14 @@ void irc_server_send_action(IRC_SERVER_REC *server, const char *target, const ch char **irc_server_split_action(IRC_SERVER_REC *server, const char *target, const char *data) { - int userhostlen = MAX_USERHOST_LEN; - g_return_val_if_fail(server != NULL, NULL); g_return_val_if_fail(target != NULL, NULL); g_return_val_if_fail(data != NULL, NULL); - if (server->userhost != NULL) - userhostlen = strlen(server->userhost); - return split_line(SERVER(server), data, target, 510 - strlen(":! PRIVMSG :\001ACTION \001") - - strlen(server->nick) - userhostlen - strlen(target)); + strlen(server->nick) - MAX_USERHOST_LEN - + strlen(target)); } void irc_server_send_away(IRC_SERVER_REC *server, const char *reason) @@ -484,9 +472,11 @@ void irc_server_send_away(IRC_SERVER_REC *server, const char *reason) if (*reason != '\0') { server->away_reason = g_strdup(reason); reason = recoded = recode_out(SERVER(server), reason, NULL); + irc_send_cmdv(server, "AWAY :%s", reason); + } else { + irc_send_cmdv(server, "AWAY"); } - irc_send_cmdv(server, "AWAY :%s", reason); } g_free(recoded); } @@ -753,7 +743,7 @@ static void event_isupport(IRC_SERVER_REC *server, const char *data) char **item, *sptr, *eptr; char **isupport; gpointer key, value; - + g_return_if_fail(server != NULL); server->isupport_sent = TRUE; diff --git a/src/irc/core/irc-session.c b/src/irc/core/irc-session.c index bcb0a122..42d82734 100644 --- a/src/irc/core/irc-session.c +++ b/src/irc/core/irc-session.c @@ -69,7 +69,7 @@ static void sig_session_save_server(IRC_SERVER_REC *server, CONFIG_REC *config, isupport = config_node_section(node, "isupport", NODE_TYPE_BLOCK); isupport_data.config = config; isupport_data.node = isupport; - + g_hash_table_foreach(server->isupport, (GHFunc) session_isupport_foreach, &isupport_data); } diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c index 7054182f..ebaf4b8f 100644 --- a/src/irc/core/modes.c +++ b/src/irc/core/modes.c @@ -78,7 +78,7 @@ void prefix_add(char prefixes[MAX_USER_PREFIXES+1], char newprefix, SERVER_REC * if (*prefixlst == newprefix) break; /* insert the new prefix here */ - + if (*prefixlst == prefixes[oldpos]) { /* this prefix is present. * the one we are inserting goes after it. @@ -88,7 +88,7 @@ void prefix_add(char prefixes[MAX_USER_PREFIXES+1], char newprefix, SERVER_REC * } prefixlst++; } - + /* newpos is now the position in which we wish to insert the prefix */ newprefixes[newpos++] = newprefix; @@ -274,7 +274,7 @@ void modes_type_b(IRC_CHANNEL_REC *channel, const char *setby, char type, channel->key = g_strdup(arg); } } - + mode_set_arg(channel->server, newmode, type, mode, arg, FALSE); } @@ -285,7 +285,7 @@ void modes_type_c(IRC_CHANNEL_REC *channel, const char *setby, if (mode == 'l') { channel->limit = type == '-' ? 0 : atoi(arg); } - + mode_set_arg(channel->server, newmode, type, mode, arg, FALSE); } diff --git a/src/irc/core/servers-redirect.c b/src/irc/core/servers-redirect.c index 34beaef6..518248cb 100644 --- a/src/irc/core/servers-redirect.c +++ b/src/irc/core/servers-redirect.c @@ -734,7 +734,7 @@ void servers_redirect_init(void) "event 403", 1, /* no such channel */ "event 442", 1, /* "you're not on that channel" */ "event 479", 1, /* "Cannot join channel (illegal name)" IMHO this is not a logical reply from server. */ - "event 472", -1, /* unknown mode (you should check e-mode's existance from 004 event instead of relying on this) */ + "event 472", -1, /* unknown mode (you should check e-mode's existence from 004 event instead of relying on this) */ NULL, NULL); @@ -747,7 +747,7 @@ void servers_redirect_init(void) "event 403", 1, /* no such channel */ "event 442", 1, /* "you're not on that channel" */ "event 479", 1, /* "Cannot join channel (illegal name)" IMHO this is not a logical reply from server. */ - "event 472", -1, /* unknown mode (you should check I-mode's existance from 004 event instead of relying on this) */ + "event 472", -1, /* unknown mode (you should check I-mode's existence from 004 event instead of relying on this) */ NULL, NULL); diff --git a/src/irc/dcc/dcc-chat.c b/src/irc/dcc/dcc-chat.c index ad1442fc..8ee4decd 100644 --- a/src/irc/dcc/dcc-chat.c +++ b/src/irc/dcc/dcc-chat.c @@ -428,7 +428,7 @@ static void dcc_chat_passive(CHAT_DCC_REC *dcc) dcc_ip2str(&own_ip, host); irc_send_cmdv(dcc->server, "PRIVMSG %s :\001DCC CHAT CHAT %s %d %d\001", dcc->nick, host, port, dcc->pasv_id); - + } /* SYNTAX: DCC CHAT [-passive] [<nick>] */ @@ -615,7 +615,7 @@ static void ctcp_msg_dcc_chat(IRC_SERVER_REC *server, const char *data, char **params; int paramcount; int passive, autoallow = FALSE; - + /* CHAT <unused> <address> <port> */ /* CHAT <unused> <address> 0 <id> (DCC CHAT passive protocol) */ params = g_strsplit(data, " ", -1); @@ -656,14 +656,14 @@ static void ctcp_msg_dcc_chat(IRC_SERVER_REC *server, const char *data, } } } - + dcc = dcc_chat_create(server, chat, nick, params[0]); dcc->target = g_strdup(target); dcc->port = atoi(params[2]); - + if (passive) dcc->pasv_id = atoi(params[3]); - + dcc_str2ip(params[1], &dcc->addr); net_ip2host(&dcc->addr, dcc->addrstr); diff --git a/src/irc/dcc/dcc-get.c b/src/irc/dcc/dcc-get.c index 8eee81b3..69fdc746 100644 --- a/src/irc/dcc/dcc-get.c +++ b/src/irc/dcc/dcc-get.c @@ -454,7 +454,7 @@ static void ctcp_msg_dcc_send(IRC_SERVER_REC *server, const char *data, g_memmove(fname, fname+1, len); quoted = TRUE; } - + if (passive && port != 0) { /* This is NOT a DCC SEND request! This is a reply to our passive request. We MUST check the IDs and then connect to @@ -501,7 +501,7 @@ static void ctcp_msg_dcc_send(IRC_SERVER_REC *server, const char *data, if (passive && port == 0) dcc->pasv_id = p_id; /* Assign the ID to the DCC */ - + memcpy(&dcc->addr, &ip, sizeof(ip)); if (dcc->addr.family == AF_INET) net_ip2host(&dcc->addr, dcc->addrstr); diff --git a/src/irc/dcc/dcc-resume.c b/src/irc/dcc/dcc-resume.c index 28871986..11b28aef 100644 --- a/src/irc/dcc/dcc-resume.c +++ b/src/irc/dcc/dcc-resume.c @@ -94,7 +94,7 @@ static int dcc_ctcp_resume_parse(int type, const char *data, const char *nick, return 0; fileparams = get_file_params_count_resume(params, paramcount); - + if (paramcount >= fileparams + 2) { port = atoi(params[fileparams]); *size = str_to_uofft(params[fileparams+1]); diff --git a/src/irc/dcc/dcc-send.c b/src/irc/dcc/dcc-send.c index 558fd109..2ce84f18 100644 --- a/src/irc/dcc/dcc-send.c +++ b/src/irc/dcc/dcc-send.c @@ -194,7 +194,7 @@ static void cmd_dcc_send(const char *data, IRC_SERVER_REC *server, cmd_param_error(CMDERR_NOT_CONNECTED); passive = g_hash_table_lookup(optlist, "passive") != NULL; - + if (g_hash_table_lookup(optlist, "rmhead") != NULL) { queue = dcc_queue_old(nick, servertag); if (queue != -1) @@ -217,7 +217,7 @@ static void cmd_dcc_send(const char *data, IRC_SERVER_REC *server, if (*fileargs == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - + dcc_send_add(servertag, chat, nick, fileargs, mode, passive); } @@ -434,11 +434,11 @@ static int dcc_send_one_file(int queue, const char *target, const char *fname, if (passive) { dcc->pasv_id = rand() % 64; } - + /* send DCC request */ signal_emit("dcc request send", 1, dcc); - + dcc_ip2str(&own_ip, host); if (passive == FALSE) { str = g_strdup_printf(dcc->file_quoted ? diff --git a/src/irc/dcc/dcc.c b/src/irc/dcc/dcc.c index e4ee4b7c..6f0d5c81 100644 --- a/src/irc/dcc/dcc.c +++ b/src/irc/dcc/dcc.c @@ -90,9 +90,9 @@ void dcc_init_rec(DCC_REC *dcc, IRC_SERVER_REC *server, CHAT_DCC_REC *chat, dcc->servertag = server != NULL ? g_strdup(server->tag) : (chat == NULL ? NULL : g_strdup(chat->servertag)); - + dcc->pasv_id = -1; /* Not a passive DCC */ - + dcc_conns = g_slist_append(dcc_conns, dcc); signal_emit("dcc created", 1, dcc); } @@ -454,8 +454,8 @@ static int dcc_timeout_func(void) /* Timed out - don't send DCC REJECT CTCP so CTCP flooders won't affect us and it really doesn't matter that much anyway if the other side doen't - get it.. - + get it.. + We don't want dcc servers to time out. */ dcc_close(dcc); } diff --git a/src/irc/dcc/dcc.h b/src/irc/dcc/dcc.h index 10639207..144cc89b 100644 --- a/src/irc/dcc/dcc.h +++ b/src/irc/dcc/dcc.h @@ -27,7 +27,7 @@ typedef struct { /* passive DCC */ #define dcc_is_passive(dcc) \ ((dcc)->pasv_id >= 0) - + extern GSList *dcc_conns; void dcc_register_type(const char *type); diff --git a/src/irc/flood/autoignore.c b/src/irc/flood/autoignore.c index 94adf167..250a1fe8 100644 --- a/src/irc/flood/autoignore.c +++ b/src/irc/flood/autoignore.c @@ -38,7 +38,7 @@ void autoignore_update(IGNORE_REC *rec, int level) ignore_update_rec(rec); } -void autoignore_add(IRC_SERVER_REC *server, char *mask, int level) +void autoignore_add(IRC_SERVER_REC *server, char *mask, int level) { IGNORE_REC *rec; diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c index 8edffbd3..33392285 100644 --- a/src/irc/proxy/listen.c +++ b/src/irc/proxy/listen.c @@ -178,7 +178,7 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args, rec->proxy_address, rec->nick, rec->listen->ircnet); rec->want_ctcp = 0; } - + } proxy_outdata(client, ":%s NOTICE %s :You're now receiving CTCPs sent to %s\n", client->proxy_address, client->nick,client->listen->ircnet); @@ -421,7 +421,7 @@ static void sig_server_event(IRC_SERVER_REC *server, const char *line, /* CTCP - either answer ourself or forward it to one client */ for (tmp = proxy_clients; tmp != NULL; tmp = tmp->next) { CLIENT_REC *rec = tmp->data; - + if (rec->want_ctcp == 1) { /* only CTCP for the chatnet where client is connected to will be forwarded */ if (strstr(rec->proxy_address, server->connrec->chatnet) != NULL) { diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index 1fbd000b..0a8a5d92 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -629,7 +629,7 @@ static void perl_register_protocol(CHAT_PROTOCOL_REC *rec) perl_eval_pv(code, TRUE); } - pcode = g_strdup_printf(find_use_code, + pcode = g_strdup_printf(find_use_code, settings_get_str("perl_use_lib"), name); sv = perl_eval_pv(pcode, TRUE); g_free(pcode); diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c index be4a9a5d..1f602c66 100644 --- a/src/perl/perl-signals.c +++ b/src/perl/perl-signals.c @@ -475,7 +475,7 @@ void perl_command_bind_to(const char *cmd, const char *category, g_free(signal); } -void perl_command_runsub(const char *cmd, const char *data, +void perl_command_runsub(const char *cmd, const char *data, SERVER_REC *server, WI_ITEM_REC *item) { command_runsub(cmd, data, server, item); diff --git a/src/perl/perl-signals.h b/src/perl/perl-signals.h index e2c3db61..78a95bed 100644 --- a/src/perl/perl-signals.h +++ b/src/perl/perl-signals.h @@ -21,7 +21,7 @@ void perl_command_bind_to(const char *cmd, const char *category, void perl_command_unbind(const char *cmd, SV *func); -void perl_command_runsub(const char *cmd, const char *data, +void perl_command_runsub(const char *cmd, const char *data, SERVER_REC *server, WI_ITEM_REC *item); void perl_signal_register(const char *signal, const char **args); |