From d03d6e606b40157d910ddf99ab018156abeb8ef0 Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Mon, 28 Feb 2011 18:59:32 +0100 Subject: add wdk changes to named branch --- src/common/server.c | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) (limited to 'src/common/server.c') diff --git a/src/common/server.c b/src/common/server.c index dd43adff..e72dd24d 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -845,33 +844,6 @@ server_flush_queue (server *serv) fe_set_throttle (serv); } -#ifdef WIN32 - -static int -waitline2 (GIOChannel *source, char *buf, int bufsize) -{ - int i = 0; - int len; - - while (1) - { - if (g_io_channel_read (source, &buf[i], 1, &len) != G_IO_ERROR_NONE) - return -1; - if (buf[i] == '\n' || bufsize == i + 1) - { - buf[i] = 0; - return i; - } - i++; - } -} - -#else - -#define waitline2(source,buf,size) waitline(serv->childread,buf,size,0) - -#endif - /* connect() successed */ static void @@ -1395,12 +1367,7 @@ base64_encode (char *to, char *from, unsigned int len) static int http_read_line (int print_fd, int sok, char *buf, int len) { -#ifdef WIN32 - /* make sure waitline() uses recv() or it'll fail on win32 */ - len = waitline (sok, buf, len, FALSE); -#else len = waitline (sok, buf, len, TRUE); -#endif if (len >= 1) { /* print the message out (send it to the parent process) */ @@ -1524,9 +1491,10 @@ server_child (server * serv) if (!serv->dont_use_proxy) /* blocked in serverlist? */ { if (FALSE) + { ; #ifdef USE_LIBPROXY - else if (prefs.proxy_type == 5) + } else if (prefs.proxy_type == 5) { char **proxy_list; char *url, *proxy; @@ -1795,7 +1763,7 @@ server_connect (server *serv, char *hostname, int port, int no_login) } #endif serv->childpid = pid; - serv->iotag = fe_input_add (serv->childread, FIA_READ, server_read_child, + serv->iotag = fe_input_add (serv->childread, FIA_READ|FIA_FD, server_read_child, serv); } -- cgit 1.4.1 From 2aed83ec82f3ccdbaa013bdf8fc4dd44d261a96f Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Sat, 16 Apr 2011 20:08:47 +0200 Subject: fix syntax error --- src/common/server.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/common/server.c') diff --git a/src/common/server.c b/src/common/server.c index 171b7ffd..f7347052 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -1491,7 +1491,6 @@ server_child (server * serv) if (!serv->dont_use_proxy) /* blocked in serverlist? */ { if (FALSE) - { ; #ifdef USE_LIBPROXY } else if (prefs.proxy_type == 5) -- cgit 1.4.1 From 132ef6cb50201cb6ab8ab0609a88ccce62aa6a21 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sun, 11 Dec 2011 17:34:02 +0100 Subject: initial patches for linux compatibility --- plugins/perl/perl.c | 2 +- plugins/perl/perl.def | 4 +++ plugins/python/python.c | 6 ++++ plugins/tcl/tclplugin.c | 2 ++ plugins/xdcc/xdcc.c | 4 +++ src/common/cfgfiles.c | 20 +++++++++--- src/common/chanopt.c | 4 +++ src/common/ctcp.c | 9 ++++++ src/common/dcc.c | 8 ++++- src/common/ignore.c | 4 +++ src/common/inbound.c | 4 +++ src/common/makefile.mak | 1 - src/common/msproxy.c | 4 +++ src/common/network.c | 4 +++ src/common/notify.c | 4 +++ src/common/outbound.c | 7 ++++- src/common/plugin-timer.c | 2 +- src/common/proto-irc.c | 4 +++ src/common/server.c | 5 +++ src/common/servlist.c | 4 +++ src/common/text.c | 71 +++++++++++++++++++++++++++++++++++++++++++ src/common/util.c | 42 +++++++++++++++++++++++-- src/common/util.h | 2 ++ src/common/wdkutil.c | 27 ---------------- src/common/wdkutil.h | 2 -- src/common/xchat.c | 4 +-- src/common/xchat.h | 4 +++ src/fe-gtk/about.c | 4 +-- src/fe-gtk/banlist.c | 4 +++ src/fe-gtk/chanlist.c | 4 +++ src/fe-gtk/editlist.c | 5 +++ src/fe-gtk/fe-gtk.c | 6 +++- src/fe-gtk/fkeys.c | 6 +++- src/fe-gtk/gtkutil.c | 4 +++ src/fe-gtk/joind.c | 4 +++ src/fe-gtk/maingui.c | 3 +- src/fe-gtk/menu.c | 8 ++++- src/fe-gtk/palette.c | 4 +++ src/fe-gtk/plugin-tray.c | 18 ++++++++--- src/fe-gtk/plugingui.c | 9 ++++-- src/fe-gtk/rawlog.c | 4 +++ src/fe-gtk/setup.c | 13 ++++++-- src/fe-gtk/sexy-spell-entry.c | 11 +++++++ src/fe-gtk/xtext.c | 2 ++ 44 files changed, 304 insertions(+), 59 deletions(-) create mode 100644 plugins/perl/perl.def delete mode 100644 src/common/wdkutil.c delete mode 100644 src/common/wdkutil.h (limited to 'src/common/server.c') diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index a454b43d..a2763771 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -27,7 +27,7 @@ #endif #ifdef WIN32 #include -#define _INC_DIRENT +#define _INC_DIRENT /* disable inclusion of perl's dirent.h, we use an own version for win32 */ #include "../../src/common/dirent.h" #else #include diff --git a/plugins/perl/perl.def b/plugins/perl/perl.def new file mode 100644 index 00000000..a2ec6566 --- /dev/null +++ b/plugins/perl/perl.def @@ -0,0 +1,4 @@ +EXPORTS + xchat_plugin_init + xchat_plugin_deinit + xchat_plugin_get_info \ No newline at end of file diff --git a/plugins/python/python.c b/plugins/python/python.c index 55adf989..3c535057 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -55,8 +55,14 @@ #include #include #include + +#ifdef WIN32 #include "../../src/common/dirent.h" #include "../../config.h" +#else +#include +#include +#endif #include "xchat-plugin.h" #include "Python.h" diff --git a/plugins/tcl/tclplugin.c b/plugins/tcl/tclplugin.c index 9289d01d..920a48ad 100644 --- a/plugins/tcl/tclplugin.c +++ b/plugins/tcl/tclplugin.c @@ -32,6 +32,8 @@ static char RCSID[] = "$Id: tclplugin.c,v 1.64 2010/03/10 04:24:16 mooooooo Exp #include #define bzero(mem, sz) memset((mem), 0, (sz)) #define bcopy(src, dest, count) memmove((dest), (src), (count)) +#else +#include #endif #include "xchat-plugin.h" diff --git a/plugins/xdcc/xdcc.c b/plugins/xdcc/xdcc.c index a8fda540..060dbbe3 100644 --- a/plugins/xdcc/xdcc.c +++ b/plugins/xdcc/xdcc.c @@ -5,6 +5,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "xchat-plugin.h" #include "../../src/common/xchat.h" diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 22ef00d7..130ad9d9 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -29,11 +29,12 @@ #include "fe.h" #include "text.h" #include "xchatc.h" -#include "wdkutil.h" #ifndef WIN32 +#include #define XCHAT_DIR ".xchat2" #endif + #define DEF_FONT "Monospace 9" void @@ -402,7 +403,9 @@ const struct prefs vars[] = { {"dcc_blocksize", P_OFFINT (dcc_blocksize), TYPE_INT}, {"dcc_completed_dir", P_OFFSET (dcc_completed_dir), TYPE_STR}, {"dcc_dir", P_OFFSET (dccdir), TYPE_STR}, - /* {"dcc_fast_send", P_OFFINT (fastdccsend), TYPE_BOOL}, */ +#ifndef WIN32 + {"dcc_fast_send", P_OFFINT (fastdccsend), TYPE_BOOL}, +#endif {"dcc_global_max_get_cps", P_OFFINT (dcc_global_max_get_cps), TYPE_INT}, {"dcc_global_max_send_cps", P_OFFINT (dcc_global_max_send_cps), TYPE_INT}, {"dcc_ip", P_OFFSET (dcc_ip_str), TYPE_STR}, @@ -440,7 +443,9 @@ const struct prefs vars[] = { {"gui_lagometer", P_OFFINT (lagometer), TYPE_INT}, {"gui_license", P_OFFSET (gui_license), TYPE_STR}, {"gui_mode_buttons", P_OFFINT (chanmodebuttons), TYPE_BOOL}, +#ifdef WIN32 {"gui_one_instance", P_OFFINT (gui_one_instance), TYPE_BOOL}, +#endif {"gui_pane_left_size", P_OFFINT (gui_pane_left_size), TYPE_INT}, {"gui_pane_right_size", P_OFFINT (gui_pane_right_size), TYPE_INT}, {"gui_quit_dialog", P_OFFINT (gui_quit_dialog), TYPE_BOOL}, @@ -547,7 +552,9 @@ const struct prefs vars[] = { {"tab_chans", P_OFFINT (tabchannels), TYPE_BOOL}, {"tab_dialogs", P_OFFINT (privmsgtab), TYPE_BOOL}, +#ifdef WIN32 {"tab_icons", P_OFFINT (tab_icons), TYPE_BOOL}, +#endif {"tab_layout", P_OFFINT (tab_layout), TYPE_INT}, {"tab_new_to_front", P_OFFINT (newtabstofront), TYPE_INT}, {"tab_notices", P_OFFINT (notices_tabs), TYPE_BOOL}, @@ -558,14 +565,18 @@ const struct prefs vars[] = { {"tab_sort", P_OFFINT (tab_sort), TYPE_BOOL}, {"tab_trunc", P_OFFINT (truncchans), TYPE_INT}, {"tab_utils", P_OFFINT (windows_as_tabs), TYPE_BOOL}, +#ifdef WIN32 {"tab_xp", P_OFFINT (tab_xp), TYPE_BOOL}, +#endif {"text_auto_copy_color", P_OFFINT (autocopy_color), TYPE_BOOL}, {"text_auto_copy_stamp", P_OFFINT (autocopy_stamp), TYPE_BOOL}, {"text_auto_copy_text", P_OFFINT (autocopy_text), TYPE_BOOL}, {"text_background", P_OFFSET (background), TYPE_STR}, {"text_color_nicks", P_OFFINT (colorednicks), TYPE_BOOL}, +#ifdef WIN32 {"text_emoticons", P_OFFINT (emoticons), TYPE_BOOL}, +#endif {"text_font", P_OFFSET (font_normal), TYPE_STR}, {"text_indent", P_OFFINT (indent_nicks), TYPE_BOOL}, {"text_max_indent", P_OFFINT (max_auto_indent), TYPE_INT}, @@ -642,7 +653,9 @@ load_config (void) prefs.indent_nicks = 1; prefs.thin_separator = 1; prefs._tabs_position = 2; /* 2 = left */ - /* prefs.fastdccsend = 1; */ +#ifndef WIN32 + prefs.fastdccsend = 1; +#endif prefs.wordwrap = 1; prefs.autosave = 1; prefs.autodialog = 1; @@ -667,7 +680,6 @@ load_config (void) prefs.dialog_height = 256; prefs.gui_join_dialog = 1; prefs.gui_quit_dialog = 1; - prefs.slist_skip = 1; prefs.dcctimeout = 180; prefs.dccstalltimeout = 60; prefs.notify_timeout = 15; diff --git a/src/common/chanopt.c b/src/common/chanopt.c index ce37157a..f8e16e8b 100644 --- a/src/common/chanopt.c +++ b/src/common/chanopt.c @@ -8,6 +8,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "xchat.h" #include "cfgfiles.h" diff --git a/src/common/ctcp.c b/src/common/ctcp.c index 37392372..2bb75746 100644 --- a/src/common/ctcp.c +++ b/src/common/ctcp.c @@ -20,6 +20,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "xchat.h" #include "cfgfiles.h" #include "util.h" @@ -133,8 +137,13 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip, if (!strcasecmp (msg, "VERSION") && !prefs.hidever) { +#ifdef WIN32 snprintf (outbuf, sizeof (outbuf), "VERSION XChat-WDK "PACKAGE_VERSION" [x%d] / %s", get_cpu_arch (), get_cpu_str ()); +#else + snprintf (outbuf, sizeof (outbuf), "VERSION XChat-WDK "PACKAGE_VERSION" %s", + get_cpu_str ()); +#endif serv->p_nctcp (serv, nick, outbuf); } diff --git a/src/common/dcc.c b/src/common/dcc.c index 9375095e..d91b7e8e 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -40,6 +40,8 @@ #ifdef WIN32 #include +#else +#include #endif #include "xchat.h" @@ -56,7 +58,9 @@ #ifdef USE_DCC64 #define BIG_STR_TO_INT(x) strtoull(x,NULL,10) +#ifdef WIN32 #define stat _stat64 +#endif #else #define BIG_STR_TO_INT(x) strtoul(x,NULL,10) #endif @@ -1983,7 +1987,9 @@ is_same_file (struct DCC *dcc, struct DCC *new_dcc) return TRUE; /* now handle case-insensitive Filesystems: HFS+, FAT */ -#ifndef WIN32 +#ifdef WIN32 + /* warning no win32 implementation - behaviour may be unreliable */ +#else /* this fstat() shouldn't really fail */ if ((dcc->fp == -1 ? stat (dcc->destfile_fs, &st_a) : fstat (dcc->fp, &st_a)) == -1) return FALSE; diff --git a/src/common/ignore.c b/src/common/ignore.c index adb61f37..0ed23daa 100644 --- a/src/common/ignore.c +++ b/src/common/ignore.c @@ -23,6 +23,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "xchat.h" #include "ignore.h" #include "cfgfiles.h" diff --git a/src/common/inbound.c b/src/common/inbound.c index 3485dfd4..bd7252c5 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -23,6 +23,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #define WANTARPA #define WANTDNS #include "inet.h" diff --git a/src/common/makefile.mak b/src/common/makefile.mak index 424316c0..8b350efc 100644 --- a/src/common/makefile.mak +++ b/src/common/makefile.mak @@ -25,7 +25,6 @@ tree.obj \ url.obj \ userlist.obj \ util.obj \ -wdkutil.obj \ xchat.obj all: $(COMMON_OBJECTS) xchatcommon.lib dirent.lib diff --git a/src/common/msproxy.c b/src/common/msproxy.c index 8ad37ffc..5103233a 100644 --- a/src/common/msproxy.c +++ b/src/common/msproxy.c @@ -28,6 +28,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #define WANTSOCKET #define WANTARPA #include "inet.h" diff --git a/src/common/network.c b/src/common/network.c index b7d9aa1f..eba24b05 100644 --- a/src/common/network.c +++ b/src/common/network.c @@ -23,6 +23,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "../../config.h" /* grab USE_IPV6 and LOOKUPD defines */ #define WANTSOCKET diff --git a/src/common/notify.c b/src/common/notify.c index 4aa5ea17..9c6e54de 100644 --- a/src/common/notify.c +++ b/src/common/notify.c @@ -24,6 +24,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "xchat.h" #include "notify.h" #include "cfgfiles.h" diff --git a/src/common/outbound.c b/src/common/outbound.c index 917562b9..8b0432ec 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -30,6 +30,7 @@ #ifndef WIN32 #include +#include #endif #include @@ -2880,6 +2881,7 @@ cmd_recv (struct session *sess, char *tbuf, char *word[], char *word_eol[]) return FALSE; } +#if 0 /* manual command for flushing prefs to disk, but we use an autosave-upon-set approach instead */ static int cmd_saveconf (struct session *sess, char *tbuf, char *word[], char *word_eol[]) { @@ -2894,6 +2896,7 @@ cmd_saveconf (struct session *sess, char *tbuf, char *word[], char *word_eol[]) return TRUE; } +#endif static int cmd_say (struct session *sess, char *tbuf, char *word[], char *word_eol[]) @@ -3647,7 +3650,9 @@ const struct commands xc_cmds[] = { #endif {"RECV", cmd_recv, 1, 0, 1, N_("RECV , send raw data to xchat, as if it was received from the irc server")}, - /*{"SAVECONF", cmd_saveconf, 0, 0, 1, N_("SAVECONF, saves the current settings to disk")},*/ +#if 0 + {"SAVECONF", cmd_saveconf, 0, 0, 1, N_("SAVECONF, saves the current settings to disk")}, +#endif {"SAY", cmd_say, 0, 0, 1, N_("SAY , sends the text to the object in the current window")}, {"SEND", cmd_send, 0, 0, 1, N_("SEND []")}, diff --git a/src/common/plugin-timer.c b/src/common/plugin-timer.c index 2524439d..f09074a8 100644 --- a/src/common/plugin-timer.c +++ b/src/common/plugin-timer.c @@ -1,7 +1,7 @@ #include #include #include -#include "../../plugins/xchat-plugin.h" +#include "xchat-plugin.h" #ifdef WIN32 #define strcasecmp stricmp diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 3d45e1b0..91a57abe 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -24,6 +24,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "xchat.h" #include "ctcp.h" #include "fe.h" diff --git a/src/common/server.c b/src/common/server.c index f7347052..cdd67cda 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -36,6 +36,7 @@ #ifndef WIN32 #include #include +#include #else #include #endif @@ -1763,7 +1764,11 @@ server_connect (server *serv, char *hostname, int port, int no_login) } #endif serv->childpid = pid; +#ifdef WIN32 serv->iotag = fe_input_add (serv->childread, FIA_READ|FIA_FD, server_read_child, +#else + serv->iotag = fe_input_add (serv->childread, FIA_READ, server_read_child, +#endif serv); } diff --git a/src/common/servlist.c b/src/common/servlist.c index 1ca63201..a94c260a 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -22,6 +22,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "xchat.h" #include diff --git a/src/common/text.c b/src/common/text.c index fcde5870..fd5d25e9 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -25,6 +25,11 @@ #include #include +#ifndef WIN32 +#include +#include +#endif + #include "xchat.h" #include #include "cfgfiles.h" @@ -270,6 +275,12 @@ scrollback_load (session *sess) time_t stamp; int lines; +#ifndef WIN32 + char *map, *end_map; + struct stat statbuf; + const char *begin, *eol; +#endif + if (sess->text_scrollback == SET_DEFAULT) { if (!prefs.text_replay) @@ -288,6 +299,65 @@ scrollback_load (session *sess) if (fh == -1) return; +#ifndef WIN32 + if (fstat (fh, &statbuf) < 0) + return; + + map = mmap (NULL, statbuf.st_size, PROT_READ, MAP_PRIVATE, fh, 0); + if (map == MAP_FAILED) + return; + + end_map = map + statbuf.st_size; + + lines = 0; + begin = map; + while (begin < end_map) + { + int n_bytes; + + eol = memchr (begin, '\n', end_map - begin); + + if (!eol) + eol = end_map; + + n_bytes = MIN (eol - begin, sizeof (buf) - 1); + + strncpy (buf, begin, n_bytes); + + buf[n_bytes] = 0; + + if (buf[0] == 'T') + { + if (sizeof (time_t) == 4) + stamp = strtoul (buf + 2, NULL, 10); + else + stamp = strtoull (buf + 2, NULL, 10); /* just incase time_t is 64 bits */ + text = strchr (buf + 3, ' '); + if (text) + { + text = strip_color (text + 1, -1, STRIP_COLOR); + fe_print_text (sess, text, stamp); + g_free (text); + } + lines++; + } + + begin = eol + 1; + } + + sess->scrollwritten = lines; + + if (lines) + { + text = ctime (&stamp); + text[24] = 0; /* get rid of the \n */ + snprintf (buf, sizeof (buf), "\n*\t%s %s\n\n", _("Loaded log from"), text); + fe_print_text (sess, buf, 0); + /*EMIT_SIGNAL (XP_TE_GENMSG, sess, "*", buf, NULL, NULL, NULL, 0);*/ + } + + munmap (map, statbuf.st_size); +#else lines = 0; while (waitline (fh, buf, sizeof buf, FALSE) != -1) { @@ -318,6 +388,7 @@ scrollback_load (session *sess) fe_print_text (sess, buf, 0); /*EMIT_SIGNAL (XP_TE_GENMSG, sess, "*", buf, NULL, NULL, NULL, 0);*/ } +#endif close (fh); } diff --git a/src/common/util.c b/src/common/util.c index c16d41f5..ccc48657 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -27,17 +27,21 @@ #include #include #include + #ifdef WIN32 #include #include +#include +#include "dirent.h" #else -#include +#include #include #include #include +#include #endif + #include -#include "dirent.h" #include #include "xchat.h" #include "xchatc.h" @@ -1848,3 +1852,37 @@ canonalize_key (char *key) } } } + +int +portable_mode () +{ +#ifdef WIN32 + if ((_access( "portable-mode", 0 )) != -1) + { + return 1; + } + else + { + return 0; + } +#else + return 0; +#endif +} + +int +xtray_mode () +{ +#ifdef WIN32 + if ((_access( "plugins/xtray.dll", 0 )) != -1) + { + return 1; + } + else + { + return 0; + } +#else + return 0; +#endif +} diff --git a/src/common/util.h b/src/common/util.h index bee6ec3c..82d74366 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -57,5 +57,7 @@ guint32 str_hash (const char *key); guint32 str_ihash (const unsigned char *key); void safe_strcpy (char *dest, const char *src, int bytes_left); void canonalize_key (char *key); +int portable_mode (); +int xtray_mode (); #endif diff --git a/src/common/wdkutil.c b/src/common/wdkutil.c deleted file mode 100644 index 5bf4f0c0..00000000 --- a/src/common/wdkutil.c +++ /dev/null @@ -1,27 +0,0 @@ -#include - -int -portable_mode () -{ - if ((_access( "portable-mode", 0 )) != -1) - { - return 1; - } - else - { - return 0; - } -} - -int -xtray_mode () -{ - if ((_access( "plugins/xtray.dll", 0 )) != -1) - { - return 1; - } - else - { - return 0; - } -} diff --git a/src/common/wdkutil.h b/src/common/wdkutil.h deleted file mode 100644 index 2e4c693a..00000000 --- a/src/common/wdkutil.h +++ /dev/null @@ -1,2 +0,0 @@ -int portable_mode (); -int xtray_mode (); diff --git a/src/common/xchat.c b/src/common/xchat.c index c0847a32..22c4eddb 100644 --- a/src/common/xchat.c +++ b/src/common/xchat.c @@ -31,6 +31,7 @@ #else #include #include +#include #endif #include "xchat.h" @@ -39,7 +40,7 @@ #include "cfgfiles.h" #include "chanopt.h" #include "ignore.h" -#include "../../plugins/xchat-plugin.h" +#include "xchat-plugin.h" #include "plugin.h" #include "plugin-timer.h" #include "notify.h" @@ -49,7 +50,6 @@ #include "text.h" #include "url.h" #include "xchatc.h" -#include "wdkutil.h" #ifdef USE_OPENSSL #include /* SSL_() */ diff --git a/src/common/xchat.h b/src/common/xchat.h index 08177e20..91e2d50e 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -186,7 +186,9 @@ struct xchatprefs int gui_usermenu; int gui_join_dialog; int gui_quit_dialog; +#ifdef WIN32 int gui_one_instance; +#endif int dialog_left; int dialog_top; int dialog_width; @@ -304,10 +306,12 @@ struct xchatprefs unsigned int wait_on_exit; unsigned int confmode; unsigned int utf8_locale; +#ifdef WIN32 unsigned int identd; unsigned int emoticons; unsigned int tab_icons; unsigned int tab_xp; +#endif unsigned int ctcp_number_limit; /*flood */ unsigned int ctcp_time_limit; /*seconds of floods */ diff --git a/src/fe-gtk/about.c b/src/fe-gtk/about.c index a5772e39..41f3c09b 100644 --- a/src/fe-gtk/about.c +++ b/src/fe-gtk/about.c @@ -39,7 +39,6 @@ #include "../common/xchat.h" #include "../common/util.h" -#include "../common/wdkutil.h" #include "../common/xchatc.h" #include "palette.h" #include "pixmaps.h" @@ -71,7 +70,7 @@ menu_about (GtkWidget * wid, gpointer sess) "(C) 1998-2005 Peter Zelezny", author, buf, 0)); } -#else +#endif static GtkWidget *about = 0; @@ -171,4 +170,3 @@ menu_about (GtkWidget * wid, gpointer sess) gtk_widget_show_all (about); } -#endif diff --git a/src/fe-gtk/banlist.c b/src/fe-gtk/banlist.c index a714d186..fecb62a5 100644 --- a/src/fe-gtk/banlist.c +++ b/src/fe-gtk/banlist.c @@ -22,6 +22,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "fe-gtk.h" #include diff --git a/src/fe-gtk/chanlist.c b/src/fe-gtk/chanlist.c index 6203083b..4dca935b 100644 --- a/src/fe-gtk/chanlist.c +++ b/src/fe-gtk/chanlist.c @@ -22,6 +22,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "fe-gtk.h" #include diff --git a/src/fe-gtk/editlist.c b/src/fe-gtk/editlist.c index fd2d6810..d374d064 100644 --- a/src/fe-gtk/editlist.c +++ b/src/fe-gtk/editlist.c @@ -22,6 +22,11 @@ #include #include #include + +#ifndef WIN32 +#include +#endif + #include "fe-gtk.h" #include diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index c11f5235..88a1138c 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -31,7 +31,11 @@ #include #include +#ifdef WIN32 #include +#else +#include +#endif #include "../common/xchat.h" #include "../common/fe.h" @@ -411,7 +415,7 @@ log_handler (const gchar *log_domain, { session *sess; - /* if (getenv ("XCHAT_WARNING_IGNORE")) */ + /* if (getenv ("XCHAT_WARNING_IGNORE")) this gets ignored sometimes, so simply just disable all warnings */ return; sess = find_dialog (serv_list->data, "(warnings)"); diff --git a/src/fe-gtk/fkeys.c b/src/fe-gtk/fkeys.c index 7330854a..b9690731 100644 --- a/src/fe-gtk/fkeys.c +++ b/src/fe-gtk/fkeys.c @@ -24,6 +24,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "fe-gtk.h" #include @@ -314,7 +318,7 @@ key_handle_key_press (GtkWidget *wid, GdkEventKey *evt, session *sess) key_action_tab_clean (); break; -#if defined(USE_GTKSPELL)/* && !defined(WIN32) +#if defined(USE_GTKSPELL)/* && !defined(WIN32) */ /* gtktextview has no 'activate' event, so we trap ENTER here */ case GDK_Return: case GDK_KP_Enter: diff --git a/src/fe-gtk/gtkutil.c b/src/fe-gtk/gtkutil.c index 522b44df..fe4e1737 100644 --- a/src/fe-gtk/gtkutil.c +++ b/src/fe-gtk/gtkutil.c @@ -23,6 +23,7 @@ #include #include #include + #include "fe-gtk.h" #include @@ -50,9 +51,12 @@ #include "../common/util.h" #include "gtkutil.h" #include "pixmaps.h" + #ifdef WIN32 #include "../common/fe.h" #include "../common/thread.h" +#else +#include #endif /* gtkutil.c, just some gtk wrappers */ diff --git a/src/fe-gtk/joind.c b/src/fe-gtk/joind.c index 6cd812cf..e645f0bc 100644 --- a/src/fe-gtk/joind.c +++ b/src/fe-gtk/joind.c @@ -12,6 +12,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include #include #include diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 74157a7f..28cf46a9 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -53,7 +53,8 @@ #include "../common/plugin.h" #include "../common/modes.h" #include "../common/url.h" -#include "../common/wdkutil.h" +#include "../common/util.h" + #include "fe-gtk.h" #include "banlist.h" #include "gtkutil.h" diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c index 90c784f0..e6a5eca0 100644 --- a/src/fe-gtk/menu.c +++ b/src/fe-gtk/menu.c @@ -23,6 +23,8 @@ #ifdef WIN32 #include +#else +#include #endif #include "fe-gtk.h" @@ -1121,6 +1123,7 @@ usermenu_update (void) } } +#if 0 static void menu_saveconf (void) { @@ -1135,6 +1138,7 @@ menu_saveconf (void) PrintText (sess, "Error saving settings.\n"); } } +#endif static void menu_newserver_window (GtkWidget * wid, gpointer none) @@ -1653,7 +1657,9 @@ static struct mymenu mymenu[] = { {N_("Userlist Popup..."), menu_ulpopup, 0, M_MENUITEM, 0, 0, 1}, {0, 0, 0, M_END, 0, 0, 0}, /* 53 */ - /* {N_("Save Settings to Disk"), menu_saveconf, GTK_STOCK_SAVE, M_MENUSTOCK, 0, 0, 1}, don't use this, a /set auto-save approach will be added instead */ +#if 0 + {N_("Save Settings to Disk"), menu_saveconf, GTK_STOCK_SAVE, M_MENUSTOCK, 0, 0, 1}, /* don't use this, a /set auto-save approach will be added instead */ +#endif {N_("_Window"), 0, 0, M_NEWMENU, 0, 0, 1}, {N_("Ban List..."), menu_banlist, 0, M_MENUITEM, 0, 0, 1}, diff --git a/src/fe-gtk/palette.c b/src/fe-gtk/palette.c index b94ac874..104700c2 100644 --- a/src/fe-gtk/palette.c +++ b/src/fe-gtk/palette.c @@ -22,6 +22,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "fe-gtk.h" #include "palette.h" diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index 62a726a4..b9f60f8d 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -1,20 +1,23 @@ /* Copyright (C) 2006-2007 Peter Zelezny. */ #include -#include "../../plugins/xchat-plugin.h" +#include "../common/xchat-plugin.h" #include "../common/xchat.h" #include "../common/xchatc.h" #include "../common/inbound.h" #include "../common/server.h" #include "../common/fe.h" #include "../common/util.h" -#include "../common/wdkutil.h" #include "fe-gtk.h" #include "pixmaps.h" #include "maingui.h" #include "menu.h" #include +#ifndef WIN32 +#include +#endif + #ifdef USE_LIBNOTIFY #include #ifndef NOTIFY_CHECK_VERSION @@ -510,7 +513,7 @@ tray_menu_cb (GtkWidget *widget, guint button, guint time, gpointer userdata) tray_make_item (menu, _("_Hide Window"), tray_menu_restore_cb, NULL); tray_make_item (menu, NULL, tray_menu_quit_cb, NULL); -#if 0 +#ifndef WIN32 /* somehow this is broken on win32 */ submenu = mg_submenu (menu, _("_Blink on")); blink_item (&prefs.input_tray_chans, submenu, _("Channel Message")); blink_item (&prefs.input_tray_priv, submenu, _("Private Message")); @@ -528,6 +531,7 @@ tray_menu_cb (GtkWidget *widget, guint button, guint time, gpointer userdata) tray_make_item (menu, NULL, tray_menu_quit_cb, NULL); #endif + mg_create_icon_item (_("_Quit"), GTK_STOCK_QUIT, menu, tray_menu_quit_cb, NULL); menu_add_plugin_items (menu, "\x5$TRAY", NULL); @@ -553,8 +557,12 @@ tray_init (void) sticon = gtk_status_icon_new_from_pixbuf (ICON_NORMAL); if (!sticon) return; - /* g_signal_connect (G_OBJECT (sticon), "popup-menu", - G_CALLBACK (tray_menu_cb), sticon); */ + +#ifndef WIN32 + g_signal_connect (G_OBJECT (sticon), "popup-menu", + G_CALLBACK (tray_menu_cb), sticon); +#endif + g_signal_connect (G_OBJECT (sticon), "activate", G_CALLBACK (tray_menu_restore_cb), NULL); } diff --git a/src/fe-gtk/plugingui.c b/src/fe-gtk/plugingui.c index 0edfc62b..71d2f02e 100644 --- a/src/fe-gtk/plugingui.c +++ b/src/fe-gtk/plugingui.c @@ -35,7 +35,7 @@ #include "../common/xchat.h" #define PLUGIN_C typedef struct session xchat_context; -#include "../../plugins/xchat-plugin.h" +#include "../common/xchat-plugin.h" #include "../common/plugin.h" #include "../common/util.h" #include "../common/outbound.h" @@ -146,10 +146,13 @@ plugingui_load_cb (session *sess, char *file) void plugingui_load (void) { - gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, - current_sess, + gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, current_sess, +#ifdef WIN32 "Plugins and Scripts\0*.dll;*.lua;*.pl;*.py;*.tcl\0" "All files\0*.*\0\0", 0); +#else + NULL, FRF_ADDFOLDER); +#endif } static void diff --git a/src/fe-gtk/rawlog.c b/src/fe-gtk/rawlog.c index a3e1a63b..593468c1 100644 --- a/src/fe-gtk/rawlog.c +++ b/src/fe-gtk/rawlog.c @@ -21,6 +21,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "fe-gtk.h" #include diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 5b242508..1f1be0b4 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -14,7 +14,6 @@ #include "../common/text.h" #include "../common/userlist.h" #include "../common/util.h" -#include "../common/wdkutil.h" #include "../common/xchatc.h" #include "fe-gtk.h" #include "gtkutil.h" @@ -111,7 +110,7 @@ static const setting textbox_settings[] = {ST_TOGGLR, N_("Indent nick names"), P_OFFINTNL(indent_nicks), N_("Make nick names right-justified"),0,0}, {ST_TOGGLE, N_("Transparent background"), P_OFFINTNL(transparent),0,0,0}, - {ST_TOGGLE, N_("Show marker line"), P_OFFINTNL(show_marker), + {ST_TOGGLR, N_("Show marker line"), P_OFFINTNL(show_marker), N_("Insert a red line after the last read text."),0,0}, {ST_HEADER, N_("Transparency Settings"), 0,0,0}, {ST_HSCALE, N_("Red:"), P_OFFINTNL(tint_red),0,0,0}, @@ -153,7 +152,11 @@ static const setting inputbox_settings[] = #if defined(USE_GTKSPELL) || defined(USE_LIBSEXY) {ST_TOGGLE, N_("Spell checking"), P_OFFINTNL(gui_input_spell),0,0,0}, {ST_ENTRY, N_("Dictionaries to use:"), P_OFFSETNL(spell_langs),0,0,sizeof prefs.spell_langs}, +#ifdef WIN32 {ST_LABEL, N_("Use language codes (as in \"share\\myspell\\dicts\").\nSeparate multiple entries with commas.")}, +#else + {ST_LABEL, N_("Use language codes. Separate multiple entries with commas.")}, +#endif #endif {ST_HEADER, N_("Nick Completion"),0,0,0}, @@ -413,6 +416,7 @@ static const setting advanced_settings[] = {ST_END, 0, 0, 0, 0, 0} }; +#ifdef WIN32 static const setting advanced_settings_oneinstance[] = { {ST_HEADER, N_("Advanced Settings"),0,0,0}, @@ -429,6 +433,7 @@ static const setting advanced_settings_oneinstance[] = {ST_END, 0, 0, 0, 0, 0} }; +#endif static const setting logging_settings[] = { @@ -1797,6 +1802,7 @@ setup_create_pages (GtkWidget *box) setup_add_page (cata[10], book, setup_create_page (logging_settings)); setup_add_page (cata[11], book, setup_create_sound_page ()); +#ifdef WIN32 if (portable_mode ()) { setup_add_page (cata[12], book, setup_create_page (advanced_settings)); @@ -1805,6 +1811,9 @@ setup_create_pages (GtkWidget *box) { setup_add_page (cata[12], book, setup_create_page (advanced_settings_oneinstance)); } +#else + setup_add_page (cata[12], book, setup_create_page (advanced_settings)); +#endif setup_add_page (cata[14], book, setup_create_page (network_settings)); setup_add_page (cata[15], book, setup_create_page (filexfer_settings)); diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c index 8f21e977..9483f04b 100644 --- a/src/fe-gtk/sexy-spell-entry.c +++ b/src/fe-gtk/sexy-spell-entry.c @@ -33,7 +33,9 @@ #include "sexy-iso-codes.h" #include "sexy-marshal.h" +#ifdef WIN32 #include "typedef.h" +#endif #include "../common/cfgfiles.h" #include "../common/xchatc.h" @@ -141,9 +143,18 @@ initialize_enchant () GModule *enchant; gpointer funcptr; +#ifdef WIN32 enchant = g_module_open("libenchant.dll", 0); +#else + enchant = g_module_open("libenchant", 0); +#endif if (enchant == NULL) { +#ifndef WIN32 + enchant = g_module_open("libenchant.so.1", 0); + if (enchant == NULL) + return; +#endif return; } diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index 5a83062b..3bc9b6a8 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -74,6 +74,8 @@ #ifdef WIN32 #include #include +#else +#include #endif /* is delimiter */ -- cgit 1.4.1 From a9fb6a18ecaff6b2f39a4710677385557af15924 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 20 Jan 2012 00:38:57 +0100 Subject: initial patch for filtering malicious characters on win32 (Khisanth) --- src/common/server.c | 17 +++++++++++++++++ src/common/text.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- src/common/text.h | 3 +++ 3 files changed, 70 insertions(+), 1 deletion(-) (limited to 'src/common/server.c') diff --git a/src/common/server.c b/src/common/server.c index cdd67cda..53e877e3 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -310,6 +310,11 @@ server_inline (server *serv, char *line, int len) { char *utf_line_allocated = NULL; +#ifdef WIN32 + char *cleaned_line; + int cleaned_len; +#endif + /* Checks whether we're set to use UTF-8 charset */ if (serv->using_irc || /* 1. using CP1252/UTF-8 Hybrid */ (serv->encoding == NULL && prefs.utf8_locale) || /* OR 2. using system default->UTF-8 */ @@ -396,12 +401,24 @@ server_inline (server *serv, char *line, int len) } } +#ifdef WIN32 + cleaned_line = text_replace_non_bmp (line, len, &cleaned_len); + if (cleaned_line != NULL ) { + line = cleaned_line; + len = cleaned_len; + } +#endif + fe_add_rawlog (serv, line, len, FALSE); url_check_line (line, len); /* let proto-irc.c handle it */ serv->p_inline (serv, line, len); +#ifdef WIN32 + g_free (cleaned_line); +#endif + if (utf_line_allocated != NULL) /* only if a special copy was allocated */ g_free (utf_line_allocated); } diff --git a/src/common/text.c b/src/common/text.c index 9aa1bc85..93392d1a 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -275,7 +275,10 @@ scrollback_load (session *sess) time_t stamp; int lines; -#ifndef WIN32 +#ifdef WIN32 + char *cleaned_text; + int cleaned_len; +#else char *map, *end_map; struct stat statbuf; const char *begin, *eol; @@ -371,6 +374,12 @@ scrollback_load (session *sess) if (text) { text = strip_color (text + 1, -1, STRIP_COLOR); + cleaned_text = text_replace_non_bmp (text, -1, &cleaned_len); + if (cleaned_text != NULL) + { + g_free (text); + text = cleaned_text; + } fe_print_text (sess, text, stamp); g_free (text); } @@ -852,6 +861,46 @@ iso_8859_1_to_utf8 (unsigned char *text, int len, gsize *bytes_written) return res; } +#ifdef WIN32 +/* replace characters outside of the Basic Multilingual Plane with + * replacement characters (0xFFFD) */ +char * +text_replace_non_bmp (char *utf8_input, int input_length, glong *output_length) +{ + gunichar *ucs4_text; + gunichar suspect; + gchar *utf8_text; + glong ucs4_length; + glong index; + + ucs4_text = g_utf8_to_ucs4_fast (utf8_input, input_length, &ucs4_length); + + /* replace anything not in the Basic Multilingual Plane + * (code points above 0xFFFF) with the replacement + * character */ + for (index = 0; index < ucs4_length; index++) + { + suspect = ucs4_text[index]; + if ((suspect >= 0x1D173 && suspect <= 0x1D17A) + || (suspect >= 0xE0001 && suspect <= 0xE007F)) + { + ucs4_text[index] = 0xFFFD; /* replacement character */ + } + } + + utf8_text = g_ucs4_to_utf8 ( + ucs4_text, + ucs4_length, + NULL, + output_length, + NULL + ); + g_free (ucs4_text); + + return utf8_text; +} +#endif + char * text_validate (char **text, int *len) { diff --git a/src/common/text.h b/src/common/text.h index 150821ae..6d5ac03e 100644 --- a/src/common/text.h +++ b/src/common/text.h @@ -28,6 +28,9 @@ int pevent_load (char *filename); void pevent_make_pntevts (void); void text_emit (int index, session *sess, char *a, char *b, char *c, char *d); int text_emit_by_name (char *name, session *sess, char *a, char *b, char *c, char *d); +#ifdef WIN32 +char *text_replace_non_bmp (char *utf8_input, int input_length, glong *output_length); +#endif char *text_validate (char **text, int *len); int get_stamp_str (char *fmt, time_t tim, char **ret); void format_event (session *sess, int index, char **args, char *o, int sizeofo, unsigned int stripcolor_args); -- cgit 1.4.1 From c1ec6d1039317342ed339f2ca1b52e2f4f3b07d3 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 20 Jan 2012 01:31:53 +0100 Subject: allow for disabling the filtering mechanism --- src/common/cfgfiles.c | 4 ++++ src/common/server.c | 11 +++++++---- src/common/text.c | 11 +++++++---- src/common/xchat.h | 1 + src/fe-gtk/setup.c | 4 ++++ 5 files changed, 23 insertions(+), 8 deletions(-) (limited to 'src/common/server.c') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 130ad9d9..47d615e0 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -581,6 +581,9 @@ const struct prefs vars[] = { {"text_indent", P_OFFINT (indent_nicks), TYPE_BOOL}, {"text_max_indent", P_OFFINT (max_auto_indent), TYPE_INT}, {"text_max_lines", P_OFFINT (max_lines), TYPE_INT}, +#ifdef WIN32 + {"text_nonbmp", P_OFFINT (text_nonbmp), TYPE_BOOL}, +#endif {"text_replay", P_OFFINT (text_replay), TYPE_BOOL}, {"text_show_marker", P_OFFINT (show_marker), TYPE_BOOL}, {"text_show_sep", P_OFFINT (show_separator), TYPE_BOOL}, @@ -714,6 +717,7 @@ load_config (void) prefs.autodccsend = 2; /* browse mode */ #ifdef WIN32 prefs.identd = 1; + prefs.text_nonbmp = 1; #endif strcpy (prefs.gui_license, ""); strcpy (prefs.spell_langs, g_getenv ("LC_ALL") ? g_getenv ("LC_ALL") : "en_US"); diff --git a/src/common/server.c b/src/common/server.c index 53e877e3..fb50cc8a 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -402,10 +402,13 @@ server_inline (server *serv, char *line, int len) } #ifdef WIN32 - cleaned_line = text_replace_non_bmp (line, len, &cleaned_len); - if (cleaned_line != NULL ) { - line = cleaned_line; - len = cleaned_len; + if (prefs.text_nonbmp) + { + cleaned_line = text_replace_non_bmp (line, len, &cleaned_len); + if (cleaned_line != NULL ) { + line = cleaned_line; + len = cleaned_len; + } } #endif diff --git a/src/common/text.c b/src/common/text.c index 93392d1a..64102908 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -374,11 +374,14 @@ scrollback_load (session *sess) if (text) { text = strip_color (text + 1, -1, STRIP_COLOR); - cleaned_text = text_replace_non_bmp (text, -1, &cleaned_len); - if (cleaned_text != NULL) + if (prefs.text_nonbmp) { - g_free (text); - text = cleaned_text; + cleaned_text = text_replace_non_bmp (text, -1, &cleaned_len); + if (cleaned_text != NULL) + { + g_free (text); + text = cleaned_text; + } } fe_print_text (sess, text, stamp); g_free (text); diff --git a/src/common/xchat.h b/src/common/xchat.h index 6815cc39..ba9040ca 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -307,6 +307,7 @@ struct xchatprefs unsigned int emoticons; unsigned int tab_icons; unsigned int tab_xp; + unsigned int text_nonbmp; #endif unsigned int ctcp_number_limit; /*flood */ diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index cce85d30..bf100570 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -407,6 +407,9 @@ static const setting advanced_settings[] = {ST_TOGGLE, N_("Display MODEs in raw form"), P_OFFINTNL(raw_modes), 0, 0, 0}, {ST_TOGGLE, N_("Whois on notify"), P_OFFINTNL(whois_on_notifyonline), N_("Sends a /WHOIS when a user comes online in your notify list"), 0, 0}, {ST_TOGGLE, N_("Hide join and part messages"), P_OFFINTNL(confmode), N_("Hide channel join/part messages by default"), 0, 0}, +#ifdef WIN32 + {ST_TOGGLE, N_("Sanitize exotic characters causing crashes"), P_OFFINTNL(text_nonbmp), 0, 0, 0}, +#endif {ST_ENTRY, N_("License Text:"), P_OFFSETNL(gui_license), 0, 0, sizeof prefs.gui_license}, {ST_HEADER, N_("Auto Open DCC Windows"),0,0,0}, {ST_TOGGLE, N_("Send window"), P_OFFINTNL(autoopendccsendwindow), 0, 0, 0}, @@ -425,6 +428,7 @@ static const setting advanced_settings_oneinstance[] = {ST_TOGGLE, N_("Whois on notify"), P_OFFINTNL(whois_on_notifyonline), N_("Sends a /WHOIS when a user comes online in your notify list"), 0, 0}, {ST_TOGGLE, N_("Hide join and part messages"), P_OFFINTNL(confmode), N_("Hide channel join/part messages by default"), 0, 0}, {ST_TOGGLE, N_("Allow only one instance of XChat to run"), P_OFFINTNL(gui_one_instance), 0, 0, 0}, + {ST_TOGGLE, N_("Sanitize exotic characters causing crashes"), P_OFFINTNL(text_nonbmp), 0, 0, 0}, {ST_ENTRY, N_("License Text:"), P_OFFSETNL(gui_license), 0, 0, sizeof prefs.gui_license}, {ST_HEADER, N_("Auto Open DCC Windows"),0,0,0}, {ST_TOGGLE, N_("Send window"), P_OFFINTNL(autoopendccsendwindow), 0, 0, 0}, -- cgit 1.4.1 From 3563acdb0d87d88733c967f8ac920877b8b4a1eb Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 20 Jan 2012 01:47:01 +0100 Subject: Revert "allow for disabling the filtering mechanism" This reverts commit c1ec6d1039317342ed339f2ca1b52e2f4f3b07d3. --- src/common/cfgfiles.c | 4 ---- src/common/server.c | 11 ++++------- src/common/text.c | 11 ++++------- src/common/xchat.h | 1 - src/fe-gtk/setup.c | 4 ---- 5 files changed, 8 insertions(+), 23 deletions(-) (limited to 'src/common/server.c') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 47d615e0..130ad9d9 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -581,9 +581,6 @@ const struct prefs vars[] = { {"text_indent", P_OFFINT (indent_nicks), TYPE_BOOL}, {"text_max_indent", P_OFFINT (max_auto_indent), TYPE_INT}, {"text_max_lines", P_OFFINT (max_lines), TYPE_INT}, -#ifdef WIN32 - {"text_nonbmp", P_OFFINT (text_nonbmp), TYPE_BOOL}, -#endif {"text_replay", P_OFFINT (text_replay), TYPE_BOOL}, {"text_show_marker", P_OFFINT (show_marker), TYPE_BOOL}, {"text_show_sep", P_OFFINT (show_separator), TYPE_BOOL}, @@ -717,7 +714,6 @@ load_config (void) prefs.autodccsend = 2; /* browse mode */ #ifdef WIN32 prefs.identd = 1; - prefs.text_nonbmp = 1; #endif strcpy (prefs.gui_license, ""); strcpy (prefs.spell_langs, g_getenv ("LC_ALL") ? g_getenv ("LC_ALL") : "en_US"); diff --git a/src/common/server.c b/src/common/server.c index fb50cc8a..53e877e3 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -402,13 +402,10 @@ server_inline (server *serv, char *line, int len) } #ifdef WIN32 - if (prefs.text_nonbmp) - { - cleaned_line = text_replace_non_bmp (line, len, &cleaned_len); - if (cleaned_line != NULL ) { - line = cleaned_line; - len = cleaned_len; - } + cleaned_line = text_replace_non_bmp (line, len, &cleaned_len); + if (cleaned_line != NULL ) { + line = cleaned_line; + len = cleaned_len; } #endif diff --git a/src/common/text.c b/src/common/text.c index 64102908..93392d1a 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -374,14 +374,11 @@ scrollback_load (session *sess) if (text) { text = strip_color (text + 1, -1, STRIP_COLOR); - if (prefs.text_nonbmp) + cleaned_text = text_replace_non_bmp (text, -1, &cleaned_len); + if (cleaned_text != NULL) { - cleaned_text = text_replace_non_bmp (text, -1, &cleaned_len); - if (cleaned_text != NULL) - { - g_free (text); - text = cleaned_text; - } + g_free (text); + text = cleaned_text; } fe_print_text (sess, text, stamp); g_free (text); diff --git a/src/common/xchat.h b/src/common/xchat.h index ba9040ca..6815cc39 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -307,7 +307,6 @@ struct xchatprefs unsigned int emoticons; unsigned int tab_icons; unsigned int tab_xp; - unsigned int text_nonbmp; #endif unsigned int ctcp_number_limit; /*flood */ diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index bf100570..cce85d30 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -407,9 +407,6 @@ static const setting advanced_settings[] = {ST_TOGGLE, N_("Display MODEs in raw form"), P_OFFINTNL(raw_modes), 0, 0, 0}, {ST_TOGGLE, N_("Whois on notify"), P_OFFINTNL(whois_on_notifyonline), N_("Sends a /WHOIS when a user comes online in your notify list"), 0, 0}, {ST_TOGGLE, N_("Hide join and part messages"), P_OFFINTNL(confmode), N_("Hide channel join/part messages by default"), 0, 0}, -#ifdef WIN32 - {ST_TOGGLE, N_("Sanitize exotic characters causing crashes"), P_OFFINTNL(text_nonbmp), 0, 0, 0}, -#endif {ST_ENTRY, N_("License Text:"), P_OFFSETNL(gui_license), 0, 0, sizeof prefs.gui_license}, {ST_HEADER, N_("Auto Open DCC Windows"),0,0,0}, {ST_TOGGLE, N_("Send window"), P_OFFINTNL(autoopendccsendwindow), 0, 0, 0}, @@ -428,7 +425,6 @@ static const setting advanced_settings_oneinstance[] = {ST_TOGGLE, N_("Whois on notify"), P_OFFINTNL(whois_on_notifyonline), N_("Sends a /WHOIS when a user comes online in your notify list"), 0, 0}, {ST_TOGGLE, N_("Hide join and part messages"), P_OFFINTNL(confmode), N_("Hide channel join/part messages by default"), 0, 0}, {ST_TOGGLE, N_("Allow only one instance of XChat to run"), P_OFFINTNL(gui_one_instance), 0, 0, 0}, - {ST_TOGGLE, N_("Sanitize exotic characters causing crashes"), P_OFFINTNL(text_nonbmp), 0, 0, 0}, {ST_ENTRY, N_("License Text:"), P_OFFSETNL(gui_license), 0, 0, sizeof prefs.gui_license}, {ST_HEADER, N_("Auto Open DCC Windows"),0,0,0}, {ST_TOGGLE, N_("Send window"), P_OFFINTNL(autoopendccsendwindow), 0, 0, 0}, -- cgit 1.4.1 From 99b9c1f0b20d2ed896cb930c0213e0d6f28a5b10 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Wed, 1 Feb 2012 18:09:27 +0100 Subject: IPv6 support for XChat (Olipro) --- src/common/identd.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++- src/common/identd.h | 1 + src/common/makefile.mak | 1 + src/common/server.c | 2 +- 4 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 src/common/identd.h (limited to 'src/common/server.c') diff --git a/src/common/identd.c b/src/common/identd.c index 919282ea..430c7e8f 100644 --- a/src/common/identd.c +++ b/src/common/identd.c @@ -1,8 +1,13 @@ /* simple identd server for xchat under win32 */ +#include "inet.h" +#include "xchat.h" +#include "xchatc.h" static int identd_is_running = FALSE; - +#ifdef USE_IPV6 +static int identd_ipv6_is_running = FALSE; +#endif static int identd (char *username) @@ -75,11 +80,102 @@ identd (char *username) return 0; } -static void +#ifdef USE_IPV6 +static int +identd_ipv6 (char *username) +{ + int sok, read_sok, len; + char *p; + char buf[256]; + char outbuf[256]; + char ipv6buf[60]; + DWORD ipv6buflen = sizeof (ipv6buf); + struct sockaddr_in6 addr; + + sok = socket (AF_INET6, SOCK_STREAM, 0); + + if (sok == INVALID_SOCKET) + { + free (username); + return 0; + } + + len = 1; + setsockopt (sok, SOL_SOCKET, SO_REUSEADDR, (char *) &len, sizeof (len)); + + memset (&addr, 0, sizeof (addr)); + addr.sin6_family = AF_INET6; + addr.sin6_port = htons (113); + + if (bind (sok, (struct sockaddr *) &addr, sizeof (addr)) == SOCKET_ERROR) + { + closesocket (sok); + free (username); + return 0; + } + + if (listen (sok, 1) == SOCKET_ERROR) + { + closesocket (sok); + free (username); + return 0; + } + + len = sizeof (addr); + read_sok = accept (sok, (struct sockaddr *) &addr, &len); + closesocket (sok); + + if (read_sok == INVALID_SOCKET) + { + free (username); + return 0; + } + + identd_ipv6_is_running = FALSE; + + if (WSAAddressToString ((struct sockaddr *) &addr, sizeof (addr), NULL, &ipv6buf, &ipv6buflen) == SOCKET_ERROR) + { + snprintf (ipv6buf, sizeof (ipv6buf) - 1, "[SOCKET ERROR: 0x%X]", WSAGetLastError ()); + } + + snprintf (outbuf, sizeof (outbuf), "%%\tServicing ident request from %s\n", ipv6buf); + PrintText (current_sess, outbuf); + + recv (read_sok, buf, sizeof (buf) - 1, 0); + buf[sizeof (buf) - 1] = 0; /* ensure null termination */ + + p = strchr (buf, ','); + + if (p) + { + snprintf (outbuf, sizeof (outbuf) - 1, "%d, %d : USERID : UNIX : %s\r\n", atoi (buf), atoi (p + 1), username); + outbuf[sizeof (outbuf) - 1] = 0; /* ensure null termination */ + send (read_sok, outbuf, strlen (outbuf), 0); + } + + sleep (1); + closesocket (read_sok); + free (username); + + return 0; +} +#endif + +void identd_start (char *username) { DWORD tid; +#ifdef USE_IPV6 + DWORD tidv6; + if (identd_ipv6_is_running == FALSE) + { + identd_ipv6_is_running = TRUE; + CloseHandle (CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) identd_ipv6, + strdup (username), 0, &tidv6)); + } +#endif + if (identd_is_running == FALSE) { identd_is_running = TRUE; diff --git a/src/common/identd.h b/src/common/identd.h new file mode 100644 index 00000000..636f9641 --- /dev/null +++ b/src/common/identd.h @@ -0,0 +1 @@ +void identd_start (char *username); diff --git a/src/common/makefile.mak b/src/common/makefile.mak index f78a6d8d..d6df2608 100644 --- a/src/common/makefile.mak +++ b/src/common/makefile.mak @@ -7,6 +7,7 @@ ctcp.obj \ dcc.obj \ dirent-win32.obj \ history.obj \ +identd.obj \ ignore.obj \ inbound.obj \ modes.obj \ diff --git a/src/common/server.c b/src/common/server.c index 53e877e3..75b2e005 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -67,7 +67,7 @@ #endif #ifdef WIN32 -#include "identd.c" +#include "identd.h" #endif #ifdef USE_LIBPROXY -- cgit 1.4.1 From a6230d9e00bf55725195572094bb7f1372cc93a8 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 4 Feb 2012 16:23:02 +0100 Subject: fix compilation error on Linux due to bad merge --- src/common/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common/server.c') diff --git a/src/common/server.c b/src/common/server.c index 75b2e005..657030ba 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -1511,7 +1511,7 @@ server_child (server * serv) if (FALSE) ; #ifdef USE_LIBPROXY - } else if (prefs.proxy_type == 5) + else if (prefs.proxy_type == 5) { char **proxy_list; char *url, *proxy; -- cgit 1.4.1 From 35821f3875e4a718932f7f67debdeacaa8c6cc3d Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 16 Jun 2012 13:01:47 +0200 Subject: Fix string handling for Turkish locale --- src/common/cfgfiles.c | 24 ++++++------ src/common/chanopt.c | 8 ++-- src/common/ctcp.c | 10 ++--- src/common/dcc.c | 14 +++---- src/common/inbound.c | 2 +- src/common/modes.c | 10 ++--- src/common/outbound.c | 88 +++++++++++++++++++++---------------------- src/common/plugin-timer.c | 10 ++--- src/common/plugin.c | 16 ++++---- src/common/proto-irc.c | 10 ++--- src/common/server.c | 18 ++++----- src/common/servlist.c | 10 ++--- src/common/url.c | 8 ++-- src/common/util.c | 4 +- src/common/xchat.h | 4 +- src/fe-gtk/fkeys.c | 6 +-- src/fe-gtk/maingui.c | 4 +- src/fe-gtk/menu.c | 10 ++--- src/fe-gtk/notifygui.c | 2 +- src/fe-gtk/plugingui.c | 6 +-- src/fe-gtk/sexy-spell-entry.c | 4 +- src/fe-gtk/xtext.c | 2 +- 22 files changed, 135 insertions(+), 135 deletions(-) (limited to 'src/common/server.c') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 081137b8..111234e9 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -84,11 +84,11 @@ list_load_from_data (GSList ** list, char *ibuf, int size) { if (*buf != '#') { - if (!strncasecmp (buf, "NAME ", 5)) + if (!g_ascii_strncasecmp (buf, "NAME ", 5)) { safe_strcpy (name, buf + 5, sizeof (name)); } - else if (!strncasecmp (buf, "CMD ", 4)) + else if (!g_ascii_strncasecmp (buf, "CMD ", 4)) { safe_strcpy (cmd, buf + 4, sizeof (cmd)); if (*name) @@ -154,7 +154,7 @@ list_delentry (GSList ** list, char *name) while (alist) { pop = (struct popup *) alist->data; - if (!strcasecmp (name, pop->name)) + if (!g_ascii_strcasecmp (name, pop->name)) { *list = g_slist_remove (*list, pop); free (pop); @@ -174,7 +174,7 @@ cfg_get_str (char *cfg, char *var, char *dest, int dest_len) while (1) { - if (!strncasecmp (buffer, cfg, strlen (var) + 1)) + if (!g_ascii_strncasecmp (buffer, cfg, strlen (var) + 1)) { char *value, t; cfg += strlen (var); @@ -1000,7 +1000,7 @@ cfg_get_bool (char *var) do { - if (!strcasecmp (var, vars[i].name)) + if (!g_ascii_strcasecmp (var, vars[i].name)) { return *((int *) &prefs + vars[i].offset); } @@ -1023,27 +1023,27 @@ cmd_set (struct session *sess, char *tbuf, char *word[], char *word_eol[]) int idx = 2; char *var, *val; - if (strcasecmp (word[2], "-e") == 0) + if (g_ascii_strcasecmp (word[2], "-e") == 0) { idx++; erase = TRUE; } /* turn a bit OFF */ - if (strcasecmp (word[idx], "-off") == 0) + if (g_ascii_strcasecmp (word[idx], "-off") == 0) { idx++; off = TRUE; } /* turn a bit ON */ - if (strcasecmp (word[idx], "-or") == 0 || strcasecmp (word[idx], "-on") == 0) + if (g_ascii_strcasecmp (word[idx], "-or") == 0 || g_ascii_strcasecmp (word[idx], "-on") == 0) { idx++; or = TRUE; } - if (strcasecmp (word[idx], "-quiet") == 0) + if (g_ascii_strcasecmp (word[idx], "-quiet") == 0) { idx++; quiet = TRUE; @@ -1069,7 +1069,7 @@ cmd_set (struct session *sess, char *tbuf, char *word[], char *word_eol[]) if (wild) found = !match (var, vars[i].name); else - found = strcasecmp (var, vars[i].name); + found = g_ascii_strcasecmp (var, vars[i].name); if (found == 0) { @@ -1098,9 +1098,9 @@ cmd_set (struct session *sess, char *tbuf, char *word[], char *word_eol[]) *((int *) &prefs + vars[i].offset) = 1; else *((int *) &prefs + vars[i].offset) = 0; - if (!strcasecmp (val, "YES") || !strcasecmp (val, "ON")) + if (!g_ascii_strcasecmp (val, "YES") || !g_ascii_strcasecmp (val, "ON")) *((int *) &prefs + vars[i].offset) = 1; - if (!strcasecmp (val, "NO") || !strcasecmp (val, "OFF")) + if (!g_ascii_strcasecmp (val, "NO") || !g_ascii_strcasecmp (val, "OFF")) *((int *) &prefs + vars[i].offset) = 0; } else { diff --git a/src/common/chanopt.c b/src/common/chanopt.c index f8e16e8b..198ebe6c 100644 --- a/src/common/chanopt.c +++ b/src/common/chanopt.c @@ -84,9 +84,9 @@ chanopt_command (session *sess, char *tbuf, char *word[], char *word_eol[]) if (word[offset][0]) { - if (!strcasecmp (word[offset], "ON")) + if (!g_ascii_strcasecmp (word[offset], "ON")) newval = 1; - else if (!strcasecmp (word[offset], "OFF")) + else if (!g_ascii_strcasecmp (word[offset], "OFF")) newval = 0; else if (word[offset][0] == 'u') newval = SET_DEFAULT; @@ -186,8 +186,8 @@ chanopt_find (char *network, char *channel, gboolean add_new) for (list = chanopt_list; list; list = list->next) { co = list->data; - if (!strcasecmp (co->channel, channel) && - !strcasecmp (co->network, network)) + if (!g_ascii_strcasecmp (co->channel, channel) && + !g_ascii_strcasecmp (co->network, network)) return co; } diff --git a/src/common/ctcp.c b/src/common/ctcp.c index 2bb75746..36952db7 100644 --- a/src/common/ctcp.c +++ b/src/common/ctcp.c @@ -73,7 +73,7 @@ ctcp_check (session *sess, char *nick, char *word[], char *word_eol[], while (list) { pop = (struct popup *) list->data; - if (!strcasecmp (ctcp, pop->name)) + if (!g_ascii_strcasecmp (ctcp, pop->name)) { ctcp_reply (sess, nick, word, word_eol, pop->cmd); ret = 1; @@ -97,7 +97,7 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip, ctcp_offset = 3; /* consider DCC to be different from other CTCPs */ - if (!strncasecmp (msg, "DCC", 3)) + if (!g_ascii_strncasecmp (msg, "DCC", 3)) { /* but still let CTCP replies override it */ if (!ctcp_check (sess, nick, word, word_eol, word[4] + ctcp_offset)) @@ -110,7 +110,7 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip, /* consider ACTION to be different from other CTCPs. Check ignore as if it was a PRIV/CHAN. */ - if (!strncasecmp (msg, "ACTION ", 7)) + if (!g_ascii_strncasecmp (msg, "ACTION ", 7)) { if (is_channel (serv, to)) { @@ -135,7 +135,7 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip, if (ignore_check (word[1], IG_CTCP)) return; - if (!strcasecmp (msg, "VERSION") && !prefs.hidever) + if (!g_ascii_strcasecmp (msg, "VERSION") && !prefs.hidever) { #ifdef WIN32 snprintf (outbuf, sizeof (outbuf), "VERSION XChat-WDK "PACKAGE_VERSION" [x%d] / %s", @@ -149,7 +149,7 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip, if (!ctcp_check (sess, nick, word, word_eol, word[4] + ctcp_offset)) { - if (!strncasecmp (msg, "SOUND", 5)) + if (!g_ascii_strncasecmp (msg, "SOUND", 5)) { po = strchr (word[5], '\001'); if (po) diff --git a/src/common/dcc.c b/src/common/dcc.c index d91b7e8e..4c8724d9 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -572,7 +572,7 @@ dcc_chat_line (struct DCC *dcc, char *line) url_check_line (line, len); - if (line[0] == 1 && !strncasecmp (line + 1, "ACTION", 6)) + if (line[0] == 1 && !g_ascii_strncasecmp (line + 1, "ACTION", 6)) { po = strchr (line + 8, '\001'); if (po) @@ -1940,9 +1940,9 @@ find_dcc (char *nick, char *file, int type) { if (!file[0]) return dcc; - if (!strcasecmp (file, file_part (dcc->file))) + if (!g_ascii_strcasecmp (file, file_part (dcc->file))) return dcc; - if (!strcasecmp (file, dcc->file)) + if (!g_ascii_strcasecmp (file, dcc->file)) return dcc; } } @@ -2406,7 +2406,7 @@ handle_dcc (struct session *sess, char *nick, char *word[], DCC_SIZE size; int psend = 0; - if (!strcasecmp (type, "CHAT")) + if (!g_ascii_strcasecmp (type, "CHAT")) { port = atoi (word[8]); addr = strtoul (word[7], NULL, 10); @@ -2453,7 +2453,7 @@ handle_dcc (struct session *sess, char *nick, char *word[], return; } - if (!strcasecmp (type, "Resume")) + if (!g_ascii_strcasecmp (type, "Resume")) { port = atoi (word[7]); @@ -2497,7 +2497,7 @@ handle_dcc (struct session *sess, char *nick, char *word[], } return; } - if (!strcasecmp (type, "Accept")) + if (!g_ascii_strcasecmp (type, "Accept")) { port = atoi (word[7]); dcc = find_dcc_from_port (port, TYPE_RECV); @@ -2507,7 +2507,7 @@ handle_dcc (struct session *sess, char *nick, char *word[], } return; } - if (!strcasecmp (type, "SEND")) + if (!g_ascii_strcasecmp (type, "SEND")) { char *file = file_part (word[6]); diff --git a/src/common/inbound.c b/src/common/inbound.c index 1c124db4..89899655 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -886,7 +886,7 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id) if (msg[0] == '[' && (!serv->have_idmsg || id)) { /* guess where chanserv meant to post this -sigh- */ - if (!strcasecmp (nick, "ChanServ") && !find_dialog (serv, nick)) + if (!g_ascii_strcasecmp (nick, "ChanServ") && !find_dialog (serv, nick)) { char *dest = strdup (msg + 1); char *end = strchr (dest, ']'); diff --git a/src/common/modes.c b/src/common/modes.c index 1acf7f54..6eb63f3b 100644 --- a/src/common/modes.c +++ b/src/common/modes.c @@ -789,20 +789,20 @@ inbound_005 (server * serv, char *word[]) } /* use /NICKSERV */ - if (strcasecmp (word[w] + 8, "RusNet") == 0) + if (g_ascii_strcasecmp (word[w] + 8, "RusNet") == 0) serv->nickservtype = 1; - else if (strcasecmp (word[w] + 8, "UniBG") == 0) + else if (g_ascii_strcasecmp (word[w] + 8, "UniBG") == 0) serv->nickservtype = 3; - else if (strcasecmp (word[w] + 8, "QuakeNet") == 0) + else if (g_ascii_strcasecmp (word[w] + 8, "QuakeNet") == 0) serv->nickservtype = 4; } else if (strncmp (word[w], "CASEMAPPING=", 12) == 0) { if (strcmp (word[w] + 12, "ascii") == 0) /* bahamut */ - serv->p_cmp = (void *)strcasecmp; + serv->p_cmp = (void *)g_ascii_strcasecmp; } else if (strncmp (word[w], "CHARSET=", 8) == 0) { - if (strcasecmp (word[w] + 8, "UTF-8") == 0) + if (g_ascii_strcasecmp (word[w] + 8, "UTF-8") == 0) { server_set_encoding (serv, "UTF-8"); } diff --git a/src/common/outbound.c b/src/common/outbound.c index b13a33a1..872ef50b 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -617,13 +617,13 @@ cmd_clear (struct session *sess, char *tbuf, char *word[], char *word_eol[]) GSList *list = sess_list; char *reason = word_eol[2]; - if (strcasecmp (reason, "HISTORY") == 0) + if (g_ascii_strcasecmp (reason, "HISTORY") == 0) { history_free (&sess->history); return TRUE; } - if (strncasecmp (reason, "all", 3) == 0) + if (g_ascii_strncasecmp (reason, "all", 3) == 0) { while (list) { @@ -750,26 +750,26 @@ cmd_dcc (struct session *sess, char *tbuf, char *word[], char *word_eol[]) char *type = word[2]; if (*type) { - if (!strcasecmp (type, "HELP")) + if (!g_ascii_strcasecmp (type, "HELP")) return FALSE; - if (!strcasecmp (type, "CLOSE")) + if (!g_ascii_strcasecmp (type, "CLOSE")) { if (*word[3] && *word[4]) { goodtype = 0; - if (!strcasecmp (word[3], "SEND")) + if (!g_ascii_strcasecmp (word[3], "SEND")) { dcc = find_dcc (word[4], word[5], TYPE_SEND); dcc_abort (sess, dcc); goodtype = TRUE; } - if (!strcasecmp (word[3], "GET")) + if (!g_ascii_strcasecmp (word[3], "GET")) { dcc = find_dcc (word[4], word[5], TYPE_RECV); dcc_abort (sess, dcc); goodtype = TRUE; } - if (!strcasecmp (word[3], "CHAT")) + if (!g_ascii_strcasecmp (word[3], "CHAT")) { dcc = find_dcc (word[4], "", TYPE_CHATRECV); if (!dcc) @@ -789,20 +789,20 @@ cmd_dcc (struct session *sess, char *tbuf, char *word[], char *word_eol[]) } return FALSE; } - if ((!strcasecmp (type, "CHAT")) || (!strcasecmp (type, "PCHAT"))) + if ((!g_ascii_strcasecmp (type, "CHAT")) || (!g_ascii_strcasecmp (type, "PCHAT"))) { char *nick = word[3]; - int passive = (!strcasecmp(type, "PCHAT")) ? 1 : 0; + int passive = (!g_ascii_strcasecmp(type, "PCHAT")) ? 1 : 0; if (*nick) dcc_chat (sess, nick, passive); return TRUE; } - if (!strcasecmp (type, "LIST")) + if (!g_ascii_strcasecmp (type, "LIST")) { dcc_show_list (sess); return TRUE; } - if (!strcasecmp (type, "GET")) + if (!g_ascii_strcasecmp (type, "GET")) { char *nick = word[3]; char *file = word[4]; @@ -820,18 +820,18 @@ cmd_dcc (struct session *sess, char *tbuf, char *word[], char *word_eol[]) } return TRUE; } - if ((!strcasecmp (type, "SEND")) || (!strcasecmp (type, "PSEND"))) + if ((!g_ascii_strcasecmp (type, "SEND")) || (!g_ascii_strcasecmp (type, "PSEND"))) { int i = 3, maxcps; char *nick, *file; - int passive = (!strcasecmp(type, "PSEND")) ? 1 : 0; + int passive = (!g_ascii_strcasecmp(type, "PSEND")) ? 1 : 0; nick = word[i]; if (!*nick) return FALSE; maxcps = prefs.dcc_max_send_cps; - if (!strncasecmp(nick, "-maxcps=", 8)) + if (!g_ascii_strncasecmp(nick, "-maxcps=", 8)) { maxcps = atoi(nick + 8); i++; @@ -1312,7 +1312,7 @@ cmd_menu (struct session *sess, char *tbuf, char *word[], char *word_eol[]) *p = '/'; } - if (!strcasecmp (word[idx], "ADD")) + if (!g_ascii_strcasecmp (word[idx], "ADD")) { if (toggle) { @@ -1327,7 +1327,7 @@ cmd_menu (struct session *sess, char *tbuf, char *word[], char *word_eol[]) return TRUE; } - if (!strcasecmp (word[idx], "DEL")) + if (!g_ascii_strcasecmp (word[idx], "DEL")) { menu_del (tbuf, label); return TRUE; @@ -2045,7 +2045,7 @@ cmd_gui (struct session *sess, char *tbuf, char *word[], char *word_eol[]) case 0xc0851aaa: fe_message (word[3], FE_MSG_INFO|FE_MSG_MARKUP); break; /* MSGBOX */ case 0x0035dafd: fe_ctrl_gui (sess, 1, 0); break; /* SHOW */ case 0x0033155f: /* MENU */ - if (!strcasecmp (word[3], "TOGGLE")) + if (!g_ascii_strcasecmp (word[3], "TOGGLE")) fe_ctrl_gui (sess, 6, 0); else return FALSE; @@ -2247,25 +2247,25 @@ cmd_ignore (struct session *sess, char *tbuf, char *word[], char *word_eol[]) } return TRUE; } - if (!strcasecmp (word[i], "UNIGNORE")) + if (!g_ascii_strcasecmp (word[i], "UNIGNORE")) type |= IG_UNIG; - else if (!strcasecmp (word[i], "ALL")) + else if (!g_ascii_strcasecmp (word[i], "ALL")) type |= IG_PRIV | IG_NOTI | IG_CHAN | IG_CTCP | IG_INVI | IG_DCC; - else if (!strcasecmp (word[i], "PRIV")) + else if (!g_ascii_strcasecmp (word[i], "PRIV")) type |= IG_PRIV; - else if (!strcasecmp (word[i], "NOTI")) + else if (!g_ascii_strcasecmp (word[i], "NOTI")) type |= IG_NOTI; - else if (!strcasecmp (word[i], "CHAN")) + else if (!g_ascii_strcasecmp (word[i], "CHAN")) type |= IG_CHAN; - else if (!strcasecmp (word[i], "CTCP")) + else if (!g_ascii_strcasecmp (word[i], "CTCP")) type |= IG_CTCP; - else if (!strcasecmp (word[i], "INVI")) + else if (!g_ascii_strcasecmp (word[i], "INVI")) type |= IG_INVI; - else if (!strcasecmp (word[i], "QUIET")) + else if (!g_ascii_strcasecmp (word[i], "QUIET")) quiet = 1; - else if (!strcasecmp (word[i], "NOSAVE")) + else if (!g_ascii_strcasecmp (word[i], "NOSAVE")) type |= IG_NOSAVE; - else if (!strcasecmp (word[i], "DCC")) + else if (!g_ascii_strcasecmp (word[i], "DCC")) type |= IG_DCC; else { @@ -2456,12 +2456,12 @@ cmd_load (struct session *sess, char *tbuf, char *word[], char *word_eol[]) #ifdef USE_PLUGIN len = strlen (word[2]); #ifdef WIN32 - if (len > 4 && strcasecmp (".dll", word[2] + len - 4) == 0) + if (len > 4 && g_ascii_strcasecmp (".dll", word[2] + len - 4) == 0) #else #if defined(__hpux) - if (len > 3 && strcasecmp (".sl", word[2] + len - 3) == 0) + if (len > 3 && g_ascii_strcasecmp (".sl", word[2] + len - 3) == 0) #else - if (len > 3 && strcasecmp (".so", word[2] + len - 3) == 0) + if (len > 3 && g_ascii_strcasecmp (".so", word[2] + len - 3) == 0) #endif #endif { @@ -2613,8 +2613,8 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[]) else { /* mask out passwords */ - if (strcasecmp (nick, "nickserv") == 0 && - strncasecmp (msg, "identify ", 9) == 0) + if (g_ascii_strcasecmp (nick, "nickserv") == 0 && + g_ascii_strncasecmp (msg, "identify ", 9) == 0) msg = "identify ****"; EMIT_SIGNAL (XP_TE_MSGSEND, sess, nick, msg, NULL, NULL, 0); } @@ -2825,7 +2825,7 @@ cmd_reconnect (struct session *sess, char *tbuf, char *word[], char *word_eol[]) prefs.recon_delay = 0; - if (!strcasecmp (word[2], "ALL")) + if (!g_ascii_strcasecmp (word[2], "ALL")) { list = serv_list; while (list) @@ -2997,7 +2997,7 @@ parse_irc_url (char *url, char *server_name[], char *port[], char *channel[], in { char *co; #ifdef USE_OPENSSL - if (strncasecmp ("ircs://", url, 7) == 0) + if (g_ascii_strncasecmp ("ircs://", url, 7) == 0) { *use_ssl = TRUE; *server_name = url + 7; @@ -3005,7 +3005,7 @@ parse_irc_url (char *url, char *server_name[], char *port[], char *channel[], in } #endif - if (strncasecmp ("irc://", url, 6) == 0) + if (g_ascii_strncasecmp ("irc://", url, 6) == 0) { *server_name = url + 6; #ifdef USE_OPENSSL @@ -3076,7 +3076,7 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[]) sess->server->network = NULL; /* dont clear it for /servchan */ - if (strncasecmp (word_eol[1], "SERVCHAN ", 9)) + if (g_ascii_strncasecmp (word_eol[1], "SERVCHAN ", 9)) sess->willjoinchannel[0] = 0; if (channel) @@ -3206,7 +3206,7 @@ cmd_unignore (struct session *sess, char *tbuf, char *word[], { if (ignore_del (mask, NULL)) { - if (strcasecmp (arg, "QUIET")) + if (g_ascii_strcasecmp (arg, "QUIET")) EMIT_SIGNAL (XP_TE_IGNOREREMOVE, sess, mask, NULL, NULL, NULL, 0); } return TRUE; @@ -3222,12 +3222,12 @@ cmd_unload (struct session *sess, char *tbuf, char *word[], char *word_eol[]) len = strlen (word[2]); #ifdef WIN32 - if (len > 4 && strcasecmp (word[2] + len - 4, ".dll") == 0) + if (len > 4 && g_ascii_strcasecmp (word[2] + len - 4, ".dll") == 0) #else #if defined(__hpux) - if (len > 3 && strcasecmp (word[2] + len - 3, ".sl") == 0) + if (len > 3 && g_ascii_strcasecmp (word[2] + len - 3, ".sl") == 0) #else - if (len > 3 && strcasecmp (word[2] + len - 3, ".so") == 0) + if (len > 3 && g_ascii_strcasecmp (word[2] + len - 3, ".so") == 0) #endif #endif by_file = TRUE; @@ -3257,7 +3257,7 @@ find_server_from_hostname (char *hostname) while (list) { serv = list->data; - if (!strcasecmp (hostname, serv->hostname) && serv->connected) + if (!g_ascii_strcasecmp (hostname, serv->hostname) && serv->connected) return serv; list = list->next; } @@ -3310,7 +3310,7 @@ cmd_url (struct session *sess, char *tbuf, char *word[], char *word_eol[]) /* maybe we're already connected to this net */ /* check for "FreeNode" */ - net = servlist_net_find (server_name, NULL, strcasecmp); + net = servlist_net_find (server_name, NULL, g_ascii_strcasecmp); /* check for "irc.eu.freenode.net" */ if (!net) net = servlist_net_find_from_server (server_name); @@ -3705,7 +3705,7 @@ const struct commands xc_cmds[] = { static int command_compare (const void *a, const void *b) { - return strcasecmp (a, ((struct commands *)b)->name); + return g_ascii_strcasecmp (a, ((struct commands *)b)->name); } static struct commands * @@ -4277,7 +4277,7 @@ handle_command (session *sess, char *cmd, int check_spch) while (list) { pop = (struct popup *) list->data; - if (!strcasecmp (pop->name, word[1])) + if (!g_ascii_strcasecmp (pop->name, word[1])) { user_command (sess, tbuf, pop->cmd, word, word_eol); user_cmd = TRUE; diff --git a/src/common/plugin-timer.c b/src/common/plugin-timer.c index f09074a8..431ce8ab 100644 --- a/src/common/plugin-timer.c +++ b/src/common/plugin-timer.c @@ -4,7 +4,7 @@ #include "xchat-plugin.h" #ifdef WIN32 -#define strcasecmp stricmp +#define g_ascii_strcasecmp stricmp #endif static xchat_plugin *ph; /* plugin handle */ @@ -151,25 +151,25 @@ timer_cb (char *word[], char *word_eol[], void *userdata) return XCHAT_EAT_XCHAT; } - if (strcasecmp (word[2], "-quiet") == 0) + if (g_ascii_strcasecmp (word[2], "-quiet") == 0) { quiet = TRUE; offset++; } - if (strcasecmp (word[2 + offset], "-delete") == 0) + if (g_ascii_strcasecmp (word[2 + offset], "-delete") == 0) { timer_del_ref (atoi (word[3 + offset]), quiet); return XCHAT_EAT_XCHAT; } - if (strcasecmp (word[2 + offset], "-refnum") == 0) + if (g_ascii_strcasecmp (word[2 + offset], "-refnum") == 0) { ref = atoi (word[3 + offset]); offset += 2; } - if (strcasecmp (word[2 + offset], "-repeat") == 0) + if (g_ascii_strcasecmp (word[2 + offset], "-repeat") == 0) { repeat = atoi (word[3 + offset]); offset += 2; diff --git a/src/common/plugin.c b/src/common/plugin.c index 2e81c1f1..0a265d16 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -309,9 +309,9 @@ plugin_kill (char *name, int by_filename) { pl = list->data; /* static-plugins (plugin-timer.c) have a NULL filename */ - if ((by_filename && pl->filename && strcasecmp (name, pl->filename) == 0) || - (by_filename && pl->filename && strcasecmp (name, file_part (pl->filename)) == 0) || - (!by_filename && strcasecmp (name, pl->name) == 0)) + if ((by_filename && pl->filename && g_ascii_strcasecmp (name, pl->filename) == 0) || + (by_filename && pl->filename && g_ascii_strcasecmp (name, file_part (pl->filename)) == 0) || + (!by_filename && g_ascii_strcasecmp (name, pl->name) == 0)) { /* statically linked plugins have a NULL filename */ if (pl->filename != NULL && !pl->fake) @@ -472,12 +472,12 @@ plugin_hook_find (GSList *list, int type, char *name) hook = list->data; if (hook->type == type) { - if (strcasecmp (hook->name, name) == 0) + if (g_ascii_strcasecmp (hook->name, name) == 0) return list; if (type == HOOK_SERVER) { - if (strcasecmp (hook->name, "RAW LINE") == 0) + if (g_ascii_strcasecmp (hook->name, "RAW LINE") == 0) return list; } } @@ -947,8 +947,8 @@ xchat_find_context (xchat_plugin *ph, const char *servname, const char *channel) if (servname == NULL || rfc_casecmp (servname, serv->servername) == 0 || - strcasecmp (servname, serv->hostname) == 0 || - strcasecmp (servname, netname) == 0) + g_ascii_strcasecmp (servname, serv->hostname) == 0 || + g_ascii_strcasecmp (servname, netname) == 0) { if (channel == NULL) return serv->front_session; @@ -1121,7 +1121,7 @@ xchat_get_prefs (xchat_plugin *ph, const char *name, const char **string, int *i do { - if (!strcasecmp (name, vars[i].name)) + if (!g_ascii_strcasecmp (name, vars[i].name)) { switch (vars[i].type) { diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index a5ebc366..d8a6be7c 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -475,12 +475,12 @@ process_numeric (session * sess, int n, } /* use /NICKSERV */ - if (strcasecmp (word[7], "DALnet") == 0 || - strcasecmp (word[7], "BRASnet") == 0) + if (g_ascii_strcasecmp (word[7], "DALnet") == 0 || + g_ascii_strcasecmp (word[7], "BRASnet") == 0) serv->nickservtype = 1; /* use /NS */ - else if (strcasecmp (word[7], "FreeNode") == 0) + else if (g_ascii_strcasecmp (word[7], "FreeNode") == 0) serv->nickservtype = 2; goto def; @@ -1075,9 +1075,9 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[]) { text[len - 1] = 0; text++; - if (strncasecmp (text, "ACTION", 6) != 0) + if (g_ascii_strncasecmp (text, "ACTION", 6) != 0) flood_check (nick, ip, serv, sess, 0); - if (strncasecmp (text, "DCC ", 4) == 0) + if (g_ascii_strncasecmp (text, "DCC ", 4) == 0) /* redo this with handle_quotes TRUE */ process_data_init (word[1], word_eol[1], word, word_eol, TRUE, FALSE); ctcp_handle (sess, to, nick, ip, text, word, word_eol, id); diff --git a/src/common/server.c b/src/common/server.c index 919d9119..c8cc59e0 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -238,17 +238,17 @@ tcp_send_len (server *serv, char *buf, int len) dbuf[len + 1] = 0; /* privmsg and notice get a lower priority */ - if (strncasecmp (dbuf + 1, "PRIVMSG", 7) == 0 || - strncasecmp (dbuf + 1, "NOTICE", 6) == 0) + if (g_ascii_strncasecmp (dbuf + 1, "PRIVMSG", 7) == 0 || + g_ascii_strncasecmp (dbuf + 1, "NOTICE", 6) == 0) { dbuf[0] = 1; } else { /* WHO/MODE get the lowest priority */ - if (strncasecmp (dbuf + 1, "WHO ", 4) == 0 || + if (g_ascii_strncasecmp (dbuf + 1, "WHO ", 4) == 0 || /* but only MODE queries, not changes */ - (strncasecmp (dbuf + 1, "MODE", 4) == 0 && + (g_ascii_strncasecmp (dbuf + 1, "MODE", 4) == 0 && strchr (dbuf, '-') == NULL && strchr (dbuf, '+') == NULL)) dbuf[0] = 0; @@ -319,8 +319,8 @@ server_inline (server *serv, char *line, int len) if (serv->using_irc || /* 1. using CP1252/UTF-8 Hybrid */ (serv->encoding == NULL && prefs.utf8_locale) || /* OR 2. using system default->UTF-8 */ (serv->encoding != NULL && /* OR 3. explicitly set to UTF-8 */ - (strcasecmp (serv->encoding, "UTF8") == 0 || - strcasecmp (serv->encoding, "UTF-8") == 0))) + (g_ascii_strcasecmp (serv->encoding, "UTF8") == 0 || + g_ascii_strcasecmp (serv->encoding, "UTF-8") == 0))) { /* The user has the UTF-8 charset set, either via /charset command or from his UTF-8 locale. Thus, we first try the @@ -1824,10 +1824,10 @@ server_set_encoding (server *serv, char *new_encoding) space[0] = 0; /* server_inline() uses these flags */ - if (!strcasecmp (serv->encoding, "CP1255") || - !strcasecmp (serv->encoding, "WINDOWS-1255")) + if (!g_ascii_strcasecmp (serv->encoding, "CP1255") || + !g_ascii_strcasecmp (serv->encoding, "WINDOWS-1255")) serv->using_cp1255 = TRUE; - else if (!strcasecmp (serv->encoding, "IRC")) + else if (!g_ascii_strcasecmp (serv->encoding, "IRC")) serv->using_irc = TRUE; } } diff --git a/src/common/servlist.c b/src/common/servlist.c index c9d4b6a8..aa32aa4d 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -588,7 +588,7 @@ servlist_connect_by_netname (session *sess, char *network, gboolean join) { net = list->data; - if (strcasecmp (net->name, network) == 0) + if (g_ascii_strcasecmp (net->name, network) == 0) { servlist_connect (sess, net, join); return 1; @@ -733,7 +733,7 @@ servlist_net_find_from_server (char *server_name) while (slist) { serv = slist->data; - if (strcasecmp (serv->hostname, server_name) == 0) + if (g_ascii_strcasecmp (serv->hostname, server_name) == 0) return net; slist = slist->next; } @@ -1018,7 +1018,7 @@ servlist_check_encoding (char *charset) if (c) c[0] = 0; - if (!strcasecmp (charset, "IRC")) /* special case */ + if (!g_ascii_strcasecmp (charset, "IRC")) /* special case */ { if (c) c[0] = ' '; @@ -1093,8 +1093,8 @@ servlist_save (void) fprintf (fp, "J=%s\n", net->autojoin); if (net->nickserv) fprintf (fp, "B=%s\n", net->nickserv); - if (net->encoding && strcasecmp (net->encoding, "System") && - strcasecmp (net->encoding, "System default")) + if (net->encoding && g_ascii_strcasecmp (net->encoding, "System") && + g_ascii_strcasecmp (net->encoding, "System default")) { fprintf (fp, "E=%s\n", net->encoding); if (!servlist_check_encoding (net->encoding)) diff --git a/src/common/url.c b/src/common/url.c index b83732d1..9fa2d75c 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -82,7 +82,7 @@ url_find (char *urltext) { int pos; - if (tree_find (url_tree, urltext, (tree_cmp_func *)strcasecmp, NULL, &pos)) + if (tree_find (url_tree, urltext, (tree_cmp_func *)g_ascii_strcasecmp, NULL, &pos)) return 1; return 0; } @@ -117,7 +117,7 @@ url_add (char *urltext, int len) } if (!url_tree) - url_tree = tree_new ((tree_cmp_func *)strcasecmp, NULL); + url_tree = tree_new ((tree_cmp_func *)g_ascii_strcasecmp, NULL); size = tree_size (url_tree); /* 0 is unlimited */ @@ -186,7 +186,7 @@ url_check_word (char *word, int len) { int j; - /* This is pretty much strncasecmp(). */ + /* This is pretty much g_ascii_strncasecmp(). */ for (j = 0; j < l; j++) { unsigned char c = word[j]; @@ -238,7 +238,7 @@ url_check_word (char *word, int len) const unsigned char *p = &word[len - l]; int j; - /* This is pretty much strncasecmp(). */ + /* This is pretty much g_ascii_strncasecmp(). */ for (j = 0; j < l; j++) { if (tolower(p[j]) != suffix[i].s[j]) diff --git a/src/common/util.c b/src/common/util.c index 73e1b29a..fb4cd23e 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -283,7 +283,7 @@ nocasestrstr (const char *s, const char *wanted) if (len == 0) return (char *)s; - while (rfc_tolower(*s) != rfc_tolower(*wanted) || strncasecmp (s, wanted, len)) + while (rfc_tolower(*s) != rfc_tolower(*wanted) || g_ascii_strncasecmp (s, wanted, len)) if (*s++ == '\0') return (char *)NULL; return (char *)s; @@ -945,7 +945,7 @@ typedef struct static int country_compare (const void *a, const void *b) { - return strcasecmp (a, ((domain_t *)b)->code); + return g_ascii_strcasecmp (a, ((domain_t *)b)->code); } static const domain_t domain[] = diff --git a/src/common/xchat.h b/src/common/xchat.h index 540a7e1a..85c20186 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -41,8 +41,8 @@ void *xchat_realloc (char *old, int len, char *file, int line); #ifdef __EMX__ /* for o/s 2 */ #define OFLAGS O_BINARY -#define strcasecmp stricmp -#define strncasecmp strnicmp +#define g_ascii_strcasecmp stricmp +#define g_ascii_strncasecmp strnicmp #define PATH_MAX MAXPATHLEN #define FILEPATH_LEN_MAX MAXPATHLEN #endif diff --git a/src/fe-gtk/fkeys.c b/src/fe-gtk/fkeys.c index b9690731..4fbbebf6 100644 --- a/src/fe-gtk/fkeys.c +++ b/src/fe-gtk/fkeys.c @@ -1260,11 +1260,11 @@ key_action_scroll_page (GtkWidget * wid, GdkEventKey * evt, char *d1, if (d1) { - if (!strcasecmp (d1, "up")) + if (!g_ascii_strcasecmp (d1, "up")) type = PAGE_UP; - else if (!strcasecmp (d1, "+1")) + else if (!g_ascii_strcasecmp (d1, "+1")) type = LINE_DOWN; - else if (!strcasecmp (d1, "-1")) + else if (!g_ascii_strcasecmp (d1, "-1")) type = LINE_UP; } diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 0b7f7c43..1ff59354 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -1688,7 +1688,7 @@ mg_dnd_drop_file (session *sess, char *target, char *uri) while (*p) { next = strchr (p, '\r'); - if (strncasecmp ("file:", p, 5) == 0) + if (g_ascii_strncasecmp ("file:", p, 5) == 0) { if (next) *next = 0; @@ -2911,7 +2911,7 @@ mg_tabs_compare (session *a, session *b) if (a->type != SESS_CHANNEL && b->type == SESS_CHANNEL) return 1; - return strcasecmp (a->channel, b->channel); + return g_ascii_strcasecmp (a->channel, b->channel); } static void diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c index 4760ba93..2a683604 100644 --- a/src/fe-gtk/menu.c +++ b/src/fe-gtk/menu.c @@ -484,18 +484,18 @@ menu_create (GtkWidget *menu, GSList *list, char *target, int check_path) { pop = (struct popup *) list->data; - if (!strncasecmp (pop->name, "SUB", 3)) + if (!g_ascii_strncasecmp (pop->name, "SUB", 3)) { childcount = 0; tempmenu = menu_quick_sub (pop->cmd, tempmenu, &subitem, XCMENU_DOLIST|XCMENU_MNEMONIC, -1); - } else if (!strncasecmp (pop->name, "TOGGLE", 6)) + } else if (!g_ascii_strncasecmp (pop->name, "TOGGLE", 6)) { childcount++; menu_toggle_item (pop->name + 7, tempmenu, toggle_cb, pop->cmd, cfg_get_bool (pop->cmd)); - } else if (!strncasecmp (pop->name, "ENDSUB", 6)) + } else if (!g_ascii_strncasecmp (pop->name, "ENDSUB", 6)) { /* empty sub menu due to no programs in PATH? */ if (check_path && childcount < 1) @@ -506,7 +506,7 @@ menu_create (GtkWidget *menu, GSList *list, char *target, int check_path) tempmenu = menu_quick_endsub (); /* If we get here and tempmenu equals menu that means we havent got any submenus to exit from */ - } else if (!strncasecmp (pop->name, "SEP", 3)) + } else if (!g_ascii_strncasecmp (pop->name, "SEP", 3)) { menu_quick_item (0, 0, tempmenu, XCMENU_SHADED, 0, 0); @@ -2190,7 +2190,7 @@ menu_create_main (void *accel_group, int bar, int away, int toplevel, g_object_get (settings, "gtk-key-theme-name", &key_theme, NULL); if (key_theme) { - if (!strcasecmp (key_theme, "Emacs")) + if (!g_ascii_strcasecmp (key_theme, "Emacs")) { close_mask = GDK_SHIFT_MASK | GDK_CONTROL_MASK; mymenu[SEARCH_OFFSET].key = 0; diff --git a/src/fe-gtk/notifygui.c b/src/fe-gtk/notifygui.c index 5acb683a..135a548d 100644 --- a/src/fe-gtk/notifygui.c +++ b/src/fe-gtk/notifygui.c @@ -321,7 +321,7 @@ notifygui_add_cb (GtkDialog *dialog, gint response, gpointer entry) if (text[0] && response == GTK_RESPONSE_ACCEPT) { networks = GTK_ENTRY (g_object_get_data (G_OBJECT (entry), "net"))->text; - if (strcasecmp (networks, "ALL") == 0 || networks[0] == 0) + if (g_ascii_strcasecmp (networks, "ALL") == 0 || networks[0] == 0) notify_adduser (text, NULL); else notify_adduser (text, networks); diff --git a/src/fe-gtk/plugingui.c b/src/fe-gtk/plugingui.c index 71d2f02e..7d2dc85d 100644 --- a/src/fe-gtk/plugingui.c +++ b/src/fe-gtk/plugingui.c @@ -176,12 +176,12 @@ plugingui_unload (GtkWidget * wid, gpointer unused) len = strlen (file); #ifdef WIN32 - if (len > 4 && strcasecmp (file + len - 4, ".dll") == 0) + if (len > 4 && g_ascii_strcasecmp (file + len - 4, ".dll") == 0) #else #if defined(__hpux) - if (len > 3 && strcasecmp (file + len - 3, ".sl") == 0) + if (len > 3 && g_ascii_strcasecmp (file + len - 3, ".sl") == 0) #else - if (len > 3 && strcasecmp (file + len - 3, ".so") == 0) + if (len > 3 && g_ascii_strcasecmp (file + len - 3, ".so") == 0) #endif #endif { diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c index 9483f04b..d6f4ad63 100644 --- a/src/fe-gtk/sexy-spell-entry.c +++ b/src/fe-gtk/sexy-spell-entry.c @@ -976,7 +976,7 @@ sexy_spell_entry_activate_default_languages(SexySpellEntry *entry) enchant_langs = sexy_spell_entry_get_languages(entry); /*for (i = 0; langs[i]; i++) { - if ((g_strncasecmp(langs[i], "C", 1) != 0) && + if ((g_ascii_strncasecmp(langs[i], "C", 1) != 0) && (strlen(langs[i]) >= 2) && enchant_has_lang(langs[i], enchant_langs)) { if ((lastprefix == NULL) || (g_str_has_prefix(langs[i], lastprefix) == FALSE)) @@ -1013,7 +1013,7 @@ sexy_spell_entry_activate_default_languages(SexySpellEntry *entry) lang = (gchar *) g_getenv("LANG"); if (lang != NULL) { - if (g_strncasecmp(lang, "C", 1) == 0) + if (g_ascii_strncasecmp(lang, "C", 1) == 0) lang = NULL; else if (lang[0] == '\0') lang = NULL; diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index 6e314f68..547affee 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -198,7 +198,7 @@ nocasestrstr (const char *s, const char *tofind) if (len == 0) return (char *)s; - while (toupper(*s) != toupper(*tofind) || strncasecmp (s, tofind, len)) + while (toupper(*s) != toupper(*tofind) || g_ascii_strncasecmp (s, tofind, len)) if (*s++ == '\0') return (char *)NULL; return (char *)s; -- cgit 1.4.1