diff options
77 files changed, 489 insertions, 425 deletions
diff --git a/docs/help/in/connect.in b/docs/help/in/connect.in index 3330966e..f13582cc 100644 --- a/docs/help/in/connect.in +++ b/docs/help/in/connect.in @@ -15,6 +15,7 @@ -ssl_verify: Verifies the SSL certificate of the server. -ssl_cafile: The file with the list of CA certificates. -ssl_capath: The directory which contains the CA certificates. + -ssl_ciphers: SSL cipher suite preference lists -noproxy: Ignores the global proxy configuration. -network: The network this connection belongs to. -host: The hostname you would like to connect from. diff --git a/docs/help/in/lastlog.in b/docs/help/in/lastlog.in index 3815f5d2..25879d31 100644 --- a/docs/help/in/lastlog.in +++ b/docs/help/in/lastlog.in @@ -14,6 +14,7 @@ -clear: Removes the previous results from the active window. -count: Displays how many lines match. -case: Performs a case-sensitive matching. + -date: Prepends each row with the message's date -regexp: The given text pattern is a regular expression. -word: The text must match full words. -force: Forces to display the lastlog, even if it exceeds 1000 lines. diff --git a/docs/help/in/server.in b/docs/help/in/server.in index f6706daf..34c31972 100644 --- a/docs/help/in/server.in +++ b/docs/help/in/server.in @@ -22,6 +22,7 @@ -ssl_verify: Verifies the SSL certificate of the server. -ssl_cafile: The file with the list of CA certificates. -ssl_capath: The directory which contains the CA certificates. + -ssl_ciphers: SSL cipher suite preference lists -auto: Automatically connects to the server on startup. -noauto: Doesn't connect to the server on startup. -network: The network the server belongs to. diff --git a/scripts/scriptassist.pl b/scripts/scriptassist.pl index 12678dbb..dd6d3737 100644 --- a/scripts/scriptassist.pl +++ b/scripts/scriptassist.pl @@ -1088,7 +1088,7 @@ sub sig_command_script_load ($$$) { no strict; $script = $2 if $script =~ /(.*\/)?(.*?)\.pl$/; if ( %{ "Irssi::Script::${script}::" }) { - if ( &{ "Irssi::Script::${script}::pre_unload" }) { + if (defined &{ "Irssi::Script::${script}::pre_unload" }) { print CLIENTCRAP "%R>>%n Triggering pre_unload function of $script..."; &{ "Irssi::Script::${script}::pre_unload" }(); } diff --git a/src/common.h b/src/common.h index bb246962..1b99753b 100644 --- a/src/common.h +++ b/src/common.h @@ -52,6 +52,10 @@ #define g_slice_free(type, mem) g_free(mem) #endif +#if !GLIB_CHECK_VERSION(2,16,0) +#define g_strcmp0(a, b) (!a ? -(a != b) : (!b ? (a != b) : strcmp(a, b))) +#endif + #ifdef USE_GC # define g_free(x) G_STMT_START { (x) = NULL; } G_STMT_END #endif diff --git a/src/core/channels.c b/src/core/channels.c index 8235a4c7..9af8b844 100644 --- a/src/core/channels.c +++ b/src/core/channels.c @@ -167,7 +167,7 @@ static GSList *servers_find_chatnet_except(SERVER_REC *server) SERVER_REC *rec = tmp->data; if (server != rec && rec->connrec->chatnet != NULL && - strcmp(server->connrec->chatnet, + g_strcmp0(server->connrec->chatnet, rec->connrec->chatnet) == 0) { /* chatnets match */ list = g_slist_append(list, rec); diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c index 8d1ac3eb..8e881679 100644 --- a/src/core/chat-commands.c +++ b/src/core/chat-commands.c @@ -58,7 +58,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr, return NULL; } - if (strcmp(password, "-") == 0) + if (g_strcmp0(password, "-") == 0) *password = '\0'; /* check if -<chatnet> option is used to specify chat protocol */ @@ -106,6 +106,8 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr, conn->ssl_cafile = g_strdup(tmp); if ((tmp = g_hash_table_lookup(optlist, "ssl_capath")) != NULL) conn->ssl_capath = g_strdup(tmp); + if ((tmp = g_hash_table_lookup(optlist, "ssl_ciphers")) != NULL) + conn->ssl_ciphers = g_strdup(tmp); if ((conn->ssl_capath != NULL && conn->ssl_capath[0] != '\0') || (conn->ssl_cafile != NULL && conn->ssl_cafile[0] != '\0')) conn->ssl_verify = TRUE; @@ -138,6 +140,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr, /* SYNTAX: CONNECT [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>] [-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>] + [-ssl_ciphers <list>] [-!] [-noautosendcmd] [-noproxy] [-network <network>] [-host <hostname>] [-rawlog <file>] @@ -244,6 +247,7 @@ static void sig_default_command_server(const char *data, SERVER_REC *server, /* SYNTAX: SERVER [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>] [-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>] + [-ssl_ciphers <list>] [-!] [-noautosendcmd] [-noproxy] [-network <network>] [-host <hostname>] [-rawlog <file>] @@ -283,7 +287,7 @@ static void cmd_disconnect(const char *data, SERVER_REC *server) if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &tag, &msg)) return; - if (*tag != '\0' && strcmp(tag, "*") != 0) { + if (*tag != '\0' && g_strcmp0(tag, "*") != 0) { server = server_find_tag(tag); if (server == NULL) server = server_find_lookup_tag(tag); @@ -343,7 +347,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item) origtarget = target; free_ret = FALSE; - if (strcmp(target, ",") == 0 || strcmp(target, ".") == 0) { + if (g_strcmp0(target, ",") == 0 || g_strcmp0(target, ".") == 0) { target = parse_special(&target, server, item, NULL, &free_ret, NULL, 0); if (target != NULL && *target == '\0') { @@ -355,7 +359,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item) } if (target != NULL) { - if (strcmp(target, "*") == 0) { + if (g_strcmp0(target, "*") == 0) { /* send to active channel/query */ if (item == NULL) cmd_param_error(CMDERR_NOT_JOINED); @@ -483,7 +487,7 @@ void chat_commands_init(void) signal_add("default command server", (SIGNAL_FUNC) sig_default_command_server); signal_add("server sendmsg", (SIGNAL_FUNC) sig_server_sendmsg); - command_set_options("connect", "4 6 !! -network ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +host noproxy -rawlog noautosendcmd"); + command_set_options("connect", "4 6 !! -network ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers +host noproxy -rawlog noautosendcmd"); command_set_options("msg", "channel nick"); } diff --git a/src/core/commands.c b/src/core/commands.c index ed82f44e..9e451bc8 100644 --- a/src/core/commands.c +++ b/src/core/commands.c @@ -674,7 +674,7 @@ get_optional_channel(WI_ITEM_REC *active_item, char **data, int require_name) origtmp = tmp = g_strdup(*data); channel = cmd_get_param(&tmp); - if (strcmp(channel, "*") == 0 && !require_name) { + if (g_strcmp0(channel, "*") == 0 && !require_name) { /* "*" means active channel */ cmd_get_param(data); ret = window_item_get_target(active_item); diff --git a/src/core/ignore.c b/src/core/ignore.c index 2d18f865..e70b741b 100644 --- a/src/core/ignore.c +++ b/src/core/ignore.c @@ -201,10 +201,10 @@ IGNORE_REC *ignore_find_noact(const char *servertag, const char *mask, char **chan; int ignore_servertag; - if (mask != NULL && (*mask == '\0' || strcmp(mask, "*") == 0)) + if (mask != NULL && (*mask == '\0' || g_strcmp0(mask, "*") == 0)) mask = NULL; - ignore_servertag = servertag != NULL && strcmp(servertag, "*") == 0; + ignore_servertag = servertag != NULL && g_strcmp0(servertag, "*") == 0; for (tmp = ignores; tmp != NULL; tmp = tmp->next) { IGNORE_REC *rec = tmp->data; @@ -232,7 +232,7 @@ IGNORE_REC *ignore_find_noact(const char *servertag, const char *mask, if ((channels == NULL && rec->channels == NULL)) return rec; /* no channels - ok */ - if (channels != NULL && strcmp(*channels, "*") == 0) + if (channels != NULL && g_strcmp0(*channels, "*") == 0) return rec; /* ignore channels */ if (channels == NULL || rec->channels == NULL) diff --git a/src/core/levels.c b/src/core/levels.c index 7997ba98..e623c4de 100644 --- a/src/core/levels.c +++ b/src/core/levels.c @@ -54,7 +54,7 @@ int level_get(const char *level) { int n, len, match; - if (g_ascii_strcasecmp(level, "ALL") == 0 || strcmp(level, "*") == 0) + if (g_ascii_strcasecmp(level, "ALL") == 0 || g_strcmp0(level, "*") == 0) return MSGLEVEL_ALL; if (g_ascii_strcasecmp(level, "NEVER") == 0) @@ -177,7 +177,7 @@ int combine_level(int dest, const char *src) itemname = *item + (**item == '+' || **item == '-' ? 1 : 0); itemlevel = level_get(itemname); - if (strcmp(itemname, "NONE") == 0) + if (g_strcmp0(itemname, "NONE") == 0) dest = 0; else if (**item == '-') dest &= ~(itemlevel); diff --git a/src/core/log.c b/src/core/log.c index c9732d6d..8306d2df 100644 --- a/src/core/log.c +++ b/src/core/log.c @@ -110,7 +110,7 @@ int log_start_logging(LOG_REC *log) log->real_fname = log_filename(log); if (log->real_fname != NULL && - strcmp(log->real_fname, log->fname) != 0) { + g_strcmp0(log->real_fname, log->fname) != 0) { /* path may contain variables (%time, $vars), make sure the directory is created */ dir = g_path_get_dirname(log->real_fname); @@ -181,7 +181,7 @@ static void log_rotate_check(LOG_REC *log) return; new_fname = log_filename(log); - if (strcmp(new_fname, log->real_fname) != 0) { + if (g_strcmp0(new_fname, log->real_fname) != 0) { /* rotate log */ log_stop_logging(log); signal_emit("log rotated", 1, log); @@ -245,7 +245,7 @@ static int itemcmp(const char *patt, const char *item) { /* returns 0 on match, nonzero otherwise */ - if (!strcmp(patt, "*")) + if (!g_strcmp0(patt, "*")) return 0; return item ? g_ascii_strcasecmp(patt, item) : 1; } @@ -320,7 +320,7 @@ LOG_REC *log_find(const char *fname) for (tmp = logs; tmp != NULL; tmp = tmp->next) { LOG_REC *rec = tmp->data; - if (strcmp(rec->fname, fname) == 0) + if (g_strcmp0(rec->fname, fname) == 0) return rec; } diff --git a/src/core/misc.c b/src/core/misc.c index 586e4f7c..ef8501d5 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -184,7 +184,7 @@ int strarray_find(char **array, const char *item) GSList *gslist_find_string(GSList *list, const char *key) { for (; list != NULL; list = list->next) - if (strcmp(list->data, key) == 0) return list; + if (g_strcmp0(list->data, key) == 0) return list; return NULL; } @@ -269,7 +269,7 @@ GSList *hashtable_get_keys(GHashTable *hash) GList *glist_find_string(GList *list, const char *key) { for (; list != NULL; list = list->next) - if (strcmp(list->data, key) == 0) return list; + if (g_strcmp0(list->data, key) == 0) return list; return NULL; } diff --git a/src/core/modules-load.c b/src/core/modules-load.c index 49f811de..6086d9ae 100644 --- a/src/core/modules-load.c +++ b/src/core/modules-load.c @@ -78,7 +78,7 @@ static char *module_get_root(const char *name, char **prefixes) /* skip the _core part */ len = strlen(name); - if (len > 5 && strcmp(name+len-5, "_core") == 0) + if (len > 5 && g_strcmp0(name+len-5, "_core") == 0) return g_strndup(name, len-5); return g_strdup(name); @@ -94,11 +94,11 @@ static char *module_get_sub(const char *name, const char *root) g_return_val_if_fail(namelen >= rootlen, g_strdup(name)); if (strncmp(name, root, rootlen) == 0 && - strcmp(name+rootlen, "_core") == 0) + g_strcmp0(name+rootlen, "_core") == 0) return g_strdup("core"); if (namelen > rootlen && name[namelen-rootlen-1] == '_' && - strcmp(name+namelen-rootlen, root) == 0) + g_strcmp0(name+namelen-rootlen, root) == 0) return g_strndup(name, namelen-rootlen-1); return g_strdup(name); @@ -140,10 +140,10 @@ static GModule *module_open(const char *name, int *found) static char *module_get_func(const char *rootmodule, const char *submodule, const char *function) { - if (strcmp(submodule, "core") == 0) + if (g_strcmp0(submodule, "core") == 0) return g_strconcat(rootmodule, "_core_", function, NULL); - if (strcmp(rootmodule, submodule) == 0) + if (g_strcmp0(rootmodule, submodule) == 0) return g_strconcat(rootmodule, "_", function, NULL); return g_strconcat(submodule, "_", rootmodule, "_", function, NULL); @@ -200,7 +200,7 @@ static int module_load_name(const char *path, const char *rootmodule, module = module_find(rootmodule); rec = module == NULL ? NULL : - strcmp(rootmodule, submodule) == 0 ? + g_strcmp0(rootmodule, submodule) == 0 ? module_file_find(module, "core") : module_file_find(module, submodule); if (rec == NULL) { @@ -277,7 +277,7 @@ static int module_load_full(const char *path, const char *rootmodule, return FALSE; module = module_find(rootmodule); - if (module != NULL && (strcmp(submodule, rootmodule) == 0 || + if (module != NULL && (g_strcmp0(submodule, rootmodule) == 0 || module_file_find(module, submodule) != NULL)) { /* module is already loaded */ module_error(MODULE_ERROR_ALREADY_LOADED, NULL, @@ -286,7 +286,7 @@ static int module_load_full(const char *path, const char *rootmodule, } /* check if the given module exists.. */ - try_prefixes = strcmp(rootmodule, submodule) == 0; + try_prefixes = g_strcmp0(rootmodule, submodule) == 0; status = module_load_name(path, rootmodule, submodule, try_prefixes); if (status == -1 && try_prefixes) { /* nope, try loading the module_core, @@ -340,7 +340,7 @@ int module_load_sub(const char *path, const char *submodule, char **prefixes) g_free(name); full_path = g_string_new(exppath); - if (strcmp(submodule, "core") == 0) + if (g_strcmp0(submodule, "core") == 0) g_string_insert(full_path, end, "_core"); else { g_string_insert_c(full_path, start, '_'); diff --git a/src/core/modules.c b/src/core/modules.c index b002819b..a2542c84 100644 --- a/src/core/modules.c +++ b/src/core/modules.c @@ -44,7 +44,7 @@ void *module_check_cast_module(void *object, int type_pos, str = module_find_id_str(module, G_STRUCT_MEMBER(int, object, type_pos)); - return str == NULL || strcmp(str, id) != 0 ? NULL : object; + return str == NULL || g_strcmp0(str, id) != 0 ? NULL : object; } /* return unique number across all modules for `id' */ @@ -251,7 +251,7 @@ MODULE_FILE_REC *module_file_find(MODULE_REC *module, const char *name) for (tmp = module->files; tmp != NULL; tmp = tmp->next) { MODULE_FILE_REC *rec = tmp->data; - if (strcmp(rec->name, name) == 0) + if (g_strcmp0(rec->name, name) == 0) return rec; } diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c index e16403ec..465c4154 100644 --- a/src/core/network-openssl.c +++ b/src/core/network-openssl.c @@ -460,6 +460,7 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_ const char *mypass = server->connrec->ssl_pass; const char *cafile = server->connrec->ssl_cafile; const char *capath = server->connrec->ssl_capath; + const char *ciphers = server->connrec->ssl_ciphers; gboolean verify = server->connrec->ssl_verify; g_return_val_if_fail(handle != NULL, NULL); @@ -478,6 +479,10 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_ 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); + if (ciphers && *ciphers) { + if (SSL_CTX_set_cipher_list(ctx, ciphers) != 1) + g_warning("No valid SSL cipher suite could be selected"); + } if (mycert && *mycert) { char *scert = NULL, *spkey = NULL; @@ -531,6 +536,10 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_ return NULL; } +#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME + SSL_set_tlsext_host_name(ssl, server->connrec->address); +#endif + SSL_set_mode(ssl, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); diff --git a/src/core/nicklist.c b/src/core/nicklist.c index b1c9ecef..a96b8a9e 100644 --- a/src/core/nicklist.c +++ b/src/core/nicklist.c @@ -478,7 +478,7 @@ static NICK_REC *nick_nfind(CHANNEL_REC *channel, const char *nick, int len) if (rec != NULL) { /* if there's multiple, get the one with identical case */ while (rec->next != NULL) { - if (strcmp(rec->nick, tmpnick) == 0) + if (g_strcmp0(rec->nick, tmpnick) == 0) break; rec = rec->next; } diff --git a/src/core/server-connect-rec.h b/src/core/server-connect-rec.h index 17537508..80c5761b 100644 --- a/src/core/server-connect-rec.h +++ b/src/core/server-connect-rec.h @@ -28,6 +28,7 @@ char *ssl_pkey; char *ssl_pass; char *ssl_cafile; char *ssl_capath; +char *ssl_ciphers; GIOChannel *connect_handle; /* connect using this handle */ diff --git a/src/core/server-setup-rec.h b/src/core/server-setup-rec.h index ae797559..ecdde3f3 100644 --- a/src/core/server-setup-rec.h +++ b/src/core/server-setup-rec.h @@ -13,6 +13,7 @@ char *ssl_pkey; char *ssl_pass; char *ssl_cafile; char *ssl_capath; +char *ssl_ciphers; char *own_host; /* address to use when connecting this server */ IPADDR *own_ip4, *own_ip6; /* resolved own_address if not NULL */ diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c index d99a5405..ae97ecd2 100644 --- a/src/core/servers-reconnect.c +++ b/src/core/servers-reconnect.c @@ -197,6 +197,7 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info) dest->ssl_verify = src->ssl_verify; dest->ssl_cafile = g_strdup(src->ssl_cafile); dest->ssl_capath = g_strdup(src->ssl_capath); + dest->ssl_ciphers = g_strdup(src->ssl_ciphers); return dest; } @@ -384,7 +385,7 @@ static void cmd_reconnect(const char *data, SERVER_REC *server) if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &tag, &msg)) return; - if (*tag != '\0' && strcmp(tag, "*") != 0) + if (*tag != '\0' && g_strcmp0(tag, "*") != 0) server = server_find_tag(tag); if (server != NULL) { diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index e648eb36..90a447d4 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -179,6 +179,8 @@ static void server_setup_fill_server(SERVER_CONNECT_REC *conn, conn->ssl_cafile = g_strdup(sserver->ssl_cafile); if (conn->ssl_capath == NULL && sserver->ssl_capath != NULL && sserver->ssl_capath[0] != '\0') conn->ssl_capath = g_strdup(sserver->ssl_capath); + if (conn->ssl_ciphers == NULL && sserver->ssl_ciphers != NULL && sserver->ssl_ciphers[0] != '\0') + conn->ssl_ciphers = g_strdup(sserver->ssl_ciphers); server_setup_fill_reconn(conn, sserver); @@ -405,6 +407,7 @@ static SERVER_SETUP_REC *server_setup_read(CONFIG_NODE *node) rec->ssl_verify = config_node_get_bool(node, "ssl_verify", FALSE); rec->ssl_cafile = g_strdup(config_node_get_str(node, "ssl_cafile", NULL)); rec->ssl_capath = g_strdup(config_node_get_str(node, "ssl_capath", NULL)); + rec->ssl_ciphers = g_strdup(config_node_get_str(node, "ssl_ciphers", NULL)); if (rec->ssl_cafile || rec->ssl_capath) rec->ssl_verify = TRUE; if (rec->ssl_cert != NULL || rec->ssl_verify) @@ -445,6 +448,7 @@ static void server_setup_save(SERVER_SETUP_REC *rec) iconfig_node_set_bool(node, "ssl_verify", rec->ssl_verify); iconfig_node_set_str(node, "ssl_cafile", rec->ssl_cafile); iconfig_node_set_str(node, "ssl_capath", rec->ssl_capath); + iconfig_node_set_str(node, "ssl_ciphers", rec->ssl_ciphers); iconfig_node_set_str(node, "own_host", rec->own_host); iconfig_node_set_str(node, "family", @@ -486,6 +490,7 @@ static void server_setup_destroy(SERVER_SETUP_REC *rec) g_free_not_null(rec->ssl_pass); g_free_not_null(rec->ssl_cafile); g_free_not_null(rec->ssl_capath); + g_free_not_null(rec->ssl_ciphers); g_free(rec->address); g_free(rec); } @@ -526,7 +531,7 @@ static void read_servers(void) static void read_settings(void) { if (old_source_host == NULL || - strcmp(old_source_host, settings_get_str("hostname")) != 0) { + g_strcmp0(old_source_host, settings_get_str("hostname")) != 0) { g_free_not_null(old_source_host); old_source_host = g_strdup(settings_get_str("hostname")); diff --git a/src/core/servers.c b/src/core/servers.c index 6eaad191..3342304e 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -636,6 +636,7 @@ void server_connect_unref(SERVER_CONNECT_REC *conn) g_free_not_null(conn->ssl_pass); g_free_not_null(conn->ssl_cafile); g_free_not_null(conn->ssl_capath); + g_free_not_null(conn->ssl_ciphers); g_free_not_null(conn->channels); g_free_not_null(conn->away_reason); diff --git a/src/core/session.c b/src/core/session.c index ca3bf22f..17d80076 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -165,6 +165,7 @@ static void session_save_server(SERVER_REC *server, CONFIG_REC *config, config_node_set_bool(config, node, "ssl_verify", server->connrec->ssl_verify); config_node_set_str(config, node, "ssl_cafile", server->connrec->ssl_cafile); config_node_set_str(config, node, "ssl_capath", server->connrec->ssl_capath); + config_node_set_str(config, node, "ssl_ciphers", server->connrec->ssl_ciphers); handle = g_io_channel_unix_get_fd(net_sendbuffer_handle(server->handle)); config_node_set_int(config, node, "handle", handle); diff --git a/src/core/settings.c b/src/core/settings.c index 6c536180..b34a5766 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -295,7 +295,7 @@ void settings_remove(const char *key) static int settings_remove_hash(const char *key, SETTINGS_REC *rec, const char *module) { - if (strcmp(rec->module, module) == 0) { + if (g_strcmp0(rec->module, module) == 0) { settings_unref(rec, FALSE); return TRUE; } @@ -428,7 +428,7 @@ static void settings_clean_invalid_module(const char *module) next = config_node_next(tmp); set = g_hash_table_lookup(settings, subnode->key); - if (set == NULL || strcmp(set->module, module) != 0) + if (set == NULL || g_strcmp0(set->module, module) != 0) iconfig_node_remove(node, subnode); } } @@ -458,7 +458,7 @@ static int backwards_compatibility(const char *module, CONFIG_NODE *node, new_value = NULL; new_key = NULL; new_module = NULL; /* fe-text term_type -> fe-common/core term_charset - for 0.8.10-> */ - if (strcmp(module, "fe-text") == 0) { + if (g_strcmp0(module, "fe-text") == 0) { if (g_ascii_strcasecmp(node->key, "term_type") == 0 || /* kludge for cvs-version where term_charset was in fe-text */ g_ascii_strcasecmp(node->key, "term_charset") == 0) { @@ -520,7 +520,7 @@ void settings_check_module(const char *module) if (backwards_compatibility(module, node, parent)) continue; - if (set == NULL || strcmp(set->module, module) != 0) { + if (set == NULL || g_strcmp0(set->module, module) != 0) { g_string_append_printf(errors, " %s", node->key); count++; } @@ -548,9 +548,9 @@ void settings_check_module(const char *module) static int settings_compare(SETTINGS_REC *v1, SETTINGS_REC *v2) { - int cmp = strcmp(v1->section, v2->section); + int cmp = g_strcmp0(v1->section, v2->section); if (!cmp) - cmp = strcmp(v1->key, v2->key); + cmp = g_strcmp0(v1->key, v2->key); return cmp; } diff --git a/src/fe-common/core/command-history.c b/src/fe-common/core/command-history.c index 37405c43..f9c3884c 100644 --- a/src/fe-common/core/command-history.c +++ b/src/fe-common/core/command-history.c @@ -42,7 +42,7 @@ void command_history_add(HISTORY_REC *history, const char *text) g_return_if_fail(text != NULL); link = g_list_last(history->list); - if (link != NULL && strcmp(link->data, text) == 0) + if (link != NULL && g_strcmp0(link->data, text) == 0) return; /* same as previous entry */ if (settings_get_int("max_command_history") < 1 || @@ -121,7 +121,7 @@ const char *command_history_prev(WINDOW_REC *window, const char *text) } if (*text != '\0' && - (pos == NULL || strcmp(pos->data, text) != 0)) { + (pos == NULL || g_strcmp0(pos->data, text) != 0)) { /* save the old entry to history */ command_history_add(history, text); } @@ -145,7 +145,7 @@ const char *command_history_next(WINDOW_REC *window, const char *text) } if (*text != '\0' && - (pos == NULL || strcmp(pos->data, text) != 0)) { + (pos == NULL || g_strcmp0(pos->data, text) != 0)) { /* save the old entry to history */ command_history_add(history, text); } diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c index 2223b5b5..312e417c 100644 --- a/src/fe-common/core/completion.c +++ b/src/fe-common/core/completion.c @@ -141,7 +141,7 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, i g_return_val_if_fail(pos != NULL, NULL); continue_complete = complist != NULL && *pos == last_line_pos && - strcmp(line, last_line) == 0; + g_strcmp0(line, last_line) == 0; if (erase && !continue_complete) return NULL; @@ -681,7 +681,7 @@ static void sig_complete_set(GList **list, WINDOW_REC *window, g_return_if_fail(line != NULL); if (*line == '\0' || - !strcmp("-clear", line) || !strcmp("-default", line)) + !g_strcmp0("-clear", line) || !g_strcmp0("-default", line)) *list = completion_get_settings(word, -1); else if (*line != '\0' && *word == '\0') { SETTINGS_REC *rec = settings_get_record(line); diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c index aefd1034..a171596d 100644 --- a/src/fe-common/core/fe-channels.c +++ b/src/fe-common/core/fe-channels.c @@ -287,7 +287,7 @@ static void cmd_channel_add(const char *data) if (g_hash_table_lookup(optlist, "noauto")) rec->autojoin = FALSE; if (botarg != NULL && *botarg != '\0') rec->botmasks = g_strdup(botarg); if (botcmdarg != NULL && *botcmdarg != '\0') rec->autosendcmd = g_strdup(botcmdarg); - if (*password != '\0' && strcmp(password, "-") != 0) rec->password = g_strdup(password); + if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password); signal_emit("channel add fill", 2, rec, optlist); @@ -523,7 +523,7 @@ static void cmd_names(const char *data, SERVER_REC *server, WI_ITEM_REC *item) "names", &optlist, &channel)) return; - if (strcmp(channel, "*") == 0 || *channel == '\0') { + if (g_strcmp0(channel, "*") == 0 || *channel == '\0') { if (!IS_CHANNEL(item)) cmd_param_error(CMDERR_NOT_JOINED); @@ -561,7 +561,7 @@ static void cmd_names(const char *data, SERVER_REC *server, WI_ITEM_REC *item) if (unknowns->len > 1) g_string_truncate(unknowns, unknowns->len-1); - if (unknowns->len > 0 && strcmp(channel, unknowns->str) != 0) + if (unknowns->len > 0 && g_strcmp0(channel, unknowns->str) != 0) signal_emit("command names", 3, unknowns->str, server, item); g_string_free(unknowns, TRUE); diff --git a/src/fe-common/core/fe-exec.c b/src/fe-common/core/fe-exec.c index 9249f432..b5f289ce 100644 --- a/src/fe-common/core/fe-exec.c +++ b/src/fe-common/core/fe-exec.c @@ -161,7 +161,7 @@ static PROCESS_REC *process_find(const char *name, int verbose) for (tmp = processes; tmp != NULL; tmp = tmp->next) { PROCESS_REC *rec = tmp->data; - if (rec->name != NULL && strcmp(rec->name, name) == 0) + if (rec->name != NULL && g_strcmp0(rec->name, name) == 0) return rec; } diff --git a/src/fe-common/core/fe-help.c b/src/fe-common/core/fe-help.c index 4ea7c89f..23a6e701 100644 --- a/src/fe-common/core/fe-help.c +++ b/src/fe-common/core/fe-help.c @@ -37,12 +37,12 @@ static int commands_equal(COMMAND_REC *rec, COMMAND_REC *rec2) if (rec2->category == NULL && rec->category != NULL) return 1; if (rec->category != NULL && rec2->category != NULL) { - i = strcmp(rec->category, rec2->category); + i = g_strcmp0(rec->category, rec2->category); if (i != 0) return i; } - return strcmp(rec->cmd, rec2->cmd); + return g_strcmp0(rec->cmd, rec2->cmd); } static int get_cmd_length(void *data) @@ -176,7 +176,7 @@ static void show_help(const char *data) if (last != NULL && rec->category != NULL && (last->category == NULL || - strcmp(rec->category, last->category) != 0)) { + g_strcmp0(rec->category, last->category) != 0)) { /* category changed */ if (items > 0) { if (!header) { diff --git a/src/fe-common/core/fe-ignore.c b/src/fe-common/core/fe-ignore.c index 1a0b8339..533cda31 100644 --- a/src/fe-common/core/fe-ignore.c +++ b/src/fe-common/core/fe-ignore.c @@ -165,7 +165,7 @@ static void cmd_ignore(const char *data) rec = g_new0(IGNORE_REC, 1); rec->mask = mask == NULL || *mask == '\0' || - strcmp(mask, "*") == 0 ? NULL : g_strdup(mask); + g_strcmp0(mask, "*") == 0 ? NULL : g_strdup(mask); rec->channels = channels; } else { g_free_and_null(rec->pattern); diff --git a/src/fe-common/core/fe-log.c b/src/fe-common/core/fe-log.c index 9d68faf9..a39623d2 100644 --- a/src/fe-common/core/fe-log.c +++ b/src/fe-common/core/fe-log.c @@ -485,7 +485,7 @@ static void autolog_open_check(TEXT_DEST_REC *dest) return; if (target != NULL) - autolog_open(server, server_tag, strcmp(target, "*") ? target : deftarget); + autolog_open(server, server_tag, g_strcmp0(target, "*") ? target : deftarget); } static void log_single_line(WINDOW_REC *window, const char *server_tag, @@ -629,7 +629,7 @@ static void sig_log_create_failed(LOG_REC *log) static void sig_log_new(LOG_REC *log) { if (!settings_get_bool("awaylog_colors") && - strcmp(log->fname, settings_get_str("awaylog_file")) == 0) + g_strcmp0(log->fname, settings_get_str("awaylog_file")) == 0) log->colorizer = log_colorizer_strip; } diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c index 1d44bdd9..3bd2b666 100644 --- a/src/fe-common/core/fe-messages.c +++ b/src/fe-common/core/fe-messages.c @@ -249,7 +249,7 @@ static void sig_message_private(SERVER_REC *server, const char *msg, int level = MSGLEVEL_MSGS; /* own message returned by bouncer? */ - int own = (!strcmp(nick, server->nick)); + int own = (!g_strcmp0(nick, server->nick)); query = query_find(server, own ? target : nick); @@ -323,8 +323,8 @@ static void sig_message_own_private(SERVER_REC *server, const char *msg, /* this should only happen if some special target failed and we should display some error message. currently the special targets are only ',' and '.'. */ - g_return_if_fail(strcmp(origtarget, ",") == 0 || - strcmp(origtarget, ".") == 0); + g_return_if_fail(g_strcmp0(origtarget, ",") == 0 || + g_strcmp0(origtarget, ".") == 0); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, *origtarget == ',' ? TXT_NO_MSGS_GOT : @@ -569,7 +569,7 @@ static int printnick_exists(NICK_REC *first, NICK_REC *ignore, while (first != NULL) { if (first != ignore) { printnick = g_hash_table_lookup(printnicks, first); - if (printnick != NULL && strcmp(printnick, nick) == 0) + if (printnick != NULL && g_strcmp0(printnick, nick) == 0) return TRUE; } diff --git a/src/fe-common/core/fe-queries.c b/src/fe-common/core/fe-queries.c index 5cdf87ee..121417e4 100644 --- a/src/fe-common/core/fe-queries.c +++ b/src/fe-common/core/fe-queries.c @@ -331,7 +331,7 @@ static void sig_message_private(SERVER_REC *server, const char *msg, QUERY_REC *query; /* own message returned by bouncer? */ - int own = (!strcmp(nick, server->nick)); + int own = (!g_strcmp0(nick, server->nick)); /* create query window if needed */ query = privmsg_get_query(server, own ? target : nick, FALSE, MSGLEVEL_MSGS); diff --git a/src/fe-common/core/fe-recode.c b/src/fe-common/core/fe-recode.c index dbc43574..829c89e7 100644 --- a/src/fe-common/core/fe-recode.c +++ b/src/fe-common/core/fe-recode.c @@ -45,7 +45,7 @@ static const char *fe_recode_get_target (WI_ITEM_REC *witem) static int fe_recode_compare_func (CONFIG_NODE *node1, CONFIG_NODE *node2) { - return strcmp(node1->key, node2->key); + return g_strcmp0(node1->key, node2->key); } /* SYNTAX: RECODE */ diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index 2dec1d8a..429e6dac 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -173,6 +173,10 @@ static void cmd_server_add(const char *data) if (value != NULL && *value != '\0') rec->ssl_capath = g_strdup(value); + value = g_hash_table_lookup(optlist, "ssl_ciphers"); + if (value != NULL && *value != '\0') + rec->ssl_ciphers = g_strdup(value); + if ((rec->ssl_cafile != NULL && rec->ssl_cafile[0] != '\0') || (rec->ssl_capath != NULL && rec->ssl_capath[0] != '\0')) rec->ssl_verify = TRUE; @@ -185,7 +189,7 @@ static void cmd_server_add(const char *data) if (g_hash_table_lookup(optlist, "proxy")) rec->no_proxy = FALSE; if (g_hash_table_lookup(optlist, "noproxy")) rec->no_proxy = TRUE; - if (*password != '\0' && strcmp(password, "-") != 0) rec->password = g_strdup(password); + if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password); value = g_hash_table_lookup(optlist, "host"); if (value != NULL && *value != '\0') { rec->own_host = g_strdup(value); @@ -264,7 +268,7 @@ static void cmd_server_connect(const char *data) "connect", &optlist, &addr)) return; - if (*addr == '\0' || strcmp(addr, "+") == 0) + if (*addr == '\0' || g_strcmp0(addr, "+") == 0) cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); if (*addr == '+') window_create(NULL, FALSE); @@ -387,7 +391,7 @@ void fe_server_init(void) command_bind("server remove", NULL, (SIGNAL_FUNC) cmd_server_remove); command_bind_first("server", NULL, (SIGNAL_FUNC) server_command); command_bind_first("disconnect", NULL, (SIGNAL_FUNC) server_command); - command_set_options("server add", "4 6 !! ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath auto noauto proxy noproxy -host -port noautosendcmd"); + command_set_options("server add", "4 6 !! ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers auto noauto proxy noproxy -host -port noautosendcmd"); signal_add("server looking", (SIGNAL_FUNC) sig_server_looking); signal_add("server connecting", (SIGNAL_FUNC) sig_server_connecting); diff --git a/src/fe-common/core/fe-settings.c b/src/fe-common/core/fe-settings.c index 96e03ceb..9c370838 100644 --- a/src/fe-common/core/fe-settings.c +++ b/src/fe-common/core/fe-settings.c @@ -53,7 +53,7 @@ static void set_print_pattern(const char *pattern) if (stristr(rec->key, pattern) == NULL) continue; - if (strcmp(last_section, rec->section) != 0) { + if (g_strcmp0(last_section, rec->section) != 0) { /* print section */ printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_SET_TITLE, rec->section); diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c index de9a3130..87c5d467 100644 --- a/src/fe-common/core/hilight-text.c +++ b/src/fe-common/core/hilight-text.c @@ -168,7 +168,7 @@ static HILIGHT_REC *hilight_find(const char *text, char **channels) if ((channels == NULL && rec->channels == NULL)) return rec; /* no channels - ok */ - if (channels != NULL && strcmp(*channels, "*") == 0) + if (channels != NULL && g_strcmp0(*channels, "*") == 0) return rec; /* ignore channels */ if (channels == NULL || rec->channels == NULL) @@ -306,7 +306,7 @@ void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec) dest->hilight_priority = rec->priority; g_free_and_null(dest->hilight_color); - if (rec->act_color != NULL && strcmp(rec->act_color, "%n") == 0) + if (rec->act_color != NULL && g_strcmp0(rec->act_color, "%n") == 0) dest->level |= MSGLEVEL_NO_ACT; else dest->hilight_color = hilight_get_act_color(rec); @@ -337,14 +337,14 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text, old_level = dest->level; if (!nick_match || (dest->level & MSGLEVEL_HILIGHT)) { - /* update the level / hilight info */ - hilight_update_text_dest(dest, hilight); /* Remove NO_ACT, this means explicitly defined hilights will bypass * /IGNORE ... NO_ACT. * (It's still possible to use /hilight -actcolor %n to hide * hilight/beep). */ dest->level &= ~MSGLEVEL_NO_ACT; + /* update the level / hilight info */ + hilight_update_text_dest(dest, hilight); } if (nick_match) diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index 02c8a8d7..f138d4e2 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -118,7 +118,7 @@ static CONFIG_NODE *key_config_find(const char *key) for (; tmp != NULL; tmp = config_node_next(tmp)) { node = tmp->data; - if (strcmp(config_node_get_str(node, "key", ""), key) == 0) + if (g_strcmp0(config_node_get_str(node, "key", ""), key) == 0) return node; } @@ -211,7 +211,7 @@ static int expand_combo(const char *start, const char *end, GSList **out) for (tmp = info->keys; tmp != NULL; tmp = tmp->next) { KEY_REC *rec = tmp->data; - if (strcmp(rec->data, str) == 0) + if (g_strcmp0(rec->data, str) == 0) list = g_slist_append(list, rec); } @@ -347,7 +347,7 @@ static void key_states_scan_key(const char *key, KEY_REC *rec) { GSList *tmp, *out; - if (strcmp(rec->info->id, "key") == 0) + if (g_strcmp0(rec->info->id, "key") == 0) return; out = g_slist_append(NULL, g_string_new(NULL)); @@ -383,7 +383,7 @@ static void key_states_rescan(void) g_tree_foreach(key_states, (GTraverseFunc) key_state_destroy, NULL); g_tree_destroy(key_states); - key_states = g_tree_new((GCompareFunc) strcmp); + key_states = g_tree_new((GCompareFunc) g_strcmp0); temp = g_string_new(NULL); g_hash_table_foreach(keys, (GHFunc) key_states_scan_key, temp); @@ -860,7 +860,7 @@ void keyboard_init(void) default_keys = g_hash_table_new((GHashFunc) g_str_hash, (GCompareFunc) g_str_equal); keyinfos = NULL; - key_states = g_tree_new((GCompareFunc) strcmp); + key_states = g_tree_new((GCompareFunc) g_strcmp0); key_config_frozen = 0; memset(used_keys, 0, sizeof(used_keys)); diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c index cd4039b9..58e7b557 100644 --- a/src/fe-common/core/themes.c +++ b/src/fe-common/core/themes.c @@ -895,7 +895,7 @@ THEME_REC *theme_load(const char *setname) name = g_strdup(setname); p = strrchr(name, '.'); - if (p != NULL && strcmp(p, ".theme") == 0) { + if (p != NULL && g_strcmp0(p, ".theme") == 0) { /* remove the trailing .theme */ *p = '\0'; } @@ -1358,9 +1358,9 @@ static void read_settings(void) theme = settings_get_str("theme"); len = strlen(current_theme->name); - if (strcmp(current_theme->name, theme) != 0 && + if (g_strcmp0(current_theme->name, theme) != 0 && (strncmp(current_theme->name, theme, len) != 0 || - strcmp(theme+len, ".theme") != 0)) + g_strcmp0(theme+len, ".theme") != 0)) change_theme(theme, TRUE); } diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index 61357324..c6ab68c0 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -127,7 +127,7 @@ static void cmd_window_info(WINDOW_REC *win) win->active_server->tag : "NONE"); } else { if (win->active_server != NULL && - strcmp(win->active_server->tag, win->servertag) != 0) + g_strcmp0(win->active_server->tag, win->servertag) != 0) g_warning("Active server isn't the sticky server!"); printformat_window(win, MSGLEVEL_CLIENTCRAP, @@ -609,7 +609,7 @@ static void cmd_window_name(const char *data) if (win == NULL || win == active_win) window_set_name(active_win, data); else if (active_win->name == NULL || - strcmp(active_win->name, data) != 0) { + g_strcmp0(active_win->name, data) != 0) { printformat_window(active_win, MSGLEVEL_CLIENTERROR, TXT_WINDOW_NAME_NOT_UNIQUE, data); } diff --git a/src/fe-common/irc/dcc/fe-dcc-chat.c b/src/fe-common/irc/dcc/fe-dcc-chat.c index 101aeb31..e2706ba3 100644 --- a/src/fe-common/irc/dcc/fe-dcc-chat.c +++ b/src/fe-common/irc/dcc/fe-dcc-chat.c @@ -243,7 +243,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item) return; /* handle only DCC messages */ - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) dcc = item_get_dcc(item); else if (*target == '=') dcc = dcc_chat_find_id(target+1); diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index d6c02d9f..ec7669ab 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -427,7 +427,7 @@ static void event_no_such_nick(IRC_SERVER_REC *server, const char *data, g_return_if_fail(data != NULL); params = event_get_params(data, 2, NULL, &unick); - if (!strcmp(unick, "*")) + if (!g_strcmp0(unick, "*")) /* more information will be in the description, * e.g. * :Target left IRC. Failed to deliver: [hi] */ print_event_received(server, data, nick, FALSE); @@ -605,7 +605,7 @@ static void print_event_received(IRC_SERVER_REC *server, const char *data, recoded = recode_in(SERVER(server), args, NULL); format = nick == NULL || server->real_address == NULL || - strcmp(nick, server->real_address) == 0 ? + g_strcmp0(nick, server->real_address) == 0 ? IRCTXT_DEFAULT_EVENT : IRCTXT_DEFAULT_EVENT_SERVER; printformat(server, target, MSGLEVEL_CRAP, format, nick, recoded, current_server_event); diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c index b380c214..a23facbd 100644 --- a/src/fe-common/irc/fe-irc-commands.c +++ b/src/fe-common/irc/fe-irc-commands.c @@ -110,7 +110,7 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server, if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &target, &msg)) return; - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) target = item == NULL ? "" : window_item_get_target(item); if (*target == '\0' || *msg == '\0') @@ -133,7 +133,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server, if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST, &target, &ctcpcmd, &ctcpdata)) return; - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) target = item == NULL ? "" : window_item_get_target(item); if (*target == '\0' || *ctcpcmd == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); @@ -162,7 +162,7 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server, if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &target, &text)) return; - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) target = item == NULL ? "" : window_item_get_target(item); if (*target == '\0' || *text == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); @@ -262,7 +262,7 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server, if (chanrec == NULL && *channel == '\0') cmd_param_error(CMDERR_NOT_JOINED); - if (*channel != '\0' && strcmp(channel, "*") != 0) + if (*channel != '\0' && g_strcmp0(channel, "*") != 0) chanrec = irc_channel_find(server, channel); if (chanrec == NULL || !chanrec->synced) { diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c index 314f4f53..94d1ad4a 100644 --- a/src/fe-common/irc/fe-irc-messages.c +++ b/src/fe-common/irc/fe-irc-messages.c @@ -178,7 +178,7 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg, if (ischannel(*target)) { item = irc_channel_find(server, target); } else { - own = (!strcmp(nick, server->nick)); + own = (!g_strcmp0(nick, server->nick)); item = privmsg_get_query(SERVER(server), own ? target : nick, FALSE, level); } diff --git a/src/fe-common/irc/fe-irc-server.c b/src/fe-common/irc/fe-irc-server.c index abde1112..2cb99a2f 100644 --- a/src/fe-common/irc/fe-irc-server.c +++ b/src/fe-common/irc/fe-irc-server.c @@ -52,6 +52,7 @@ const char *get_visible_target(IRC_SERVER_REC *server, const char *target) } /* SYNTAX: SERVER ADD [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>] [-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>] + [-ssl_ciphers <list>] [-auto | -noauto] [-network <network>] [-host <hostname>] [-cmdspeed <ms>] [-cmdmax <count>] [-port <port>] <address> [<port> [<password>]] */ @@ -121,6 +122,8 @@ 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->ssl_ciphers) + g_string_append_printf(str, "ssl_ciphers: %s, ", rec->ssl_ciphers); } if (rec->max_cmds_at_once > 0) diff --git a/src/fe-common/irc/fe-modes.c b/src/fe-common/irc/fe-modes.c index 027d7a76..e5317c0f 100644 --- a/src/fe-common/irc/fe-modes.c +++ b/src/fe-common/irc/fe-modes.c @@ -135,7 +135,7 @@ static void msg_multi_mode(IRC_CHANNEL_REC *channel, const char *sender, signal_add("print starting", (SIGNAL_FUNC) sig_print_starting); rec = mode_find_channel(channel); - if (rec != NULL && strcmp(rec->mode, mode) != 0) { + if (rec != NULL && g_strcmp0(rec->mode, mode) != 0) { /* different mode than last time, show and remove the old */ print_mode(rec); mode_destroy(rec); diff --git a/src/fe-common/irc/fe-whois.c b/src/fe-common/irc/fe-whois.c index a9c3775e..117df120 100644 --- a/src/fe-common/irc/fe-whois.c +++ b/src/fe-common/irc/fe-whois.c @@ -134,8 +134,8 @@ static void event_whois_realhost(IRC_SERVER_REC *server, const char *data) /* <yournick> real hostname <nick> <hostname> */ params = event_get_params(data, 5, NULL, &nick, &txt_real, &txt_hostname, &hostname); - if (strcmp(txt_real, "real") != 0 || - strcmp(txt_hostname, "hostname") != 0) { + if (g_strcmp0(txt_real, "real") != 0 || + g_strcmp0(txt_hostname, "hostname") != 0) { /* <yournick> <nick> :... from <hostname> */ g_free(params); params = event_get_params(data, 3, NULL, &nick, &hostname); @@ -219,7 +219,7 @@ static void event_whois_usermode(IRC_SERVER_REC *server, const char *data) params = event_get_params(data, 4, NULL, &txt_usermodes, &nick, &usermode); - if (strcmp(txt_usermodes, "usermodes") == 0) { + if (g_strcmp0(txt_usermodes, "usermodes") == 0) { /* <yournick> usermodes <nick> usermode */ printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_USERMODE, nick, usermode); diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c index e93f2293..edc4c55d 100644 --- a/src/fe-text/gui-readline.c +++ b/src/fe-text/gui-readline.c @@ -392,7 +392,7 @@ static void sig_gui_key_pressed(gpointer keyp) str[g_unichar_to_utf8(key, str)] = '\0'; } - if (strcmp(str, "^") == 0) { + if (g_strcmp0(str, "^") == 0) { /* change it as ^-, that is an invalid control char */ str[1] = '-'; str[2] = '\0'; diff --git a/src/fe-text/lastlog.c b/src/fe-text/lastlog.c index 417eb484..166d2847 100644 --- a/src/fe-text/lastlog.c +++ b/src/fe-text/lastlog.c @@ -74,6 +74,25 @@ int cmd_options_get_level(const char *cmd, GHashTable *optlist) return retlevel; } +static void prepend_date(WINDOW_REC *window, LINE_REC *rec, GString *line) +{ + THEME_REC *theme = NULL; + TEXT_DEST_REC dest = {0}; + char *format = NULL, datestamp[20] = {0}; + struct tm *tm = localtime(&rec->info.time); + int ret = 0; + + theme = window->theme != NULL ? window->theme : current_theme; + format_create_dest(&dest, NULL, NULL, MSGLEVEL_LASTLOG, window); + format = format_get_text_theme(theme, MODULE_NAME, &dest, TXT_LASTLOG_DATE); + + ret = strftime(datestamp, sizeof(datestamp), format, tm); + g_free(format); + if (ret <= 0) return; + + g_string_prepend(line, datestamp); +} + static void show_lastlog(const char *searchtext, GHashTable *optlist, int start, int count, FILE *fhandle) { @@ -82,7 +101,7 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist, GList *list, *tmp; GString *line; char *str; - int level, before, after, len; + int level, before, after, len, date = FALSE; level = cmd_options_get_level("lastlog", optlist); if (level == -1) return; /* error in options */ @@ -132,6 +151,9 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist, atoi(str) : DEFAULT_LASTLOG_AFTER; } + if (g_hash_table_lookup(optlist, "date") != NULL) + date = TRUE; + list = textbuffer_find_text(WINDOW_GUI(window)->view->buffer, startline, level, MSGLEVEL_LASTLOG, searchtext, before, after, @@ -199,6 +221,9 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist, g_string_prepend(line, timestamp); } + if (date == TRUE) + prepend_date(window, rec, line); + /* write to file/window */ if (fhandle != NULL) { fwrite(line->str, line->len, 1, fhandle); @@ -223,7 +248,7 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist, } /* SYNTAX: LASTLOG [-] [-file <filename>] [-window <ref#|name>] [-new | -away] - [-<level> -<level...>] [-clear] [-count] [-case] + [-<level> -<level...>] [-clear] [-count] [-case] [-date] [-regexp | -word] [-before [<#>]] [-after [<#>]] [-<# before+after>] [<pattern>] [<count> [<start>]] */ static void cmd_lastlog(const char *data) @@ -285,7 +310,7 @@ void lastlog_init(void) { command_bind("lastlog", NULL, (SIGNAL_FUNC) cmd_lastlog); - command_set_options("lastlog", "!- # force clear -file -window new away word regexp case count @a @after @before"); + command_set_options("lastlog", "!- # force clear -file -window new away word regexp case count date @a @after @before"); } void lastlog_deinit(void) diff --git a/src/fe-text/module-formats.c b/src/fe-text/module-formats.c index 1d905095..899827c2 100644 --- a/src/fe-text/module-formats.c +++ b/src/fe-text/module-formats.c @@ -33,6 +33,7 @@ FORMAT_REC gui_text_formats[] = { "lastlog_start", "{hilight Lastlog}:", 0 }, { "lastlog_end", "{hilight End of Lastlog}", 0 }, { "lastlog_separator", "--", 0 }, + { "lastlog_date", "%%F ", 0 }, /* ---- */ { NULL, "Windows", 0 }, diff --git a/src/fe-text/module-formats.h b/src/fe-text/module-formats.h index 4eebfc3e..3fa8c511 100644 --- a/src/fe-text/module-formats.h +++ b/src/fe-text/module-formats.h @@ -10,6 +10,7 @@ enum { TXT_LASTLOG_START, TXT_LASTLOG_END, TXT_LASTLOG_SEPARATOR, + TXT_LASTLOG_DATE, TXT_FILL_2, diff --git a/src/fe-text/statusbar-config.c b/src/fe-text/statusbar-config.c index e8943dac..a47a709e 100644 --- a/src/fe-text/statusbar-config.c +++ b/src/fe-text/statusbar-config.c @@ -95,7 +95,7 @@ statusbar_config_find(STATUSBAR_GROUP_REC *group, const char *name) for (tmp = group->config_bars; tmp != NULL; tmp = tmp->next) { STATUSBAR_CONFIG_REC *config = tmp->data; - if (strcmp(config->name, name) == 0) + if (g_strcmp0(config->name, name) == 0) return config; } @@ -137,7 +137,7 @@ static void statusbar_read_item(STATUSBAR_CONFIG_REC *bar, CONFIG_NODE *node) int priority, right_alignment; priority = config_node_get_int(node, "priority", 0); - right_alignment = strcmp(config_node_get_str(node, "alignment", ""), "right") == 0; + right_alignment = g_strcmp0(config_node_get_str(node, "alignment", ""), "right") == 0; statusbar_item_config_create(bar, node->key, priority, right_alignment); } diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c index b340553f..5448243a 100644 --- a/src/fe-text/statusbar.c +++ b/src/fe-text/statusbar.c @@ -129,7 +129,7 @@ STATUSBAR_GROUP_REC *statusbar_group_find(const char *name) for (tmp = statusbar_groups; tmp != NULL; tmp = tmp->next) { STATUSBAR_GROUP_REC *rec = tmp->data; - if (strcmp(rec->name, name) == 0) + if (g_strcmp0(rec->name, name) == 0) return rec; } @@ -617,7 +617,7 @@ STATUSBAR_REC *statusbar_find(STATUSBAR_GROUP_REC *group, const char *name, STATUSBAR_REC *rec = tmp->data; if (rec->parent_window == window && - strcmp(rec->config->name, name) == 0) + g_strcmp0(rec->config->name, name) == 0) return rec; } diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c index d16987fe..0516cc5f 100644 --- a/src/fe-text/terminfo-core.c +++ b/src/fe-text/terminfo-core.c @@ -646,11 +646,11 @@ static int term_setup(TERM_REC *term) str = g_string_new(NULL); if (term->TI_sgr0) g_string_append(str, term->TI_sgr0); - if (term->TI_rmul && (term->TI_sgr0 == NULL || strcmp(term->TI_rmul, term->TI_sgr0) != 0)) + if (term->TI_rmul && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmul, term->TI_sgr0) != 0)) g_string_append(str, term->TI_rmul); - if (term->TI_rmso && (term->TI_sgr0 == NULL || strcmp(term->TI_rmso, term->TI_sgr0) != 0)) + if (term->TI_rmso && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmso, term->TI_sgr0) != 0)) g_string_append(str, term->TI_rmso); - if (term->TI_ritm && (term->TI_sgr0 == NULL || strcmp(term->TI_ritm, term->TI_sgr0) != 0)) + if (term->TI_ritm && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_ritm, term->TI_sgr0) != 0)) g_string_append(str, term->TI_ritm); term->TI_normal = str->str; g_string_free(str, FALSE); diff --git a/src/irc/core/bans.c b/src/irc/core/bans.c index 38c81aab..b60e681b 100644 --- a/src/irc/core/bans.c +++ b/src/irc/core/bans.c @@ -188,7 +188,7 @@ static void command_set_ban(const char *data, IRC_SERVER_REC *server, item, &channel, &nicks)) return; if (!ischannel(*channel)) cmd_param_error(CMDERR_NOT_JOINED); if (*nicks == '\0') { - if (strcmp(data, "*") != 0) + if (g_strcmp0(data, "*") != 0) cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); /* /BAN * or /UNBAN * - ban/unban everyone */ nicks = (char *) data; @@ -318,7 +318,7 @@ static void cmd_unban(const char *data, IRC_SERVER_REC *server, void *item) static void read_settings(void) { if (default_ban_type_str != NULL && - strcmp(default_ban_type_str, settings_get_str("ban_type")) == 0) + g_strcmp0(default_ban_type_str, settings_get_str("ban_type")) == 0) return; g_free_not_null(default_ban_type_str); diff --git a/src/irc/core/channel-events.c b/src/irc/core/channel-events.c index 6fdfeef3..6cb9b088 100644 --- a/src/irc/core/channel-events.c +++ b/src/irc/core/channel-events.c @@ -270,7 +270,7 @@ static void event_join(IRC_SERVER_REC *server, const char *data, const char *nic } chanrec->joined = TRUE; - if (strcmp(chanrec->name, channel) != 0) { + if (g_strcmp0(chanrec->name, channel) != 0) { g_free(chanrec->name); chanrec->name = g_strdup(channel); } diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index 7c3d3f5f..e7fb5067 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -72,7 +72,7 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server, if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &target, &msg)) return; - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) target = item == NULL ? NULL : window_item_get_target(item); if (target == NULL || *target == '\0' || *msg == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); @@ -99,7 +99,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server, if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST, &target, &ctcpcmd, &ctcpdata)) return; - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) target = item == NULL ? NULL : window_item_get_target(item); if (target == NULL || *target == '\0' || *ctcpcmd == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); @@ -133,7 +133,7 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server, if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST, &target, &ctcpcmd, &ctcpdata)) return; - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) target = item == NULL ? NULL : window_item_get_target(item); if (target == NULL || *target == '\0' || *ctcpcmd == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); @@ -238,7 +238,7 @@ static void cmd_invite(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *it return; if (*nick == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - if (*channame == '\0' || strcmp(channame, "*") == 0) { + if (*channame == '\0' || g_strcmp0(channame, "*") == 0) { if (!IS_IRC_CHANNEL(item)) cmd_param_error(CMDERR_NOT_JOINED); @@ -284,13 +284,13 @@ static void cmd_who(const char *data, IRC_SERVER_REC *server, if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &channel, &rest)) return; - if (strcmp(channel, "*") == 0 || *channel == '\0') { + if (g_strcmp0(channel, "*") == 0 || *channel == '\0') { if (!IS_IRC_CHANNEL(item)) cmd_param_error(CMDERR_NOT_JOINED); channel = IRC_CHANNEL(item)->name; } - if (strcmp(channel, "**") == 0) { + if (g_strcmp0(channel, "**") == 0) { /* ** displays all nicks.. */ *channel = '\0'; } @@ -313,14 +313,14 @@ static void cmd_names(const char *data, IRC_SERVER_REC *server, PARAM_FLAG_GETREST, "names", &optlist, &channel)) return; - if (strcmp(channel, "*") == 0 || *channel == '\0') { + if (g_strcmp0(channel, "*") == 0 || *channel == '\0') { if (!IS_IRC_CHANNEL(item)) cmd_param_error(CMDERR_NOT_JOINED); channel = IRC_CHANNEL(item)->name; } - if (strcmp(channel, "**") == 0) { + if (g_strcmp0(channel, "**") == 0) { /* ** displays all nicks.. */ irc_send_cmd(server, "NAMES"); } else { @@ -409,7 +409,7 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server, query = qserver = queryitem->name; } - if (strcmp(query, "*") == 0 && + if (g_strcmp0(query, "*") == 0 && g_hash_table_lookup(optlist, "yes") == NULL) cmd_param_error(CMDERR_NOT_GOOD_IDEA); @@ -810,7 +810,7 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server, for (ptr = server->knockoutlist; ptr != NULL; ptr = ptr->next) { rec = ptr->data; if (channel == rec->channel && - !strcmp(rec->ban, banmasks)) + !g_strcmp0(rec->ban, banmasks)) break; } if (ptr == NULL) { diff --git a/src/irc/core/irc-queries.c b/src/irc/core/irc-queries.c index ac1a72a1..72c17df1 100644 --- a/src/irc/core/irc-queries.c +++ b/src/irc/core/irc-queries.c @@ -67,13 +67,13 @@ static void check_query_changes(IRC_SERVER_REC *server, const char *nick, if (query == NULL) return; - if (strcmp(query->name, nick) != 0) { + if (g_strcmp0(query->name, nick) != 0) { /* upper/lowercase chars in nick changed */ query_change_nick(query, nick); } if (address != NULL && (query->address == NULL || - strcmp(query->address, address) != 0)) { + g_strcmp0(query->address, address) != 0)) { /* host changed */ query_change_address(query, address); } @@ -109,7 +109,7 @@ static void event_nick(SERVER_REC *server, const char *data, query = query_find(server, orignick); if (query != NULL) { params = event_get_params(data, 1, &nick); - if (strcmp(query->name, nick) != 0) + if (g_strcmp0(query->name, nick) != 0) query_change_nick(query, nick); g_free(params); } diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index baf8a0d2..d7122eae 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -638,7 +638,7 @@ static void event_connected(IRC_SERVER_REC *server, const char *data, const char params = event_get_params(data, 1, &nick); - if (strcmp(server->nick, nick) != 0) { + if (g_strcmp0(server->nick, nick) != 0) { /* nick changed unexpectedly .. connected via proxy, etc. */ g_free(server->nick); server->nick = g_strdup(nick); diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c index ebaf4b8f..a812691c 100644 --- a/src/irc/core/modes.c +++ b/src/irc/core/modes.c @@ -398,7 +398,7 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby, old_key = NULL; } - if (strcmp(newmode->str, channel->mode) != 0) { + if (g_strcmp0(newmode->str, channel->mode) != 0) { g_free(channel->mode); channel->mode = g_strdup(newmode->str); @@ -842,7 +842,7 @@ static void cmd_mode(const char *data, IRC_SERVER_REC *server, return; } - if (strcmp(target, "*") == 0) { + if (g_strcmp0(target, "*") == 0) { if (!IS_IRC_CHANNEL(channel)) cmd_param_error(CMDERR_NOT_JOINED); diff --git a/src/irc/core/servers-redirect.c b/src/irc/core/servers-redirect.c index 518248cb..f0a285df 100644 --- a/src/irc/core/servers-redirect.c +++ b/src/irc/core/servers-redirect.c @@ -339,7 +339,7 @@ static GSList *redirect_cmd_list_find(GSList *list, const char *event) while (list != NULL) { const char *str = list->data; - if (strcmp(str, event) == 0) + if (g_strcmp0(str, event) == 0) break; list = list->next->next; } @@ -365,7 +365,7 @@ static const char *redirect_match(REDIRECT_REC *redirect, const char *event, use the default signal */ signal = NULL; for (tmp = redirect->signals; tmp != NULL; tmp = tmp->next->next) { - if (strcmp(tmp->data, event) == 0) { + if (g_strcmp0(tmp->data, event) == 0) { signal = tmp->next->data; break; } @@ -527,7 +527,7 @@ server_redirect_get(IRC_SERVER_REC *server, const char *prefix, next = ptr->next; r = ptr->data; if (prefix != NULL && r->prefix != NULL && - strcmp(prefix, r->prefix)) { + g_strcmp0(prefix, r->prefix)) { /* not from this server */ continue; } diff --git a/src/irc/dcc/dcc-autoget.c b/src/irc/dcc/dcc-autoget.c index 4768641b..38170c56 100644 --- a/src/irc/dcc/dcc-autoget.c +++ b/src/irc/dcc/dcc-autoget.c @@ -57,7 +57,7 @@ static void sig_dcc_request(GET_DCC_REC *dcc, const char *nickaddr) /* don't autoget files beginning with a dot, if download dir is our home dir (stupid kludge for stupid people) */ if (*dcc->arg == '.' && - strcmp(settings_get_str("dcc_download_path"), "~") == 0) + g_strcmp0(settings_get_str("dcc_download_path"), "~") == 0) return; /* check file size limit, NOTE: it's still possible to send a diff --git a/src/irc/dcc/dcc-chat.c b/src/irc/dcc/dcc-chat.c index 8ee4decd..e3dbe72d 100644 --- a/src/irc/dcc/dcc-chat.c +++ b/src/irc/dcc/dcc-chat.c @@ -191,7 +191,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item) return; /* handle only DCC messages */ - if (strcmp(target, "*") == 0) + if (g_strcmp0(target, "*") == 0) dcc = item_get_dcc(item); else if (*target == '=') dcc = dcc_chat_find_id(target+1); @@ -625,7 +625,7 @@ static void ctcp_msg_dcc_chat(IRC_SERVER_REC *server, const char *data, g_strfreev(params); return; } - passive = paramcount == 4 && strcmp(params[2], "0") == 0; + passive = paramcount == 4 && g_strcmp0(params[2], "0") == 0; dcc = DCC_CHAT(dcc_find_request(DCC_CHAT_TYPE, nick, NULL)); if (dcc != NULL) { diff --git a/src/irc/dcc/dcc-get.c b/src/irc/dcc/dcc-get.c index 69fdc746..1208b5c5 100644 --- a/src/irc/dcc/dcc-get.c +++ b/src/irc/dcc/dcc-get.c @@ -554,7 +554,7 @@ void cmd_dcc_receive(const char *data, DCC_GET_FUNC accept_func, next = tmp->next; if (IS_DCC_GET(dcc) && g_ascii_strcasecmp(dcc->nick, nick) == 0 && (dcc_is_waiting_user(dcc) || dcc->from_dccserver) && - (*fname == '\0' || strcmp(dcc->arg, fname) == 0)) { + (*fname == '\0' || g_strcmp0(dcc->arg, fname) == 0)) { found = TRUE; if (!dcc_is_passive(dcc)) accept_func(dcc); diff --git a/src/irc/dcc/dcc.c b/src/irc/dcc/dcc.c index 6f0d5c81..17f6c477 100644 --- a/src/irc/dcc/dcc.c +++ b/src/irc/dcc/dcc.c @@ -149,7 +149,7 @@ DCC_REC *dcc_find_request(int type, const char *nick, const char *arg) if (dcc->type == type && !dcc_is_connected(dcc) && g_ascii_strcasecmp(dcc->nick, nick) == 0 && - (arg == NULL || strcmp(dcc->arg, arg) == 0)) + (arg == NULL || g_strcmp0(dcc->arg, arg) == 0)) return dcc; } @@ -516,7 +516,7 @@ static void cmd_dcc_close(char *data, IRC_SERVER_REC *server) next = tmp->next; if (dcc->type == type && g_ascii_strcasecmp(dcc->nick, nick) == 0 && - (*arg == '\0' || strcmp(dcc->arg, arg) == 0)) { + (*arg == '\0' || g_strcmp0(dcc->arg, arg) == 0)) { dcc_reject(dcc, server); found = TRUE; } diff --git a/src/irc/notifylist/notifylist.c b/src/irc/notifylist/notifylist.c index b0b7ee1c..573f7a7f 100644 --- a/src/irc/notifylist/notifylist.c +++ b/src/irc/notifylist/notifylist.c @@ -91,7 +91,7 @@ int notifylist_ircnets_match(NOTIFYLIST_REC *rec, const char *ircnet) if (rec->ircnets == NULL) return TRUE; if (ircnet == NULL) return FALSE; - if (strcmp(ircnet, "*") == 0) return TRUE; + if (g_strcmp0(ircnet, "*") == 0) return TRUE; for (tmp = rec->ircnets; *tmp != NULL; tmp++) { if (g_ascii_strcasecmp(*tmp, ircnet) == 0) diff --git a/src/irc/proxy/dump.c b/src/irc/proxy/dump.c index 80fd7c2e..3d7bf546 100644 --- a/src/irc/proxy/dump.c +++ b/src/irc/proxy/dump.c @@ -209,7 +209,7 @@ static void dump_join(IRC_CHANNEL_REC *channel, CLIENT_REC *client) void proxy_client_reset_nick(CLIENT_REC *client) { if (client->server == NULL || - strcmp(client->nick, client->server->nick) == 0) + g_strcmp0(client->nick, client->server->nick) == 0) return; proxy_outdata(client, ":%s!proxy NICK :%s\n", diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c index 33392285..4c3bcf68 100644 --- a/src/irc/proxy/listen.c +++ b/src/irc/proxy/listen.c @@ -82,7 +82,7 @@ static void grab_who(CLIENT_REC *client, const char *channel) arg = g_string_new(channel); for (tmp = list, count = 0; *tmp != NULL; tmp++, count++) { - if (strcmp(*tmp, "0") == 0) { + if (g_strcmp0(*tmp, "0") == 0) { /* /who 0 displays everyone */ **tmp = '*'; } @@ -106,18 +106,18 @@ static void handle_client_connect_cmd(CLIENT_REC *client, password = settings_get_str("irssiproxy_password"); - if (password != NULL && strcmp(cmd, "PASS") == 0) { - if (strcmp(password, args) == 0) + if (password != NULL && g_strcmp0(cmd, "PASS") == 0) { + if (g_strcmp0(password, args) == 0) client->pass_sent = TRUE; else { /* wrong password! */ remove_client(client); return; } - } else if (strcmp(cmd, "NICK") == 0) { + } else if (g_strcmp0(cmd, "NICK") == 0) { g_free_not_null(client->nick); client->nick = g_strdup(args); - } else if (strcmp(cmd, "USER") == 0) { + } else if (g_strcmp0(cmd, "USER") == 0) { client->user_sent = TRUE; } @@ -141,12 +141,12 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args, return; } - if (strcmp(cmd, "QUIT") == 0) { + if (g_strcmp0(cmd, "QUIT") == 0) { remove_client(client); return; } - if (strcmp(cmd, "PING") == 0) { + if (g_strcmp0(cmd, "PING") == 0) { /* Reply to PING, if the target parameter is either proxy_adress, our own nick or empty. */ char *params, *origin, *target; @@ -164,7 +164,7 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args, g_free(params); } - if (strcmp(cmd, "PROXY") == 0) { + if (g_strcmp0(cmd, "PROXY") == 0) { if (g_ascii_strcasecmp(args, "CTCP ON") == 0) { /* client wants all ctcps */ client->want_ctcp = 1; @@ -200,11 +200,11 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args, } /* check if the command could be redirected */ - if (strcmp(cmd, "WHO") == 0) + if (g_strcmp0(cmd, "WHO") == 0) grab_who(client, args); - else if (strcmp(cmd, "WHOWAS") == 0) + else if (g_strcmp0(cmd, "WHOWAS") == 0) proxy_redirect_event(client, "whowas", 1, args, -1); - else if (strcmp(cmd, "WHOIS") == 0) { + else if (g_strcmp0(cmd, "WHOIS") == 0) { char *p; /* convert dots to spaces */ @@ -212,11 +212,11 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args, if (*p == ',') *p = ' '; proxy_redirect_event(client, "whois", 1, args, TRUE); - } else if (strcmp(cmd, "ISON") == 0) + } else if (g_strcmp0(cmd, "ISON") == 0) proxy_redirect_event(client, "ison", 1, args, -1); - else if (strcmp(cmd, "USERHOST") == 0) + else if (g_strcmp0(cmd, "USERHOST") == 0) proxy_redirect_event(client, "userhost", 1, args, -1); - else if (strcmp(cmd, "MODE") == 0) { + else if (g_strcmp0(cmd, "MODE") == 0) { /* convert dots to spaces */ char *slist, *str, mode, *p; int argc; @@ -252,7 +252,7 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args, } g_free(str); g_free(slist); - } else if (strcmp(cmd, "PRIVMSG") == 0) { + } else if (g_strcmp0(cmd, "PRIVMSG") == 0) { /* send the message to other clients as well */ char *params, *target, *msg; @@ -283,9 +283,9 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args, } ignore_next = FALSE; g_free(params); - } else if (strcmp(cmd, "PING") == 0) { + } else if (g_strcmp0(cmd, "PING") == 0) { proxy_redirect_event(client, "ping", 1, NULL, TRUE); - } else if (strcmp(cmd, "AWAY") == 0) { + } else if (g_strcmp0(cmd, "AWAY") == 0) { /* set the away reason */ if (args != NULL) { g_free(client->server->away_reason); @@ -347,7 +347,7 @@ static void sig_listen(LISTEN_REC *listen) rec->listen = listen; rec->handle = sendbuf; rec->host = g_strdup(host); - if (strcmp(listen->ircnet, "*") == 0) { + if (g_strcmp0(listen->ircnet, "*") == 0) { rec->proxy_address = g_strdup("irc.proxy"); rec->server = servers == NULL ? NULL : IRC_SERVER(servers->data); } else { @@ -415,7 +415,7 @@ static void sig_server_event(IRC_SERVER_REC *server, const char *line, } } - if (strcmp(event, "event privmsg") == 0 && + if (g_strcmp0(event, "event privmsg") == 0 && strstr(args, " :\001") != NULL && strstr(args, " :\001ACTION") == NULL) { /* CTCP - either answer ourself or forward it to one client */ @@ -435,8 +435,8 @@ static void sig_server_event(IRC_SERVER_REC *server, const char *line, return; } - if (strcmp(event, "event ping") == 0 || - strcmp(event, "event pong") == 0) { + if (g_strcmp0(event, "event ping") == 0 || + g_strcmp0(event, "event pong") == 0) { /* We want to answer ourself to PINGs and CTCPs. Also hide PONGs from clients. */ g_free(event); @@ -462,7 +462,7 @@ static void event_connected(IRC_SERVER_REC *server) CLIENT_REC *rec = tmp->data; if (rec->connected && rec->server == NULL && - (strcmp(rec->listen->ircnet, "*") == 0 || + (g_strcmp0(rec->listen->ircnet, "*") == 0 || (chatnet != NULL && g_ascii_strcasecmp(chatnet, rec->listen->ircnet) == 0))) { proxy_outdata(rec, ":%s NOTICE %s :Connected to server\n", diff --git a/src/lib-config/set.c b/src/lib-config/set.c index 5c187035..7ca55871 100644 --- a/src/lib-config/set.c +++ b/src/lib-config/set.c @@ -111,7 +111,7 @@ void config_node_set_str(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key, node = NULL; } if (node != NULL) { - if (strcmp(node->value, value) == 0) + if (g_strcmp0(node->value, value) == 0) return; g_free(node->value); } else { diff --git a/src/perl/common/Core.xs b/src/perl/common/Core.xs index bfe2efde..5d2f7bca 100644 --- a/src/perl/common/Core.xs +++ b/src/perl/common/Core.xs @@ -63,7 +63,7 @@ static void add_tuple(gpointer key_, gpointer value_, gpointer user_data) HV *hash = user_data; char *key = key_; char *value = value_; - hv_store(hash, key, strlen(key), new_pv(value), 0); + (void) hv_store(hash, key, strlen(key), new_pv(value), 0); } static void wrap_signal_emit(void *signal, void **p) { diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs index 22a87384..18665cb7 100644 --- a/src/perl/irc/Irc.xs +++ b/src/perl/irc/Irc.xs @@ -6,90 +6,90 @@ static int initialized = FALSE; static void perl_irc_connect_fill_hash(HV *hv, IRC_SERVER_CONNECT_REC *conn) { perl_connect_fill_hash(hv, (SERVER_CONNECT_REC *) conn); - hv_store(hv, "alternate_nick", 14, new_pv(conn->alternate_nick), 0); + (void) hv_store(hv, "alternate_nick", 14, new_pv(conn->alternate_nick), 0); } static void perl_irc_server_fill_hash(HV *hv, IRC_SERVER_REC *server) { perl_server_fill_hash(hv, (SERVER_REC *) server); - hv_store(hv, "real_address", 12, new_pv(server->real_address), 0); - hv_store(hv, "usermode", 8, new_pv(server->usermode), 0); - hv_store(hv, "userhost", 8, new_pv(server->userhost), 0); + (void) hv_store(hv, "real_address", 12, new_pv(server->real_address), 0); + (void) hv_store(hv, "usermode", 8, new_pv(server->usermode), 0); + (void) hv_store(hv, "userhost", 8, new_pv(server->userhost), 0); - hv_store(hv, "max_cmds_at_once", 16, newSViv(server->max_cmds_at_once), 0); - hv_store(hv, "cmd_queue_speed", 15, newSViv(server->cmd_queue_speed), 0); - hv_store(hv, "max_query_chans", 15, newSViv(server->max_query_chans), 0); + (void) hv_store(hv, "max_cmds_at_once", 16, newSViv(server->max_cmds_at_once), 0); + (void) hv_store(hv, "cmd_queue_speed", 15, newSViv(server->cmd_queue_speed), 0); + (void) hv_store(hv, "max_query_chans", 15, newSViv(server->max_query_chans), 0); - hv_store(hv, "max_kicks_in_cmd", 16, newSViv(server->max_kicks_in_cmd), 0); - hv_store(hv, "max_msgs_in_cmd", 15, newSViv(server->max_msgs_in_cmd), 0); - hv_store(hv, "max_modes_in_cmd", 16, newSViv(server->max_modes_in_cmd), 0); - hv_store(hv, "max_whois_in_cmd", 16, newSViv(server->max_whois_in_cmd), 0); - hv_store(hv, "isupport_sent", 13, newSViv(server->isupport_sent), 0); + (void) hv_store(hv, "max_kicks_in_cmd", 16, newSViv(server->max_kicks_in_cmd), 0); + (void) hv_store(hv, "max_msgs_in_cmd", 15, newSViv(server->max_msgs_in_cmd), 0); + (void) hv_store(hv, "max_modes_in_cmd", 16, newSViv(server->max_modes_in_cmd), 0); + (void) hv_store(hv, "max_whois_in_cmd", 16, newSViv(server->max_whois_in_cmd), 0); + (void) hv_store(hv, "isupport_sent", 13, newSViv(server->isupport_sent), 0); } static void perl_ban_fill_hash(HV *hv, BAN_REC *ban) { - hv_store(hv, "ban", 3, new_pv(ban->ban), 0); - hv_store(hv, "setby", 5, new_pv(ban->setby), 0); - hv_store(hv, "time", 4, newSViv(ban->time), 0); + (void) hv_store(hv, "ban", 3, new_pv(ban->ban), 0); + (void) hv_store(hv, "setby", 5, new_pv(ban->setby), 0); + (void) hv_store(hv, "time", 4, newSViv(ban->time), 0); } static void perl_dcc_fill_hash(HV *hv, DCC_REC *dcc) { - hv_store(hv, "type", 4, new_pv(dcc_type2str(dcc->type)), 0); - hv_store(hv, "orig_type", 9, new_pv(dcc_type2str(dcc->orig_type)), 0); - hv_store(hv, "created", 7, newSViv(dcc->created), 0); + (void) hv_store(hv, "type", 4, new_pv(dcc_type2str(dcc->type)), 0); + (void) hv_store(hv, "orig_type", 9, new_pv(dcc_type2str(dcc->orig_type)), 0); + (void) hv_store(hv, "created", 7, newSViv(dcc->created), 0); - hv_store(hv, "server", 6, iobject_bless(dcc->server), 0); - hv_store(hv, "servertag", 9, new_pv(dcc->servertag), 0); - hv_store(hv, "mynick", 6, new_pv(dcc->mynick), 0); - hv_store(hv, "nick", 4, new_pv(dcc->nick), 0); + (void) hv_store(hv, "server", 6, iobject_bless(dcc->server), 0); + (void) hv_store(hv, "servertag", 9, new_pv(dcc->servertag), 0); + (void) hv_store(hv, "mynick", 6, new_pv(dcc->mynick), 0); + (void) hv_store(hv, "nick", 4, new_pv(dcc->nick), 0); - hv_store(hv, "chat", 4, simple_iobject_bless(dcc->chat), 0); - hv_store(hv, "target", 6, new_pv(dcc->target), 0); - hv_store(hv, "arg", 3, new_pv(dcc->arg), 0); + (void) hv_store(hv, "chat", 4, simple_iobject_bless(dcc->chat), 0); + (void) hv_store(hv, "target", 6, new_pv(dcc->target), 0); + (void) hv_store(hv, "arg", 3, new_pv(dcc->arg), 0); - hv_store(hv, "addr", 4, new_pv(dcc->addrstr), 0); - hv_store(hv, "port", 4, newSViv(dcc->port), 0); + (void) hv_store(hv, "addr", 4, new_pv(dcc->addrstr), 0); + (void) hv_store(hv, "port", 4, newSViv(dcc->port), 0); - hv_store(hv, "starttime", 9, newSViv(dcc->starttime), 0); - hv_store(hv, "transfd", 7, newSViv(dcc->transfd), 0); + (void) hv_store(hv, "starttime", 9, newSViv(dcc->starttime), 0); + (void) hv_store(hv, "transfd", 7, newSViv(dcc->transfd), 0); } static void perl_dcc_chat_fill_hash(HV *hv, CHAT_DCC_REC *dcc) { perl_dcc_fill_hash(hv, (DCC_REC *) dcc); - hv_store(hv, "id", 2, new_pv(dcc->id), 0); - hv_store(hv, "mirc_ctcp", 9, newSViv(dcc->mirc_ctcp), 0); - hv_store(hv, "connection_lost", 15, newSViv(dcc->connection_lost), 0); + (void) hv_store(hv, "id", 2, new_pv(dcc->id), 0); + (void) hv_store(hv, "mirc_ctcp", 9, newSViv(dcc->mirc_ctcp), 0); + (void) hv_store(hv, "connection_lost", 15, newSViv(dcc->connection_lost), 0); } static void perl_dcc_file_fill_hash(HV *hv, FILE_DCC_REC *dcc) { perl_dcc_fill_hash(hv, (DCC_REC *) dcc); - hv_store(hv, "size", 4, newSViv(dcc->size), 0); - hv_store(hv, "skipped", 7, newSViv(dcc->skipped), 0); + (void) hv_store(hv, "size", 4, newSViv(dcc->size), 0); + (void) hv_store(hv, "skipped", 7, newSViv(dcc->skipped), 0); } static void perl_dcc_get_fill_hash(HV *hv, GET_DCC_REC *dcc) { perl_dcc_file_fill_hash(hv, (FILE_DCC_REC *) dcc); - hv_store(hv, "get_type", 8, newSViv(dcc->get_type), 0); - hv_store(hv, "file", 4, new_pv(dcc->file), 0); - hv_store(hv, "file_quoted", 11, newSViv(dcc->file_quoted), 0); + (void) hv_store(hv, "get_type", 8, newSViv(dcc->get_type), 0); + (void) hv_store(hv, "file", 4, new_pv(dcc->file), 0); + (void) hv_store(hv, "file_quoted", 11, newSViv(dcc->file_quoted), 0); } static void perl_dcc_send_fill_hash(HV *hv, SEND_DCC_REC *dcc) { perl_dcc_file_fill_hash(hv, (FILE_DCC_REC *) dcc); - hv_store(hv, "file_quoted", 11, newSViv(dcc->file_quoted), 0); - hv_store(hv, "waitforend", 10, newSViv(dcc->waitforend), 0); - hv_store(hv, "gotalldata", 10, newSViv(dcc->gotalldata), 0); + (void) hv_store(hv, "file_quoted", 11, newSViv(dcc->file_quoted), 0); + (void) hv_store(hv, "waitforend", 10, newSViv(dcc->waitforend), 0); + (void) hv_store(hv, "gotalldata", 10, newSViv(dcc->gotalldata), 0); } static void perl_netsplit_fill_hash(HV *hv, NETSPLIT_REC *netsplit) @@ -97,11 +97,11 @@ static void perl_netsplit_fill_hash(HV *hv, NETSPLIT_REC *netsplit) AV *av; GSList *tmp; - hv_store(hv, "nick", 4, new_pv(netsplit->nick), 0); - hv_store(hv, "address", 7, new_pv(netsplit->address), 0); - hv_store(hv, "destroy", 7, newSViv(netsplit->destroy), 0); + (void) hv_store(hv, "nick", 4, new_pv(netsplit->nick), 0); + (void) hv_store(hv, "address", 7, new_pv(netsplit->address), 0); + (void) hv_store(hv, "destroy", 7, newSViv(netsplit->destroy), 0); - hv_store(hv, "server", 6, + (void) hv_store(hv, "server", 6, plain_bless(netsplit->server, "Irssi::Irc::Netsplitserver"), 0); @@ -110,22 +110,22 @@ static void perl_netsplit_fill_hash(HV *hv, NETSPLIT_REC *netsplit) av_push(av, plain_bless(tmp->data, "Irssi::Irc::Netsplitchannel")); } - hv_store(hv, "channels", 8, newRV_noinc((SV*)av), 0); + (void) hv_store(hv, "channels", 8, newRV_noinc((SV*)av), 0); } static void perl_netsplit_server_fill_hash(HV *hv, NETSPLIT_SERVER_REC *rec) { - hv_store(hv, "server", 6, new_pv(rec->server), 0); - hv_store(hv, "destserver", 10, new_pv(rec->destserver), 0); - hv_store(hv, "count", 5, newSViv(rec->count), 0); + (void) hv_store(hv, "server", 6, new_pv(rec->server), 0); + (void) hv_store(hv, "destserver", 10, new_pv(rec->destserver), 0); + (void) hv_store(hv, "count", 5, newSViv(rec->count), 0); } static void perl_netsplit_channel_fill_hash(HV *hv, NETSPLIT_CHAN_REC *rec) { - hv_store(hv, "name", 4, new_pv(rec->name), 0); - hv_store(hv, "op", 2, newSViv(rec->op), 0); - hv_store(hv, "halfop", 6, newSViv(rec->halfop), 0); - hv_store(hv, "voice", 5, newSViv(rec->voice), 0); + (void) hv_store(hv, "name", 4, new_pv(rec->name), 0); + (void) hv_store(hv, "op", 2, newSViv(rec->op), 0); + (void) hv_store(hv, "halfop", 6, newSViv(rec->halfop), 0); + (void) hv_store(hv, "voice", 5, newSViv(rec->voice), 0); } static void perl_notifylist_fill_hash(HV *hv, NOTIFYLIST_REC *notify) @@ -133,8 +133,8 @@ static void perl_notifylist_fill_hash(HV *hv, NOTIFYLIST_REC *notify) AV *av; char **tmp; - hv_store(hv, "mask", 4, new_pv(notify->mask), 0); - hv_store(hv, "away_check", 10, newSViv(notify->away_check), 0); + (void) hv_store(hv, "mask", 4, new_pv(notify->mask), 0); + (void) hv_store(hv, "away_check", 10, newSViv(notify->away_check), 0); av = newAV(); if (notify->ircnets != NULL) { @@ -142,20 +142,20 @@ static void perl_notifylist_fill_hash(HV *hv, NOTIFYLIST_REC *notify) av_push(av, new_pv(*tmp)); } } - hv_store(hv, "ircnets", 7, newRV_noinc((SV*)av), 0); + (void) hv_store(hv, "ircnets", 7, newRV_noinc((SV*)av), 0); } static void perl_client_fill_hash(HV *hv, CLIENT_REC *client) { - hv_store(hv, "nick", 4, new_pv(client->nick), 0); - hv_store(hv, "host", 4, new_pv(client->host), 0); - hv_store(hv, "proxy_address", 13, new_pv(client->proxy_address), 0); - hv_store(hv, "server", 6, iobject_bless(client->server), 0); - hv_store(hv, "pass_sent", 9, newSViv(client->pass_sent), 0); - hv_store(hv, "user_sent", 9, newSViv(client->user_sent), 0); - hv_store(hv, "connected", 9, newSViv(client->connected), 0); - hv_store(hv, "want_ctcp", 9, newSViv(client->want_ctcp), 0); - hv_store(hv, "ircnet", 6, new_pv(client->listen->ircnet), 0); + (void) hv_store(hv, "nick", 4, new_pv(client->nick), 0); + (void) hv_store(hv, "host", 4, new_pv(client->host), 0); + (void) hv_store(hv, "proxy_address", 13, new_pv(client->proxy_address), 0); + (void) hv_store(hv, "server", 6, iobject_bless(client->server), 0); + (void) hv_store(hv, "pass_sent", 9, newSViv(client->pass_sent), 0); + (void) hv_store(hv, "user_sent", 9, newSViv(client->user_sent), 0); + (void) hv_store(hv, "connected", 9, newSViv(client->connected), 0); + (void) hv_store(hv, "want_ctcp", 9, newSViv(client->want_ctcp), 0); + (void) hv_store(hv, "ircnet", 6, new_pv(client->listen->ircnet), 0); } static PLAIN_OBJECT_INIT_REC irc_plains[] = { diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index 0a8a5d92..dcda3bb5 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -135,7 +135,7 @@ SV *irssi_bless_iobject(int type, int chat_type, void *object) stash = gv_stashpv(rec->stash, 1); hv = newHV(); - hv_store(hv, "_irssi", 6, create_sv_ptr(object), 0); + (void) hv_store(hv, "_irssi", 6, create_sv_ptr(object), 0); rec->fill_func(hv, object); return sv_bless(newRV_noinc((SV*)hv), stash); } @@ -148,7 +148,7 @@ SV *irssi_bless_plain(const char *stash, void *object) fill_func = g_hash_table_lookup(plain_stashes, stash); hv = newHV(); - hv_store(hv, "_irssi", 6, create_sv_ptr(object), 0); + (void) hv_store(hv, "_irssi", 6, create_sv_ptr(object), 0); if (fill_func != NULL) fill_func(hv, object); return sv_bless(newRV_noinc((SV*)hv), gv_stashpv((char *)stash, 1)); @@ -264,17 +264,17 @@ void perl_chatnet_fill_hash(HV *hv, CHATNET_REC *chatnet) type = "CHATNET"; chat_type = (char *) chat_protocol_find_id(chatnet->chat_type)->name; - hv_store(hv, "type", 4, new_pv(type), 0); - hv_store(hv, "chat_type", 9, new_pv(chat_type), 0); + (void) hv_store(hv, "type", 4, new_pv(type), 0); + (void) hv_store(hv, "chat_type", 9, new_pv(chat_type), 0); - hv_store(hv, "name", 4, new_pv(chatnet->name), 0); + (void) hv_store(hv, "name", 4, new_pv(chatnet->name), 0); - hv_store(hv, "nick", 4, new_pv(chatnet->nick), 0); - hv_store(hv, "username", 8, new_pv(chatnet->username), 0); - hv_store(hv, "realname", 8, new_pv(chatnet->realname), 0); + (void) hv_store(hv, "nick", 4, new_pv(chatnet->nick), 0); + (void) hv_store(hv, "username", 8, new_pv(chatnet->username), 0); + (void) hv_store(hv, "realname", 8, new_pv(chatnet->realname), 0); - hv_store(hv, "own_host", 8, new_pv(chatnet->own_host), 0); - hv_store(hv, "autosendcmd", 11, new_pv(chatnet->autosendcmd), 0); + (void) hv_store(hv, "own_host", 8, new_pv(chatnet->own_host), 0); + (void) hv_store(hv, "autosendcmd", 11, new_pv(chatnet->autosendcmd), 0); } void perl_connect_fill_hash(HV *hv, SERVER_CONNECT_REC *conn) @@ -287,25 +287,25 @@ void perl_connect_fill_hash(HV *hv, SERVER_CONNECT_REC *conn) type = "SERVER CONNECT"; chat_type = (char *) chat_protocol_find_id(conn->chat_type)->name; - hv_store(hv, "type", 4, new_pv(type), 0); - hv_store(hv, "chat_type", 9, new_pv(chat_type), 0); + (void) hv_store(hv, "type", 4, new_pv(type), 0); + (void) hv_store(hv, "chat_type", 9, new_pv(chat_type), 0); - hv_store(hv, "tag", 3, new_pv(conn->tag), 0); - hv_store(hv, "address", 7, new_pv(conn->address), 0); - hv_store(hv, "port", 4, newSViv(conn->port), 0); - hv_store(hv, "chatnet", 7, new_pv(conn->chatnet), 0); + (void) hv_store(hv, "tag", 3, new_pv(conn->tag), 0); + (void) hv_store(hv, "address", 7, new_pv(conn->address), 0); + (void) hv_store(hv, "port", 4, newSViv(conn->port), 0); + (void) hv_store(hv, "chatnet", 7, new_pv(conn->chatnet), 0); - hv_store(hv, "password", 8, new_pv(conn->password), 0); - hv_store(hv, "wanted_nick", 11, new_pv(conn->nick), 0); - hv_store(hv, "username", 8, new_pv(conn->username), 0); - hv_store(hv, "realname", 8, new_pv(conn->realname), 0); + (void) hv_store(hv, "password", 8, new_pv(conn->password), 0); + (void) hv_store(hv, "wanted_nick", 11, new_pv(conn->nick), 0); + (void) hv_store(hv, "username", 8, new_pv(conn->username), 0); + (void) hv_store(hv, "realname", 8, new_pv(conn->realname), 0); - hv_store(hv, "reconnection", 12, newSViv(conn->reconnection), 0); - hv_store(hv, "no_autojoin_channels", 20, newSViv(conn->no_autojoin_channels), 0); - hv_store(hv, "no_autosendcmd", 14, newSViv(conn->no_autosendcmd), 0); - hv_store(hv, "unix_socket", 11, newSViv(conn->unix_socket), 0); - hv_store(hv, "use_ssl", 7, newSViv(conn->use_ssl), 0); - hv_store(hv, "no_connect", 10, newSViv(conn->no_connect), 0); + (void) hv_store(hv, "reconnection", 12, newSViv(conn->reconnection), 0); + (void) hv_store(hv, "no_autojoin_channels", 20, newSViv(conn->no_autojoin_channels), 0); + (void) hv_store(hv, "no_autosendcmd", 14, newSViv(conn->no_autosendcmd), 0); + (void) hv_store(hv, "unix_socket", 11, newSViv(conn->unix_socket), 0); + (void) hv_store(hv, "use_ssl", 7, newSViv(conn->use_ssl), 0); + (void) hv_store(hv, "no_connect", 10, newSViv(conn->no_connect), 0); } void perl_server_fill_hash(HV *hv, SERVER_REC *server) @@ -319,28 +319,28 @@ void perl_server_fill_hash(HV *hv, SERVER_REC *server) perl_connect_fill_hash(hv, server->connrec); type = "SERVER"; - hv_store(hv, "type", 4, new_pv(type), 0); + (void) hv_store(hv, "type", 4, new_pv(type), 0); - hv_store(hv, "connect_time", 12, newSViv(server->connect_time), 0); - hv_store(hv, "real_connect_time", 17, newSViv(server->real_connect_time), 0); + (void) hv_store(hv, "connect_time", 12, newSViv(server->connect_time), 0); + (void) hv_store(hv, "real_connect_time", 17, newSViv(server->real_connect_time), 0); - hv_store(hv, "tag", 3, new_pv(server->tag), 0); - hv_store(hv, "nick", 4, new_pv(server->nick), 0); + (void) hv_store(hv, "tag", 3, new_pv(server->tag), 0); + (void) hv_store(hv, "nick", 4, new_pv(server->nick), 0); - hv_store(hv, "connected", 9, newSViv(server->connected), 0); - hv_store(hv, "connection_lost", 15, newSViv(server->connection_lost), 0); + (void) hv_store(hv, "connected", 9, newSViv(server->connected), 0); + (void) hv_store(hv, "connection_lost", 15, newSViv(server->connection_lost), 0); stash = gv_stashpv("Irssi::Rawlog", 0); - hv_store(hv, "rawlog", 6, sv_bless(newRV_noinc(newSViv((IV)server->rawlog)), stash), 0); + (void) hv_store(hv, "rawlog", 6, sv_bless(newRV_noinc(newSViv((IV)server->rawlog)), stash), 0); - hv_store(hv, "version", 7, new_pv(server->version), 0); - hv_store(hv, "away_reason", 11, new_pv(server->away_reason), 0); - hv_store(hv, "last_invite", 11, new_pv(server->last_invite), 0); - hv_store(hv, "server_operator", 15, newSViv(server->server_operator), 0); - hv_store(hv, "usermode_away", 13, newSViv(server->usermode_away), 0); - hv_store(hv, "banned", 6, newSViv(server->banned), 0); + (void) hv_store(hv, "version", 7, new_pv(server->version), 0); + (void) hv_store(hv, "away_reason", 11, new_pv(server->away_reason), 0); + (void) hv_store(hv, "last_invite", 11, new_pv(server->last_invite), 0); + (void) hv_store(hv, "server_operator", 15, newSViv(server->server_operator), 0); + (void) hv_store(hv, "usermode_away", 13, newSViv(server->usermode_away), 0); + (void) hv_store(hv, "banned", 6, newSViv(server->banned), 0); - hv_store(hv, "lag", 3, newSViv(server->lag), 0); + (void) hv_store(hv, "lag", 3, newSViv(server->lag), 0); } void perl_window_item_fill_hash(HV *hv, WI_ITEM_REC *item) @@ -353,17 +353,17 @@ void perl_window_item_fill_hash(HV *hv, WI_ITEM_REC *item) type = (char *) module_find_id_str("WINDOW ITEM TYPE", item->type); chat_type = (char *) chat_protocol_find_id(item->chat_type)->name; - hv_store(hv, "type", 4, new_pv(type), 0); - hv_store(hv, "chat_type", 9, new_pv(chat_type), 0); + (void) hv_store(hv, "type", 4, new_pv(type), 0); + (void) hv_store(hv, "chat_type", 9, new_pv(chat_type), 0); if (item->server != NULL) { - hv_store(hv, "server", 6, iobject_bless(item->server), 0); + (void) hv_store(hv, "server", 6, iobject_bless(item->server), 0); } - hv_store(hv, "visible_name", 12, new_pv(item->visible_name), 0); + (void) hv_store(hv, "visible_name", 12, new_pv(item->visible_name), 0); - hv_store(hv, "createtime", 10, newSViv(item->createtime), 0); - hv_store(hv, "data_level", 10, newSViv(item->data_level), 0); - hv_store(hv, "hilight_color", 13, new_pv(item->hilight_color), 0); + (void) hv_store(hv, "createtime", 10, newSViv(item->createtime), 0); + (void) hv_store(hv, "data_level", 10, newSViv(item->data_level), 0); + (void) hv_store(hv, "hilight_color", 13, new_pv(item->hilight_color), 0); } void perl_channel_fill_hash(HV *hv, CHANNEL_REC *channel) @@ -374,26 +374,26 @@ void perl_channel_fill_hash(HV *hv, CHANNEL_REC *channel) perl_window_item_fill_hash(hv, (WI_ITEM_REC *) channel); if (channel->ownnick != NULL) - hv_store(hv, "ownnick", 7, iobject_bless(channel->ownnick), 0); + (void) hv_store(hv, "ownnick", 7, iobject_bless(channel->ownnick), 0); - hv_store(hv, "name", 4, new_pv(channel->name), 0); - hv_store(hv, "topic", 5, new_pv(channel->topic), 0); - hv_store(hv, "topic_by", 8, new_pv(channel->topic_by), 0); - hv_store(hv, "topic_time", 10, newSViv(channel->topic_time), 0); + (void) hv_store(hv, "name", 4, new_pv(channel->name), 0); + (void) hv_store(hv, "topic", 5, new_pv(channel->topic), 0); + (void) hv_store(hv, "topic_by", 8, new_pv(channel->topic_by), 0); + (void) hv_store(hv, "topic_time", 10, newSViv(channel->topic_time), 0); - hv_store(hv, "no_modes", 8, newSViv(channel->no_modes), 0); - hv_store(hv, "mode", 4, new_pv(channel->mode), 0); - hv_store(hv, "limit", 5, newSViv(channel->limit), 0); - hv_store(hv, "key", 3, new_pv(channel->key), 0); + (void) hv_store(hv, "no_modes", 8, newSViv(channel->no_modes), 0); + (void) hv_store(hv, "mode", 4, new_pv(channel->mode), 0); + (void) hv_store(hv, "limit", 5, newSViv(channel->limit), 0); + (void) hv_store(hv, "key", 3, new_pv(channel->key), 0); - hv_store(hv, "chanop", 6, newSViv(channel->chanop), 0); - hv_store(hv, "names_got", 9, newSViv(channel->names_got), 0); - hv_store(hv, "wholist", 7, newSViv(channel->wholist), 0); - hv_store(hv, "synced", 6, newSViv(channel->synced), 0); + (void) hv_store(hv, "chanop", 6, newSViv(channel->chanop), 0); + (void) hv_store(hv, "names_got", 9, newSViv(channel->names_got), 0); + (void) hv_store(hv, "wholist", 7, newSViv(channel->wholist), 0); + (void) hv_store(hv, "synced", 6, newSViv(channel->synced), 0); - hv_store(hv, "joined", 6, newSViv(channel->joined), 0); - hv_store(hv, "left", 4, newSViv(channel->left), 0); - hv_store(hv, "kicked", 6, newSViv(channel->kicked), 0); + (void) hv_store(hv, "joined", 6, newSViv(channel->joined), 0); + (void) hv_store(hv, "left", 4, newSViv(channel->left), 0); + (void) hv_store(hv, "kicked", 6, newSViv(channel->kicked), 0); } void perl_query_fill_hash(HV *hv, QUERY_REC *query) @@ -403,11 +403,11 @@ void perl_query_fill_hash(HV *hv, QUERY_REC *query) perl_window_item_fill_hash(hv, (WI_ITEM_REC *) query); - hv_store(hv, "name", 4, new_pv(query->name), 0); - hv_store(hv, "last_unread_msg", 15, newSViv(query->last_unread_msg), 0); - hv_store(hv, "address", 7, new_pv(query->address), 0); - hv_store(hv, "server_tag", 10, new_pv(query->server_tag), 0); - hv_store(hv, "unwanted", 8, newSViv(query->unwanted), 0); + (void) hv_store(hv, "name", 4, new_pv(query->name), 0); + (void) hv_store(hv, "last_unread_msg", 15, newSViv(query->last_unread_msg), 0); + (void) hv_store(hv, "address", 7, new_pv(query->address), 0); + (void) hv_store(hv, "server_tag", 10, new_pv(query->server_tag), 0); + (void) hv_store(hv, "unwanted", 8, newSViv(query->unwanted), 0); } void perl_nick_fill_hash(HV *hv, NICK_REC *nick) @@ -420,31 +420,31 @@ void perl_nick_fill_hash(HV *hv, NICK_REC *nick) type = "NICK"; chat_type = (char *) chat_protocol_find_id(nick->chat_type)->name; - hv_store(hv, "type", 4, new_pv(type), 0); - hv_store(hv, "chat_type", 9, new_pv(chat_type), 0); + (void) hv_store(hv, "type", 4, new_pv(type), 0); + (void) hv_store(hv, "chat_type", 9, new_pv(chat_type), 0); - hv_store(hv, "nick", 4, new_pv(nick->nick), 0); - hv_store(hv, "host", 4, new_pv(nick->host), 0); - hv_store(hv, "realname", 8, new_pv(nick->realname), 0); - hv_store(hv, "hops", 4, newSViv(nick->hops), 0); + (void) hv_store(hv, "nick", 4, new_pv(nick->nick), 0); + (void) hv_store(hv, "host", 4, new_pv(nick->host), 0); + (void) hv_store(hv, "realname", 8, new_pv(nick->realname), 0); + (void) hv_store(hv, "hops", 4, newSViv(nick->hops), 0); - hv_store(hv, "gone", 4, newSViv(nick->gone), 0); - hv_store(hv, "serverop", 8, newSViv(nick->serverop), 0); + (void) hv_store(hv, "gone", 4, newSViv(nick->gone), 0); + (void) hv_store(hv, "serverop", 8, newSViv(nick->serverop), 0); - hv_store(hv, "op", 2, newSViv(nick->op), 0); - hv_store(hv, "halfop", 6, newSViv(nick->halfop), 0); - hv_store(hv, "voice", 5, newSViv(nick->voice), 0); - hv_store(hv, "other", 5, newSViv(nick->prefixes[0]), 0); - hv_store(hv, "prefixes", 8, new_pv(nick->prefixes), 0); + (void) hv_store(hv, "op", 2, newSViv(nick->op), 0); + (void) hv_store(hv, "halfop", 6, newSViv(nick->halfop), 0); + (void) hv_store(hv, "voice", 5, newSViv(nick->voice), 0); + (void) hv_store(hv, "other", 5, newSViv(nick->prefixes[0]), 0); + (void) hv_store(hv, "prefixes", 8, new_pv(nick->prefixes), 0); - hv_store(hv, "last_check", 10, newSViv(nick->last_check), 0); - hv_store(hv, "send_massjoin", 13, newSViv(nick->send_massjoin), 0); + (void) hv_store(hv, "last_check", 10, newSViv(nick->last_check), 0); + (void) hv_store(hv, "send_massjoin", 13, newSViv(nick->send_massjoin), 0); } static void perl_command_fill_hash(HV *hv, COMMAND_REC *cmd) { - hv_store(hv, "category", 8, new_pv(cmd->category), 0); - hv_store(hv, "cmd", 3, new_pv(cmd->cmd), 0); + (void) hv_store(hv, "category", 8, new_pv(cmd->category), 0); + (void) hv_store(hv, "cmd", 3, new_pv(cmd->cmd), 0); } static void perl_ignore_fill_hash(HV *hv, IGNORE_REC *ignore) @@ -452,22 +452,22 @@ static void perl_ignore_fill_hash(HV *hv, IGNORE_REC *ignore) AV *av; char **tmp; - hv_store(hv, "mask", 4, new_pv(ignore->mask), 0); - hv_store(hv, "servertag", 9, new_pv(ignore->servertag), 0); + (void) hv_store(hv, "mask", 4, new_pv(ignore->mask), 0); + (void) hv_store(hv, "servertag", 9, new_pv(ignore->servertag), 0); av = newAV(); if (ignore->channels != NULL) { for (tmp = ignore->channels; *tmp != NULL; tmp++) { av_push(av, new_pv(*tmp)); } } - hv_store(hv, "channels", 8, newRV_noinc((SV*)av), 0); - hv_store(hv, "pattern", 7, new_pv(ignore->pattern), 0); + (void) hv_store(hv, "channels", 8, newRV_noinc((SV*)av), 0); + (void) hv_store(hv, "pattern", 7, new_pv(ignore->pattern), 0); - hv_store(hv, "level", 5, newSViv(ignore->level), 0); + (void) hv_store(hv, "level", 5, newSViv(ignore->level), 0); - hv_store(hv, "exception", 9, newSViv(ignore->exception), 0); - hv_store(hv, "regexp", 6, newSViv(ignore->regexp), 0); - hv_store(hv, "fullword", 8, newSViv(ignore->fullword), 0); + (void) hv_store(hv, "exception", 9, newSViv(ignore->exception), 0); + (void) hv_store(hv, "regexp", 6, newSViv(ignore->regexp), 0); + (void) hv_store(hv, "fullword", 8, newSViv(ignore->fullword), 0); } static void perl_log_fill_hash(HV *hv, LOG_REC *log) @@ -475,33 +475,33 @@ static void perl_log_fill_hash(HV *hv, LOG_REC *log) AV *av; GSList *tmp; - hv_store(hv, "fname", 5, new_pv(log->fname), 0); - hv_store(hv, "real_fname", 10, new_pv(log->real_fname), 0); - hv_store(hv, "opened", 6, newSViv(log->opened), 0); - hv_store(hv, "level", 5, newSViv(log->level), 0); - hv_store(hv, "last", 4, newSViv(log->last), 0); - hv_store(hv, "autoopen", 8, newSViv(log->autoopen), 0); - hv_store(hv, "failed", 6, newSViv(log->failed), 0); - hv_store(hv, "temp", 4, newSViv(log->temp), 0); + (void) hv_store(hv, "fname", 5, new_pv(log->fname), 0); + (void) hv_store(hv, "real_fname", 10, new_pv(log->real_fname), 0); + (void) hv_store(hv, "opened", 6, newSViv(log->opened), 0); + (void) hv_store(hv, "level", 5, newSViv(log->level), 0); + (void) hv_store(hv, "last", 4, newSViv(log->last), 0); + (void) hv_store(hv, "autoopen", 8, newSViv(log->autoopen), 0); + (void) hv_store(hv, "failed", 6, newSViv(log->failed), 0); + (void) hv_store(hv, "temp", 4, newSViv(log->temp), 0); av = newAV(); for (tmp = log->items; tmp != NULL; tmp = tmp->next) { av_push(av, plain_bless(tmp->data, "Irssi::Logitem")); } - hv_store(hv, "items", 5, newRV_noinc((SV*)av), 0); + (void) hv_store(hv, "items", 5, newRV_noinc((SV*)av), 0); } static void perl_log_item_fill_hash(HV *hv, LOG_ITEM_REC *item) { - hv_store(hv, "type", 4, newSViv(item->type), 0); - hv_store(hv, "name", 4, new_pv(item->name), 0); - hv_store(hv, "servertag", 9, new_pv(item->servertag), 0); + (void) hv_store(hv, "type", 4, newSViv(item->type), 0); + (void) hv_store(hv, "name", 4, new_pv(item->name), 0); + (void) hv_store(hv, "servertag", 9, new_pv(item->servertag), 0); } static void perl_rawlog_fill_hash(HV *hv, RAWLOG_REC *rawlog) { - hv_store(hv, "logging", 7, newSViv(rawlog->logging), 0); - hv_store(hv, "nlines", 6, newSViv(rawlog->nlines), 0); + (void) hv_store(hv, "logging", 7, newSViv(rawlog->logging), 0); + (void) hv_store(hv, "nlines", 6, newSViv(rawlog->nlines), 0); } static void perl_reconnect_fill_hash(HV *hv, RECONNECT_REC *reconnect) @@ -511,18 +511,18 @@ static void perl_reconnect_fill_hash(HV *hv, RECONNECT_REC *reconnect) perl_connect_fill_hash(hv, reconnect->conn); type = "RECONNECT"; - hv_store(hv, "type", 4, new_pv(type), 0); + (void) hv_store(hv, "type", 4, new_pv(type), 0); - hv_store(hv, "tag", 3, newSViv(reconnect->tag), 0); - hv_store(hv, "next_connect", 12, newSViv(reconnect->next_connect), 0); + (void) hv_store(hv, "tag", 3, newSViv(reconnect->tag), 0); + (void) hv_store(hv, "next_connect", 12, newSViv(reconnect->next_connect), 0); } static void perl_script_fill_hash(HV *hv, PERL_SCRIPT_REC *script) { - hv_store(hv, "name", 4, new_pv(script->name), 0); - hv_store(hv, "package", 7, new_pv(script->package), 0); - hv_store(hv, "path", 4, new_pv(script->path), 0); - hv_store(hv, "data", 4, new_pv(script->data), 0); + (void) hv_store(hv, "name", 4, new_pv(script->name), 0); + (void) hv_store(hv, "package", 7, new_pv(script->package), 0); + (void) hv_store(hv, "path", 4, new_pv(script->path), 0); + (void) hv_store(hv, "data", 4, new_pv(script->data), 0); } static void remove_newlines(char *str) diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index eb1bddee..793f9375 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -44,7 +44,7 @@ static int print_script_errors; static char *perl_args[] = {"", "-e", "0"}; #define IS_PERL_SCRIPT(file) \ - (strlen(file) > 3 && strcmp(file+strlen(file)-3, ".pl") == 0) + (strlen(file) > 3 && g_strcmp0(file+strlen(file)-3, ".pl") == 0) static void perl_script_destroy_package(PERL_SCRIPT_REC *script) { @@ -314,7 +314,7 @@ PERL_SCRIPT_REC *perl_script_find(const char *name) for (tmp = perl_scripts; tmp != NULL; tmp = tmp->next) { PERL_SCRIPT_REC *rec = tmp->data; - if (strcmp(rec->name, name) == 0) + if (g_strcmp0(rec->name, name) == 0) return rec; } @@ -331,7 +331,7 @@ PERL_SCRIPT_REC *perl_script_find_package(const char *package) for (tmp = perl_scripts; tmp != NULL; tmp = tmp->next) { PERL_SCRIPT_REC *rec = tmp->data; - if (strcmp(rec->package, package) == 0) + if (g_strcmp0(rec->package, package) == 0) return rec; } diff --git a/src/perl/perl-fe.c b/src/perl/perl-fe.c index 8e8469e9..2abc75c0 100644 --- a/src/perl/perl-fe.c +++ b/src/perl/perl-fe.c @@ -170,7 +170,7 @@ static void cmd_load(const char *data, SERVER_REC *server, void *item) return; len = strlen(rootmodule); - if (len > 3 && strcmp(rootmodule + len - 3, ".pl") == 0) { + if (len > 3 && g_strcmp0(rootmodule + len - 3, ".pl") == 0) { /* make /LOAD script.pl work as expected */ signal_stop(); cmd_script_load(data); diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c index 1f602c66..007f7ad5 100644 --- a/src/perl/perl-signals.c +++ b/src/perl/perl-signals.c @@ -99,14 +99,14 @@ void perl_signal_args_to_c( if (!SvOK(arg)) { c_arg = NULL; - } else if (strcmp(rec->args[n], "string") == 0) { + } else if (g_strcmp0(rec->args[n], "string") == 0) { c_arg = SvPV_nolen(arg); - } else if (strcmp(rec->args[n], "int") == 0) { + } else if (g_strcmp0(rec->args[n], "int") == 0) { c_arg = (void *)SvIV(arg); - } else if (strcmp(rec->args[n], "ulongptr") == 0) { + } else if (g_strcmp0(rec->args[n], "ulongptr") == 0) { saved_args[n].v_ulong = SvUV(arg); c_arg = &saved_args[n].v_ulong; - } else if (strcmp(rec->args[n], "intptr") == 0) { + } else if (g_strcmp0(rec->args[n], "intptr") == 0) { saved_args[n].v_int = SvIV(SvRV(arg)); c_arg = &saved_args[n].v_int; } else if (strncmp(rec->args[n], "glistptr_", 9) == 0) { @@ -122,7 +122,7 @@ void perl_signal_args_to_c( } av = (AV *)t; - is_str = strcmp(rec->args[n]+9, "char*") == 0; + is_str = g_strcmp0(rec->args[n]+9, "char*") == 0; gl = NULL; count = av_len(av) + 1; @@ -181,7 +181,7 @@ void perl_signal_args_to_c( continue; } - if (strcmp(rec->args[n], "intptr") == 0) { + if (g_strcmp0(rec->args[n], "intptr") == 0) { SV *t = SvRV(arg); SvIOK_only(t); SvIV_set(t, saved_args[n].v_int); @@ -192,8 +192,8 @@ void perl_signal_args_to_c( AV *av; GList *gl, *tmp; - is_iobject = strcmp(rec->args[n]+9, "iobject") == 0; - is_str = strcmp(rec->args[n]+9, "char*") == 0; + is_iobject = g_strcmp0(rec->args[n]+9, "iobject") == 0; + is_str = g_strcmp0(rec->args[n]+9, "char*") == 0; av = (AV *)SvRV(arg); av_clear(av); @@ -245,8 +245,8 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func, GList *tmp, **ptr; int is_iobject, is_str; - is_iobject = strcmp(rec->args[n]+9, "iobject") == 0; - is_str = strcmp(rec->args[n]+9, "char*") == 0; + is_iobject = g_strcmp0(rec->args[n]+9, "iobject") == 0; + is_str = g_strcmp0(rec->args[n]+9, "char*") == 0; av = newAV(); ptr = arg; @@ -258,22 +258,22 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func, } saved_args[n] = perlarg = newRV_noinc((SV *) av); - } else if (strcmp(rec->args[n], "int") == 0) + } else if (g_strcmp0(rec->args[n], "int") == 0) perlarg = newSViv((IV)arg); else if (arg == NULL) perlarg = &PL_sv_undef; - else if (strcmp(rec->args[n], "string") == 0) + else if (g_strcmp0(rec->args[n], "string") == 0) perlarg = new_pv(arg); - else if (strcmp(rec->args[n], "ulongptr") == 0) + else if (g_strcmp0(rec->args[n], "ulongptr") == 0) perlarg = newSViv(*(unsigned long *) arg); - else if (strcmp(rec->args[n], "intptr") == 0) + else if (g_strcmp0(rec->args[n], "intptr") == 0) saved_args[n] = perlarg = newRV_noinc(newSViv(*(int *) arg)); else if (strncmp(rec->args[n], "gslist_", 7) == 0) { /* linked list - push as AV */ GSList *tmp; int is_iobject; - is_iobject = strcmp(rec->args[n]+7, "iobject") == 0; + is_iobject = g_strcmp0(rec->args[n]+7, "iobject") == 0; av = newAV(); for (tmp = arg; tmp != NULL; tmp = tmp->next) { sv = is_iobject ? iobject_bless((SERVER_REC *) tmp->data) : @@ -282,12 +282,12 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func, } perlarg = newRV_noinc((SV *) av); - } else if (strcmp(rec->args[n], "iobject") == 0) { + } else if (g_strcmp0(rec->args[n], "iobject") == 0) { /* "irssi object" - any struct that has "int type; int chat_type" as it's first variables (server, channel, ..) */ perlarg = iobject_bless((SERVER_REC *) arg); - } else if (strcmp(rec->args[n], "siobject") == 0) { + } else if (g_strcmp0(rec->args[n], "siobject") == 0) { /* "simple irssi object" - any struct that has int type; as it's first variable (dcc) */ perlarg = simple_iobject_bless((SERVER_REC *) arg); @@ -317,7 +317,7 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func, if (saved_args[n] == NULL) continue; - if (strcmp(rec->args[n], "intptr") == 0) { + if (g_strcmp0(rec->args[n], "intptr") == 0) { int *val = arg; *val = SvIV(SvRV(saved_args[n])); } else if (strncmp(rec->args[n], "glistptr_", 9) == 0) { @@ -338,7 +338,7 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func, out = g_list_append(out, val); } - if (strcmp(rec->args[n]+9, "char*") == 0) + if (g_strcmp0(rec->args[n]+9, "char*") == 0) g_list_foreach(*ret, (GFunc) g_free, NULL); g_list_free(*ret); *ret = out; @@ -434,7 +434,7 @@ static void perl_signal_remove_list_one(GSList **siglist, PERL_SIGNAL_REC *rec) #define sv_func_cmp(f1, f2) \ (f1 == f2 || (SvPOK(f1) && SvPOK(f2) && \ - strcmp(SvPV_nolen(f1), SvPV_nolen(f2)) == 0)) + g_strcmp0(SvPV_nolen(f1), SvPV_nolen(f2)) == 0)) static void perl_signal_remove_list(GSList **list, SV *func) { diff --git a/src/perl/textui/Statusbar.xs b/src/perl/textui/Statusbar.xs index 620fad9a..a449e11d 100644 --- a/src/perl/textui/Statusbar.xs +++ b/src/perl/textui/Statusbar.xs @@ -160,5 +160,5 @@ CODE: *str == '\0' ? NULL : str, data, escape_vars); hv = hvref(ST(0)); - hv_store(hv, "min_size", 8, newSViv(item->min_size), 0); - hv_store(hv, "max_size", 8, newSViv(item->max_size), 0); + (void) hv_store(hv, "min_size", 8, newSViv(item->min_size), 0); + (void) hv_store(hv, "max_size", 8, newSViv(item->max_size), 0); diff --git a/src/perl/textui/TextUI.xs b/src/perl/textui/TextUI.xs index ae986aaf..5d2c8a7f 100644 --- a/src/perl/textui/TextUI.xs +++ b/src/perl/textui/TextUI.xs @@ -8,72 +8,72 @@ static int initialized = FALSE; static void perl_main_window_fill_hash(HV *hv, MAIN_WINDOW_REC *window) { - hv_store(hv, "active", 6, plain_bless(window->active, "Irssi::UI::Window"), 0); + (void) hv_store(hv, "active", 6, plain_bless(window->active, "Irssi::UI::Window"), 0); - hv_store(hv, "first_line", 10, newSViv(window->first_line), 0); - hv_store(hv, "last_line", 9, newSViv(window->last_line), 0); - hv_store(hv, "width", 5, newSViv(window->width), 0); - hv_store(hv, "height", 6, newSViv(window->height), 0); + (void) hv_store(hv, "first_line", 10, newSViv(window->first_line), 0); + (void) hv_store(hv, "last_line", 9, newSViv(window->last_line), 0); + (void) hv_store(hv, "width", 5, newSViv(window->width), 0); + (void) hv_store(hv, "height", 6, newSViv(window->height), 0); - hv_store(hv, "statusbar_lines", 15, newSViv(window->statusbar_lines), 0); + (void) hv_store(hv, "statusbar_lines", 15, newSViv(window->statusbar_lines), 0); } static void perl_text_buffer_fill_hash(HV *hv, TEXT_BUFFER_REC *buffer) { - hv_store(hv, "first_line", 10, plain_bless(buffer->first_line, "Irssi::TextUI::Line"), 0); - hv_store(hv, "lines_count", 11, newSViv(buffer->lines_count), 0); - hv_store(hv, "cur_line", 8, plain_bless(buffer->cur_line, "Irssi::TextUI::Line"), 0); - hv_store(hv, "last_eol", 8, newSViv(buffer->last_eol), 0); + (void) hv_store(hv, "first_line", 10, plain_bless(buffer->first_line, "Irssi::TextUI::Line"), 0); + (void) hv_store(hv, "lines_count", 11, newSViv(buffer->lines_count), 0); + (void) hv_store(hv, "cur_line", 8, plain_bless(buffer->cur_line, "Irssi::TextUI::Line"), 0); + (void) hv_store(hv, "last_eol", 8, newSViv(buffer->last_eol), 0); } static void perl_text_buffer_view_fill_hash(HV *hv, TEXT_BUFFER_VIEW_REC *view) { - hv_store(hv, "buffer", 6, plain_bless(view->buffer, "Irssi::TextUI::TextBuffer"), 0); - hv_store(hv, "width", 5, newSViv(view->width), 0); - hv_store(hv, "height", 6, newSViv(view->height), 0); + (void) hv_store(hv, "buffer", 6, plain_bless(view->buffer, "Irssi::TextUI::TextBuffer"), 0); + (void) hv_store(hv, "width", 5, newSViv(view->width), 0); + (void) hv_store(hv, "height", 6, newSViv(view->height), 0); - hv_store(hv, "default_indent", 14, newSViv(view->default_indent), 0); - hv_store(hv, "longword_noindent", 17, newSViv(view->longword_noindent), 0); - hv_store(hv, "scroll", 6, newSViv(view->scroll), 0); + (void) hv_store(hv, "default_indent", 14, newSViv(view->default_indent), 0); + (void) hv_store(hv, "longword_noindent", 17, newSViv(view->longword_noindent), 0); + (void) hv_store(hv, "scroll", 6, newSViv(view->scroll), 0); - hv_store(hv, "ypos", 4, newSViv(view->ypos), 0); + (void) hv_store(hv, "ypos", 4, newSViv(view->ypos), 0); - hv_store(hv, "startline", 9, plain_bless(view->startline, "Irssi::TextUI::Line"), 0); - hv_store(hv, "subline", 7, newSViv(view->subline), 0); + (void) hv_store(hv, "startline", 9, plain_bless(view->startline, "Irssi::TextUI::Line"), 0); + (void) hv_store(hv, "subline", 7, newSViv(view->subline), 0); - hv_store(hv, "bottom_startline", 16, plain_bless(view->bottom_startline, "Irssi::TextUI::Line"), 0); - hv_store(hv, "bottom_subline", 14, newSViv(view->bottom_subline), 0); + (void) hv_store(hv, "bottom_startline", 16, plain_bless(view->bottom_startline, "Irssi::TextUI::Line"), 0); + (void) hv_store(hv, "bottom_subline", 14, newSViv(view->bottom_subline), 0); - hv_store(hv, "empty_linecount", 15, newSViv(view->empty_linecount), 0); - hv_store(hv, "bottom", 6, newSViv(view->bottom), 0); + (void) hv_store(hv, "empty_linecount", 15, newSViv(view->empty_linecount), 0); + (void) hv_store(hv, "bottom", 6, newSViv(view->bottom), 0); } static void perl_line_fill_hash(HV *hv, LINE_REC *line) { - hv_store(hv, "info", 4, plain_bless(&line->info, "Irssi::TextUI::LineInfo"), 0); + (void) hv_store(hv, "info", 4, plain_bless(&line->info, "Irssi::TextUI::LineInfo"), 0); } static void perl_line_cache_fill_hash(HV *hv, LINE_CACHE_REC *cache) { - hv_store(hv, "last_access", 11, newSViv(cache->last_access), 0); - hv_store(hv, "count", 5, newSViv(cache->count), 0); + (void) hv_store(hv, "last_access", 11, newSViv(cache->last_access), 0); + (void) hv_store(hv, "count", 5, newSViv(cache->count), 0); /*LINE_CACHE_SUB_REC lines[1];*/ } static void perl_line_info_fill_hash(HV *hv, LINE_INFO_REC *info) { - hv_store(hv, "level", 5, newSViv(info->level), 0); - hv_store(hv, "time", 4, newSViv(info->time), 0); + (void) hv_store(hv, "level", 5, newSViv(info->level), 0); + (void) hv_store(hv, "time", 4, newSViv(info->time), 0); } static void perl_statusbar_item_fill_hash(HV *hv, SBAR_ITEM_REC *item) { - hv_store(hv, "min_size", 8, newSViv(item->min_size), 0); - hv_store(hv, "max_size", 8, newSViv(item->max_size), 0); - hv_store(hv, "xpos", 4, newSViv(item->xpos), 0); - hv_store(hv, "size", 4, newSViv(item->size), 0); + (void) hv_store(hv, "min_size", 8, newSViv(item->min_size), 0); + (void) hv_store(hv, "max_size", 8, newSViv(item->max_size), 0); + (void) hv_store(hv, "xpos", 4, newSViv(item->xpos), 0); + (void) hv_store(hv, "size", 4, newSViv(item->size), 0); if (item->bar->parent_window != NULL) - hv_store(hv, "window", 6, plain_bless(item->bar->parent_window->active, "Irssi::UI::Window"), 0); + (void) hv_store(hv, "window", 6, plain_bless(item->bar->parent_window->active, "Irssi::UI::Window"), 0); } static PLAIN_OBJECT_INIT_REC textui_plains[] = { diff --git a/src/perl/ui/UI.xs b/src/perl/ui/UI.xs index 2e32762c..9db57e98 100644 --- a/src/perl/ui/UI.xs +++ b/src/perl/ui/UI.xs @@ -8,60 +8,60 @@ static int initialized = FALSE; static void perl_process_fill_hash(HV *hv, PROCESS_REC *process) { - hv_store(hv, "id", 2, newSViv(process->id), 0); - hv_store(hv, "name", 4, new_pv(process->name), 0); - hv_store(hv, "args", 4, new_pv(process->args), 0); + (void) hv_store(hv, "id", 2, newSViv(process->id), 0); + (void) hv_store(hv, "name", 4, new_pv(process->name), 0); + (void) hv_store(hv, "args", 4, new_pv(process->args), 0); - hv_store(hv, "pid", 3, newSViv(process->pid), 0); - hv_store(hv, "target", 6, new_pv(process->target), 0); + (void) hv_store(hv, "pid", 3, newSViv(process->pid), 0); + (void) hv_store(hv, "target", 6, new_pv(process->target), 0); if (process->target_win != NULL) { - hv_store(hv, "target_win", 10, + (void) hv_store(hv, "target_win", 10, plain_bless(process->target_win, "Irssi::UI::Window"), 0); } - hv_store(hv, "shell", 5, newSViv(process->shell), 0); - hv_store(hv, "notice", 6, newSViv(process->notice), 0); - hv_store(hv, "silent", 6, newSViv(process->silent), 0); + (void) hv_store(hv, "shell", 5, newSViv(process->shell), 0); + (void) hv_store(hv, "notice", 6, newSViv(process->notice), 0); + (void) hv_store(hv, "silent", 6, newSViv(process->silent), 0); } static void perl_window_fill_hash(HV *hv, WINDOW_REC *window) { - hv_store(hv, "refnum", 6, newSViv(window->refnum), 0); - hv_store(hv, "name", 4, new_pv(window->name), 0); - hv_store(hv, "history_name", 12, new_pv(window->history_name), 0); + (void) hv_store(hv, "refnum", 6, newSViv(window->refnum), 0); + (void) hv_store(hv, "name", 4, new_pv(window->name), 0); + (void) hv_store(hv, "history_name", 12, new_pv(window->history_name), 0); - hv_store(hv, "width", 5, newSViv(window->width), 0); - hv_store(hv, "height", 6, newSViv(window->height), 0); + (void) hv_store(hv, "width", 5, newSViv(window->width), 0); + (void) hv_store(hv, "height", 6, newSViv(window->height), 0); if (window->active) - hv_store(hv, "active", 6, iobject_bless(window->active), 0); + (void) hv_store(hv, "active", 6, iobject_bless(window->active), 0); if (window->active_server) - hv_store(hv, "active_server", 13, iobject_bless(window->active_server), 0); + (void) hv_store(hv, "active_server", 13, iobject_bless(window->active_server), 0); - hv_store(hv, "servertag", 9, new_pv(window->servertag), 0); - hv_store(hv, "level", 5, newSViv(window->level), 0); + (void) hv_store(hv, "servertag", 9, new_pv(window->servertag), 0); + (void) hv_store(hv, "level", 5, newSViv(window->level), 0); - hv_store(hv, "immortal", 8, newSViv(window->immortal), 0); - hv_store(hv, "sticky_refnum", 13, newSViv(window->sticky_refnum), 0); + (void) hv_store(hv, "immortal", 8, newSViv(window->immortal), 0); + (void) hv_store(hv, "sticky_refnum", 13, newSViv(window->sticky_refnum), 0); - hv_store(hv, "data_level", 10, newSViv(window->data_level), 0); - hv_store(hv, "hilight_color", 13, new_pv(window->hilight_color), 0); + (void) hv_store(hv, "data_level", 10, newSViv(window->data_level), 0); + (void) hv_store(hv, "hilight_color", 13, new_pv(window->hilight_color), 0); - hv_store(hv, "last_timestamp", 14, newSViv(window->last_timestamp), 0); - hv_store(hv, "last_line", 9, newSViv(window->last_line), 0); + (void) hv_store(hv, "last_timestamp", 14, newSViv(window->last_timestamp), 0); + (void) hv_store(hv, "last_line", 9, newSViv(window->last_line), 0); - hv_store(hv, "theme", 5, plain_bless(window->theme, "Irssi::UI::Theme"), 0); - hv_store(hv, "theme_name", 10, new_pv(window->theme_name), 0); + (void) hv_store(hv, "theme", 5, plain_bless(window->theme, "Irssi::UI::Theme"), 0); + (void) hv_store(hv, "theme_name", 10, new_pv(window->theme_name), 0); } static void perl_text_dest_fill_hash(HV *hv, TEXT_DEST_REC *dest) { - hv_store(hv, "window", 6, plain_bless(dest->window, "Irssi::UI::Window"), 0); - hv_store(hv, "server", 6, iobject_bless(dest->server), 0); - hv_store(hv, "target", 6, new_pv(dest->target), 0); - hv_store(hv, "level", 5, newSViv(dest->level), 0); + (void) hv_store(hv, "window", 6, plain_bless(dest->window, "Irssi::UI::Window"), 0); + (void) hv_store(hv, "server", 6, iobject_bless(dest->server), 0); + (void) hv_store(hv, "target", 6, new_pv(dest->target), 0); + (void) hv_store(hv, "level", 5, newSViv(dest->level), 0); - hv_store(hv, "hilight_priority", 16, newSViv(dest->hilight_priority), 0); - hv_store(hv, "hilight_color", 13, new_pv(dest->hilight_color), 0); + (void) hv_store(hv, "hilight_priority", 16, newSViv(dest->hilight_priority), 0); + (void) hv_store(hv, "hilight_color", 13, new_pv(dest->hilight_color), 0); } static PLAIN_OBJECT_INIT_REC fe_plains[] = { |