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/fe-gtk/setup.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'src/fe-gtk/setup.c') diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 517e0944..bfa49946 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -109,19 +109,32 @@ static const setting textbox_settings[] = N_("Give each person on IRC a different color"),0,0}, {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_TOGGLR, N_("Show marker line"), P_OFFINTNL(show_marker), + /* {ST_TOGGLE, N_("Transparent background"), P_OFFINTNL(transparent),0,0,0}, */ + {ST_TOGGLE, 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_HEADER, N_("Transparency Settings"), 0,0,0}, {ST_HSCALE, N_("Red:"), P_OFFINTNL(tint_red),0,0,0}, {ST_HSCALE, N_("Green:"), P_OFFINTNL(tint_green),0,0,0}, - {ST_HSCALE, N_("Blue:"), P_OFFINTNL(tint_blue),0,0,0}, + {ST_HSCALE, N_("Blue:"), P_OFFINTNL(tint_blue),0,0,0}, */ {ST_HEADER, N_("Time Stamps"),0,0,0}, {ST_TOGGLE, N_("Enable time stamps"), P_OFFINTNL(timestamp),0,0,2}, {ST_ENTRY, N_("Time stamp format:"), P_OFFSETNL(stamp_format), N_("See strftime manpage for details."),0,sizeof prefs.stamp_format}, + {ST_HEADER, N_("Auto-Copy Behavior"),0,0,0}, + {ST_TOGGLE, N_("Automatically copy selected text"), P_OFFINTNL(autocopy_text), + N_("Copy selected text to clipboard when left mouse button is released. " + "Otherwise, CONTROL-SHIFT-C will copy the " + "selected text to the clipboard."), 0, 0}, + {ST_TOGGLE, N_("Automatically include time stamps"), P_OFFINTNL(autocopy_stamp), + N_("Automatically include time stamps in copied lines of text. Otherwise, " + "include time stamps if the SHIFT key is held down while selecting."), 0, 0}, + {ST_TOGGLE, N_("Automatically include color information"), P_OFFINTNL(autocopy_color), + N_("Automatically include color information in copied lines of text. " + "Otherwise, include color information if the CONTROL key is held down " + "while selecting."), 0, 0}, + {ST_END, 0, 0, 0, 0, 0} }; @@ -348,6 +361,24 @@ static const setting alert_settings[] = {ST_END, 0, 0, 0, 0, 0} }; +static const setting alert_settings_xtray[] = +{ + {ST_HEADER, N_("Alerts"),0,0,0}, + + {ST_ALERTHEAD}, + {ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0}, + {ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0}, + + {ST_HEADER, N_("Highlighted Messages"),0,0,0}, + {ST_LABEL, N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1}, + + {ST_ENTRY, N_("Extra words to highlight:"), P_OFFSETNL(irc_extra_hilight), 0, 0, sizeof prefs.irc_extra_hilight}, + {ST_ENTRY, N_("Nick names not to highlight:"), P_OFFSETNL(irc_no_hilight), 0, 0, sizeof prefs.irc_no_hilight}, + {ST_ENTRY, N_("Nick names to always highlight:"), P_OFFSETNL(irc_nick_hilight), 0, 0, sizeof prefs.irc_nick_hilight}, + {ST_LABEL, N_("Separate multiple words with commas.\nWildcards are accepted.")}, + {ST_END, 0, 0, 0, 0, 0} +}; + static const setting general_settings[] = { {ST_HEADER, N_("Default Messages"),0,0,0}, @@ -363,7 +394,6 @@ static const setting general_settings[] = {ST_END, 0, 0, 0, 0, 0} }; -#if 0 static const setting advanced_settings[] = { {ST_HEADER, N_("Advanced Settings"),0,0,0}, @@ -378,7 +408,6 @@ static const setting advanced_settings[] = {ST_END, 0, 0, 0, 0, 0} }; -#endif static const setting logging_settings[] = { @@ -1711,7 +1740,7 @@ static const char *const cata[] = N_("General"), N_("Logging"), N_("Sound"), -/* N_("Advanced"),*/ + N_("Advanced"), NULL, N_("Network"), N_("Network setup"), @@ -1732,10 +1761,19 @@ setup_create_pages (GtkWidget *box) setup_add_page (cata[3], book, setup_create_page (userlist_settings)); setup_add_page (cata[4], book, setup_create_page (tabs_settings)); setup_add_page (cata[5], book, setup_create_color_page ()); - setup_add_page (cata[8], book, setup_create_page (alert_settings)); + + if (xtray_mode ()) + { + setup_add_page (cata[8], book, setup_create_page (alert_settings_xtray)); + } else + { + setup_add_page (cata[8], book, setup_create_page (alert_settings)); + } + setup_add_page (cata[9], book, setup_create_page (general_settings)); setup_add_page (cata[10], book, setup_create_page (logging_settings)); setup_add_page (cata[11], book, setup_create_sound_page ()); + setup_add_page (cata[12], book, setup_create_page (advanced_settings)); setup_add_page (cata[14], book, setup_create_page (network_settings)); setup_add_page (cata[15], book, setup_create_page (filexfer_settings)); -- cgit 1.4.1 From 5ea4855bc32844474df3f542800fcd801d1037fb Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Sun, 5 Jun 2011 04:41:33 +0200 Subject: gui support for license text --- src/fe-gtk/setup.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/fe-gtk/setup.c') diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index bfa49946..eef6761d 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -401,6 +401,7 @@ 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}, + {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}, {ST_TOGGLE, N_("Receive window"), P_OFFINTNL(autoopendccrecvwindow), 0, 0, 0}, -- cgit 1.4.1 From 87b68a17adb0d254d56c995fbaff7a5a94175297 Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Sun, 5 Jun 2011 06:12:31 +0200 Subject: add option for changing spell checker color --- src/fe-gtk/palette.c | 3 ++- src/fe-gtk/palette.h | 1 + src/fe-gtk/setup.c | 1 + src/fe-gtk/sexy-spell-entry.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 44 insertions(+), 3 deletions(-) (limited to 'src/fe-gtk/setup.c') diff --git a/src/fe-gtk/palette.c b/src/fe-gtk/palette.c index 8d2ee062..b94ac874 100644 --- a/src/fe-gtk/palette.c +++ b/src/fe-gtk/palette.c @@ -77,8 +77,9 @@ GdkColor colors[] = { {0, 0x0000, 0x0000, 0xffff}, /* 38 tab Nick Mentioned (blue) */ {0, 0xffff, 0x0000, 0x0000}, /* 39 tab New Message (red) */ {0, 0x9595, 0x9595, 0x9595}, /* 40 away user (grey) */ + {0, 0xffff, 0x0000, 0x0000}, /* 41 spell checker color (red) */ }; -#define MAX_COL 40 +#define MAX_COL 41 void diff --git a/src/fe-gtk/palette.h b/src/fe-gtk/palette.h index c97693bb..627c6963 100644 --- a/src/fe-gtk/palette.h +++ b/src/fe-gtk/palette.h @@ -9,6 +9,7 @@ extern GdkColor colors[]; #define COL_HILIGHT 38 #define COL_NEW_MSG 39 #define COL_AWAY 40 +#define COL_SPELL 41 void palette_alloc (GtkWidget * widget); void palette_load (void); diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index eef6761d..250accc5 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -1358,6 +1358,7 @@ setup_create_color_page (void) setup_create_other_color (_("New message:"), COL_NEW_MSG, 10, tab); setup_create_other_colorR (_("Away user:"), COL_AWAY, 10, tab); setup_create_other_color (_("Highlight:"), COL_HILIGHT, 11, tab); + setup_create_other_colorR (_("Spell checker:"), COL_SPELL, 11, tab); return box; } diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c index d2c6a8a8..6bc4f0b5 100644 --- a/src/fe-gtk/sexy-spell-entry.c +++ b/src/fe-gtk/sexy-spell-entry.c @@ -26,13 +26,17 @@ #include #include "sexy-spell-entry.h" #include +#include #include #include +#include /*#include "gtkspell-iso-codes.h" #include "sexy-marshal.h"*/ #include "typedef.h" +#include "../common/cfgfiles.h" + /* * Bunch of poop to make enchant into a runtime dependency rather than a * compile-time dependency. This makes it so I don't have to hear the @@ -260,8 +264,42 @@ gtk_entry_find_position (GtkEntry *entry, gint x) static void insert_underline(SexySpellEntry *entry, guint start, guint end) { - PangoAttribute *ucolor = pango_attr_underline_color_new (65535, 0, 0); - PangoAttribute *unline = pango_attr_underline_new (PANGO_UNDERLINE_ERROR); + int fh, l; + int red, green, blue; + struct stat st; + char *cfg; + PangoAttribute *ucolor; + PangoAttribute *unline; + + fh = xchat_open_file ("colors.conf", O_RDONLY, 0, 0); + + if (fh != -1) + { + fstat (fh, &st); + cfg = malloc (st.st_size + 1); + + if (cfg) + { + cfg[0] = '\0'; + l = read (fh, cfg, st.st_size); + if (l >= 0) + { + cfg[l] = '\0'; + } + + cfg_get_color (cfg, "color_265", &red, &green, &blue); + free (cfg); + } + + close (fh); + } else + { + red = 65535; + green = blue = 0; + } + + ucolor = pango_attr_underline_color_new (red, green, blue); + unline = pango_attr_underline_new (PANGO_UNDERLINE_ERROR); ucolor->start_index = start; unline->start_index = start; -- cgit 1.4.1 From 69aedf51cea645e1dfcbc6f629f8d1461e6e6349 Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Sun, 7 Aug 2011 18:26:31 +0200 Subject: recognize all installed dictionaries and select the required ones via spell_langs --- src/common/cfgfiles.c | 2 ++ src/common/xchat.h | 1 + src/fe-gtk/setup.c | 2 ++ src/fe-gtk/sexy-spell-entry.c | 24 +++++++++++++++++------- 4 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src/fe-gtk/setup.c') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 23151b1e..e3029df8 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -568,6 +568,7 @@ const struct prefs vars[] = { {"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}, + {"text_spell_langs", P_OFFSET (spell_langs), TYPE_STR}, {"text_stripcolor", P_OFFINT (stripcolor), TYPE_BOOL}, {"text_thin_sep", P_OFFINT (thin_separator), TYPE_BOOL}, {"text_tint_blue", P_OFFINT (tint_blue), TYPE_INT}, @@ -698,6 +699,7 @@ load_config (void) prefs.identd = 1; #endif strcpy (prefs.gui_license, ""); + strcpy (prefs.spell_langs, g_getenv ("LC_ALL") ? g_getenv ("LC_ALL") : "en_US"); strcpy (prefs.stamp_format, "[%H:%M] "); strcpy (prefs.timestamp_log_format, "%b %d %H:%M:%S "); strcpy (prefs.logmask, "%n-%c.log"); diff --git a/src/common/xchat.h b/src/common/xchat.h index 718e0e91..6856d949 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -122,6 +122,7 @@ struct xchatprefs char font_normal[FONTNAMELEN + 1]; char doubleclickuser[256]; char gui_license[64]; + char spell_langs[64]; char sounddir[PATHLEN + 1]; char soundcmd[PATHLEN + 1]; char background[PATHLEN + 1]; diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 250accc5..17a1b1a5 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -151,6 +151,8 @@ static const setting inputbox_settings[] = {ST_TOGGLE, N_("Use the Text box font and colors"), P_OFFINTNL(style_inputbox),0,0,0}, #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}, + {ST_LABEL, N_("Use language codes (as in \"share\\locale\"). Separate multiple entries with commas.\nUsing too many dictionaries may cause performance problems.")}, #endif {ST_HEADER, N_("Nick Completion"),0,0,0}, diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c index 4977a567..8f21e977 100644 --- a/src/fe-gtk/sexy-spell-entry.c +++ b/src/fe-gtk/sexy-spell-entry.c @@ -36,6 +36,7 @@ #include "typedef.h" #include "../common/cfgfiles.h" +#include "../common/xchatc.h" /* * Bunch of poop to make enchant into a runtime dependency rather than a @@ -944,10 +945,10 @@ void sexy_spell_entry_activate_default_languages(SexySpellEntry *entry) { #if GLIB_CHECK_VERSION (2, 6, 0) - const gchar* const *langs; + /*const gchar* const *langs; int i; - gchar *lastprefix = NULL; - GSList *enchant_langs; + gchar *lastprefix = NULL;*/ + GSList *enchant_langs, *i; if (!have_enchant) return; @@ -956,14 +957,14 @@ sexy_spell_entry_activate_default_languages(SexySpellEntry *entry) entry->priv->broker = enchant_broker_init(); - langs = g_get_language_names (); + /*langs = g_get_language_names (); if (langs == NULL) - return; + return;*/ enchant_langs = sexy_spell_entry_get_languages(entry); - for (i = 0; langs[i]; i++) { + /*for (i = 0; langs[i]; i++) { if ((g_strncasecmp(langs[i], "C", 1) != 0) && (strlen(langs[i]) >= 2) && enchant_has_lang(langs[i], enchant_langs)) { @@ -975,10 +976,19 @@ sexy_spell_entry_activate_default_languages(SexySpellEntry *entry) } } if (lastprefix != NULL) - g_free(lastprefix); + g_free(lastprefix);*/ + + for (i = enchant_langs; i; i = g_slist_next (i)) + { + if (strstr (prefs.spell_langs, i->data) != NULL) + { + sexy_spell_entry_activate_language_internal (entry, i->data, NULL); + } + } g_slist_foreach(enchant_langs, (GFunc) g_free, NULL); g_slist_free(enchant_langs); + g_slist_free (i); /* If we don't have any languages activated, use "en" */ if (entry->priv->dict_list == NULL) -- cgit 1.4.1 From c000073225cafe8f2ed6d30ff4b9ba5351dfbb6b Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Sun, 7 Aug 2011 19:37:41 +0200 Subject: last minute typofix --- src/fe-gtk/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fe-gtk/setup.c') diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 17a1b1a5..e07c2c7e 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -152,7 +152,7 @@ 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}, - {ST_LABEL, N_("Use language codes (as in \"share\\locale\"). Separate multiple entries with commas.\nUsing too many dictionaries may cause performance problems.")}, + {ST_LABEL, N_("Use language codes (as in \"share\\myspell\\dicts\").\nSeparate multiple entries with commas.")}, #endif {ST_HEADER, N_("Nick Completion"),0,0,0}, -- cgit 1.4.1 From 1e74680172e4ff43fb109557bea87d090d8376c2 Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Tue, 9 Aug 2011 01:57:42 +0200 Subject: add option to auto-open a new tab when sending /msg (openSUSE) --- src/common/cfgfiles.c | 1 + src/common/outbound.c | 6 ++++++ src/common/xchat.h | 1 + src/fe-gtk/setup.c | 1 + 4 files changed, 9 insertions(+) (limited to 'src/fe-gtk/setup.c') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index e3029df8..7948fe2c 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -423,6 +423,7 @@ const struct prefs vars[] = { {"gui_auto_open_chat", P_OFFINT (autoopendccchatwindow), TYPE_BOOL}, {"gui_auto_open_dialog", P_OFFINT (autodialog), TYPE_BOOL}, + {"gui_auto_open_msg", P_OFFINT (gui_auto_open_msg), TYPE_BOOL}, {"gui_auto_open_recv", P_OFFINT (autoopendccrecvwindow), TYPE_BOOL}, {"gui_auto_open_send", P_OFFINT (autoopendccsendwindow), TYPE_BOOL}, {"gui_dialog_height", P_OFFINT (dialog_height), TYPE_INT}, diff --git a/src/common/outbound.c b/src/common/outbound.c index df8eddbd..417ac323 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -2605,7 +2605,13 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[]) } newsess = find_dialog (sess->server, nick); if (!newsess) + { newsess = find_channel (sess->server, nick); + if (!newsess && prefs.gui_auto_open_msg) + { + newsess = new_ircwindow (sess->server, nick, SESS_DIALOG, 0); + } + } if (newsess) inbound_chanmsg (newsess->server, NULL, newsess->channel, newsess->server->nick, msg, TRUE, FALSE); diff --git a/src/common/xchat.h b/src/common/xchat.h index 6856d949..3ec13e6b 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -205,6 +205,7 @@ struct xchatprefs unsigned int perc_ascii; unsigned int autosave; unsigned int autodialog; + unsigned int gui_auto_open_msg; unsigned int autosave_url; unsigned int autoreconnect; unsigned int autoreconnectonfail; diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index e07c2c7e..acb4eda6 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -265,6 +265,7 @@ static const setting tabs_settings[] = {ST_TOGGLE, N_("Open an extra tab for server messages"), P_OFFINTNL(use_server_tab), 0, 0, 0}, {ST_TOGGLE, N_("Open an extra tab for server notices"), P_OFFINTNL(notices_tabs), 0, 0, 0}, {ST_TOGGLE, N_("Open a new tab when you receive a private message"), P_OFFINTNL(autodialog), 0, 0, 0}, + {ST_TOGGLE, N_("Open a new tab when you send a private message"), P_OFFINTNL(gui_auto_open_msg), 0, 0, 0}, {ST_TOGGLE, N_("Sort tabs in alphabetical order"), P_OFFINTNL(tab_sort), 0, 0, 0}, {ST_TOGGLE, N_("Smaller text"), P_OFFINTNL(tab_small), 0, 0, 0}, #if 0 -- cgit 1.4.1 From 24e2da5c7943b347aa8c75e26c814f4421e34881 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 29 Oct 2011 13:25:33 +0200 Subject: re-enable transparent backgrounds --- src/common/cfgfiles.c | 2 +- src/fe-gtk/setup.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/fe-gtk/setup.c') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 7948fe2c..c3dcb347 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -575,7 +575,7 @@ const struct prefs vars[] = { {"text_tint_blue", P_OFFINT (tint_blue), TYPE_INT}, {"text_tint_green", P_OFFINT (tint_green), TYPE_INT}, {"text_tint_red", P_OFFINT (tint_red), TYPE_INT}, - /* {"text_transparent", P_OFFINT (transparent), TYPE_BOOL}, */ + {"text_transparent", P_OFFINT (transparent), TYPE_BOOL}, {"text_wordwrap", P_OFFINT (wordwrap), TYPE_BOOL}, {0, 0, 0}, diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index acb4eda6..a1a200a5 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -109,13 +109,13 @@ static const setting textbox_settings[] = N_("Give each person on IRC a different color"),0,0}, {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_("Transparent background"), P_OFFINTNL(transparent),0,0,0}, {ST_TOGGLE, 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_HEADER, N_("Transparency Settings"), 0,0,0}, {ST_HSCALE, N_("Red:"), P_OFFINTNL(tint_red),0,0,0}, {ST_HSCALE, N_("Green:"), P_OFFINTNL(tint_green),0,0,0}, - {ST_HSCALE, N_("Blue:"), P_OFFINTNL(tint_blue),0,0,0}, */ + {ST_HSCALE, N_("Blue:"), P_OFFINTNL(tint_blue),0,0,0}, {ST_HEADER, N_("Time Stamps"),0,0,0}, {ST_TOGGLE, N_("Enable time stamps"), P_OFFINTNL(timestamp),0,0,2}, -- cgit 1.4.1 From f45abe6fadf11e9f307d78b572377adc3b0d384e Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Wed, 23 Nov 2011 11:58:39 +0100 Subject: Revert "add option to auto-open a new tab when sending /msg (openSUSE)", /query msg is already there for that This reverts commit 1e74680172e4ff43fb109557bea87d090d8376c2. --- src/common/cfgfiles.c | 1 - src/common/outbound.c | 6 ------ src/common/xchat.h | 1 - src/fe-gtk/setup.c | 1 - 4 files changed, 9 deletions(-) (limited to 'src/fe-gtk/setup.c') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index c3dcb347..2aad854a 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -423,7 +423,6 @@ const struct prefs vars[] = { {"gui_auto_open_chat", P_OFFINT (autoopendccchatwindow), TYPE_BOOL}, {"gui_auto_open_dialog", P_OFFINT (autodialog), TYPE_BOOL}, - {"gui_auto_open_msg", P_OFFINT (gui_auto_open_msg), TYPE_BOOL}, {"gui_auto_open_recv", P_OFFINT (autoopendccrecvwindow), TYPE_BOOL}, {"gui_auto_open_send", P_OFFINT (autoopendccsendwindow), TYPE_BOOL}, {"gui_dialog_height", P_OFFINT (dialog_height), TYPE_INT}, diff --git a/src/common/outbound.c b/src/common/outbound.c index 8ae1bb55..55ea003f 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -2605,13 +2605,7 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[]) } newsess = find_dialog (sess->server, nick); if (!newsess) - { newsess = find_channel (sess->server, nick); - if (!newsess && prefs.gui_auto_open_msg) - { - newsess = new_ircwindow (sess->server, nick, SESS_DIALOG, 0); - } - } if (newsess) inbound_chanmsg (newsess->server, NULL, newsess->channel, newsess->server->nick, msg, TRUE, FALSE); diff --git a/src/common/xchat.h b/src/common/xchat.h index 3ec13e6b..6856d949 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -205,7 +205,6 @@ struct xchatprefs unsigned int perc_ascii; unsigned int autosave; unsigned int autodialog; - unsigned int gui_auto_open_msg; unsigned int autosave_url; unsigned int autoreconnect; unsigned int autoreconnectonfail; diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index a1a200a5..66e8349e 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -265,7 +265,6 @@ static const setting tabs_settings[] = {ST_TOGGLE, N_("Open an extra tab for server messages"), P_OFFINTNL(use_server_tab), 0, 0, 0}, {ST_TOGGLE, N_("Open an extra tab for server notices"), P_OFFINTNL(notices_tabs), 0, 0, 0}, {ST_TOGGLE, N_("Open a new tab when you receive a private message"), P_OFFINTNL(autodialog), 0, 0, 0}, - {ST_TOGGLE, N_("Open a new tab when you send a private message"), P_OFFINTNL(gui_auto_open_msg), 0, 0, 0}, {ST_TOGGLE, N_("Sort tabs in alphabetical order"), P_OFFINTNL(tab_sort), 0, 0, 0}, {ST_TOGGLE, N_("Smaller text"), P_OFFINTNL(tab_small), 0, 0, 0}, #if 0 -- cgit 1.4.1 From fb1a986332a7ff6db6f2a70df447c5d484af7cdc Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 25 Nov 2011 09:59:39 +0100 Subject: option to allow only one instance xchat to run --- src/common/cfgfiles.c | 1 + src/common/xchat.c | 30 ++++++++++++++++++++++++++++-- src/common/xchat.h | 1 + src/fe-gtk/setup.c | 1 + 4 files changed, 31 insertions(+), 2 deletions(-) (limited to 'src/fe-gtk/setup.c') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 53e0865c..e5d0eaef 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -436,6 +436,7 @@ 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}, + {"gui_one_instance", P_OFFINT (gui_one_instance), TYPE_BOOL}, {"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}, diff --git a/src/common/xchat.c b/src/common/xchat.c index ba2f5d41..8dca6de8 100644 --- a/src/common/xchat.c +++ b/src/common/xchat.c @@ -26,7 +26,9 @@ #define WANTSOCKET #include "inet.h" -#ifndef WIN32 +#ifdef WIN32 +#include +#else #include #include #endif @@ -903,7 +905,11 @@ int main (int argc, char *argv[]) { int ret; - + +#ifdef WIN32 + HANDLE mutex; +#endif + srand (time (0)); /* CL: do this only once! */ #ifdef SOCKS @@ -920,6 +926,21 @@ main (int argc, char *argv[]) load_config (); +#ifdef WIN32 + if (prefs.gui_one_instance) + { + DWORD error; + + mutex = CreateMutex (NULL, TRUE, "Local\xchat"); + error = GetLastError (); + + if (error == ERROR_ALREADY_EXISTS || mutex == NULL) + { + return 1; + } + } +#endif + #ifdef USE_LIBPROXY libproxy_factory = px_proxy_factory_new(); #endif @@ -945,6 +966,11 @@ main (int argc, char *argv[]) #ifdef WIN32 WSACleanup (); + + if (prefs.gui_one_instance) + { + CloseHandle (mutex); + } #endif return 0; diff --git a/src/common/xchat.h b/src/common/xchat.h index 6856d949..08177e20 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -186,6 +186,7 @@ struct xchatprefs int gui_usermenu; int gui_join_dialog; int gui_quit_dialog; + int gui_one_instance; int dialog_left; int dialog_top; int dialog_width; diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 66e8349e..8fbed277 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -403,6 +403,7 @@ 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}, + {ST_TOGGLE, N_("Allow only one instance of XChat to run"), P_OFFINTNL(gui_one_instance), 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 0c3c36fdf3663bc428254254a790c1bc7e3500fc Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 25 Nov 2011 10:10:11 +0100 Subject: disable one instance option in portable mode --- src/common/xchat.c | 5 +++-- src/fe-gtk/setup.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) (limited to 'src/fe-gtk/setup.c') diff --git a/src/common/xchat.c b/src/common/xchat.c index 8dca6de8..c0847a32 100644 --- a/src/common/xchat.c +++ b/src/common/xchat.c @@ -49,6 +49,7 @@ #include "text.h" #include "url.h" #include "xchatc.h" +#include "wdkutil.h" #ifdef USE_OPENSSL #include /* SSL_() */ @@ -927,7 +928,7 @@ main (int argc, char *argv[]) load_config (); #ifdef WIN32 - if (prefs.gui_one_instance) + if (prefs.gui_one_instance && !portable_mode ()) { DWORD error; @@ -967,7 +968,7 @@ main (int argc, char *argv[]) #ifdef WIN32 WSACleanup (); - if (prefs.gui_one_instance) + if (prefs.gui_one_instance && !portable_mode ()) { CloseHandle (mutex); } diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 8fbed277..5b242508 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -14,6 +14,7 @@ #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" @@ -397,6 +398,22 @@ static const setting general_settings[] = }; static const setting advanced_settings[] = +{ + {ST_HEADER, N_("Advanced Settings"),0,0,0}, + {ST_NUMBER, N_("Auto reconnect delay:"), P_OFFINTNL(recon_delay), 0, 0, 9999}, + {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}, + {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}, + {ST_TOGGLE, N_("Receive window"), P_OFFINTNL(autoopendccrecvwindow), 0, 0, 0}, + {ST_TOGGLE, N_("Chat window"), P_OFFINTNL(autoopendccchatwindow), 0, 0, 0}, + + {ST_END, 0, 0, 0, 0, 0} +}; + +static const setting advanced_settings_oneinstance[] = { {ST_HEADER, N_("Advanced Settings"),0,0,0}, {ST_NUMBER, N_("Auto reconnect delay:"), P_OFFINTNL(recon_delay), 0, 0, 9999}, @@ -1770,7 +1787,8 @@ setup_create_pages (GtkWidget *box) if (xtray_mode ()) { setup_add_page (cata[8], book, setup_create_page (alert_settings_xtray)); - } else + } + else { setup_add_page (cata[8], book, setup_create_page (alert_settings)); } @@ -1778,7 +1796,16 @@ setup_create_pages (GtkWidget *box) setup_add_page (cata[9], book, setup_create_page (general_settings)); setup_add_page (cata[10], book, setup_create_page (logging_settings)); setup_add_page (cata[11], book, setup_create_sound_page ()); - setup_add_page (cata[12], book, setup_create_page (advanced_settings)); + + if (portable_mode ()) + { + setup_add_page (cata[12], book, setup_create_page (advanced_settings)); + } + else + { + setup_add_page (cata[12], book, setup_create_page (advanced_settings_oneinstance)); + } + setup_add_page (cata[14], book, setup_create_page (network_settings)); setup_add_page (cata[15], book, setup_create_page (filexfer_settings)); -- 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/fe-gtk/setup.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 13ee029364b37eca95c43641420e75c872b32653 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sun, 11 Dec 2011 18:04:35 +0100 Subject: some more multiplatform support --- plugins/lua/lua.c | 2 +- plugins/lua/makefile.mak | 2 +- plugins/perl/makefile-512.mak | 2 +- plugins/perl/makefile-514.mak | 2 +- plugins/perl/perl.c | 2 +- plugins/python/makefile.mak | 2 +- plugins/python/python.c | 2 +- src/common/dirent-win32.c | 199 ++++++++++++++++++++++++++++++++++++++++++ src/common/dirent-win32.h | 28 ++++++ src/common/dirent.c | 199 ------------------------------------------ src/common/dirent.h | 28 ------ src/common/makefile.mak | 10 +-- src/common/plugin.c | 4 + src/common/util.c | 2 +- src/fe-gtk/about.c | 2 +- src/fe-gtk/fe-gtk.h | 7 -- src/fe-gtk/setup.c | 2 + 17 files changed, 247 insertions(+), 248 deletions(-) create mode 100644 src/common/dirent-win32.c create mode 100644 src/common/dirent-win32.h delete mode 100644 src/common/dirent.c delete mode 100644 src/common/dirent.h (limited to 'src/fe-gtk/setup.c') diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c index 9574fd4d..9f29bf08 100644 --- a/plugins/lua/lua.c +++ b/plugins/lua/lua.c @@ -43,12 +43,12 @@ #include #include #include -#include "../../src/common/dirent.h" #include #include #ifdef _WIN32 #include /* for getcwd */ +#include "../../src/common/dirent-win32.h" #endif #if !( defined(_WIN32) || defined(LXC_XCHAT_GETTEXT) ) diff --git a/plugins/lua/makefile.mak b/plugins/lua/makefile.mak index fbc94072..97a7e10b 100644 --- a/plugins/lua/makefile.mak +++ b/plugins/lua/makefile.mak @@ -1,6 +1,6 @@ include "..\..\src\makeinc.mak" -DIRENTLIB = ..\..\src\common\dirent.lib +DIRENTLIB = ..\..\src\common\dirent-win32.lib all: lua.obj lua.def link $(LDFLAGS) $(LIBS) /dll /out:xclua.dll $(LUALIB).lib $(DIRENTLIB) /def:lua.def lua.obj diff --git a/plugins/perl/makefile-512.mak b/plugins/perl/makefile-512.mak index 677c9073..7f2fbe04 100644 --- a/plugins/perl/makefile-512.mak +++ b/plugins/perl/makefile-512.mak @@ -1,6 +1,6 @@ include "..\..\src\makeinc.mak" -DIRENTLIB = ..\..\src\common\dirent.lib +DIRENTLIB = ..\..\src\common\dirent-win32.lib TARGET = $(PERL512OUTPUT) all: $(TARGET) diff --git a/plugins/perl/makefile-514.mak b/plugins/perl/makefile-514.mak index c31a7ec4..4c8d0ebd 100644 --- a/plugins/perl/makefile-514.mak +++ b/plugins/perl/makefile-514.mak @@ -1,6 +1,6 @@ include "..\..\src\makeinc.mak" -DIRENTLIB = ..\..\src\common\dirent.lib +DIRENTLIB = ..\..\src\common\dirent-win32.lib TARGET = $(PERL514OUTPUT) all: $(TARGET) diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index a2763771..719ef292 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -28,7 +28,7 @@ #ifdef WIN32 #include #define _INC_DIRENT /* disable inclusion of perl's dirent.h, we use an own version for win32 */ -#include "../../src/common/dirent.h" +#include "../../src/common/dirent-win32.h" #else #include #endif diff --git a/plugins/python/makefile.mak b/plugins/python/makefile.mak index 8cbba3f5..bc004577 100644 --- a/plugins/python/makefile.mak +++ b/plugins/python/makefile.mak @@ -1,6 +1,6 @@ include "..\..\src\makeinc.mak" -DIRENTLIB = ..\..\src\common\dirent.lib +DIRENTLIB = ..\..\src\common\dirent-win32.lib TARGET = $(PYTHONOUTPUT) all: $(TARGET) diff --git a/plugins/python/python.c b/plugins/python/python.c index 3c535057..dcf4fc8f 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -57,7 +57,7 @@ #include #ifdef WIN32 -#include "../../src/common/dirent.h" +#include "../../src/common/dirent-win32.h" #include "../../config.h" #else #include diff --git a/src/common/dirent-win32.c b/src/common/dirent-win32.c new file mode 100644 index 00000000..273c6732 --- /dev/null +++ b/src/common/dirent-win32.c @@ -0,0 +1,199 @@ +/***************************************************************************** + * dirent.h - dirent API for Microsoft Visual Studio + * + * Copyright (C) 2006 Toni Ronkko + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * ``Software''), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Dec 15, 2009, John Cunningham + * Added rewinddir member function + * + * Jan 18, 2008, Toni Ronkko + * Using FindFirstFileA and WIN32_FIND_DATAA to avoid converting string + * between multi-byte and unicode representations. This makes the + * code simpler and also allows the code to be compiled under MingW. Thanks + * to Azriel Fasten for the suggestion. + * + * Mar 4, 2007, Toni Ronkko + * Bug fix: due to the strncpy_s() function this file only compiled in + * Visual Studio 2005. Using the new string functions only when the + * compiler version allows. + * + * Nov 2, 2006, Toni Ronkko + * Major update: removed support for Watcom C, MS-DOS and Turbo C to + * simplify the file, updated the code to compile cleanly on Visual + * Studio 2005 with both unicode and multi-byte character strings, + * removed rewinddir() as it had a bug. + * + * Aug 20, 2006, Toni Ronkko + * Removed all remarks about MSVC 1.0, which is antiqued now. Simplified + * comments by removing SGML tags. + * + * May 14 2002, Toni Ronkko + * Embedded the function definitions directly to the header so that no + * source modules need to be included in the Visual Studio project. Removed + * all the dependencies to other projects so that this very header can be + * used independently. + * + * May 28 1998, Toni Ronkko + * First version. + *****************************************************************************/ + +#include "dirent-win32.h" + +/* Use the new safe string functions introduced in Visual Studio 2005 */ +#if defined(_MSC_VER) && _MSC_VER >= 1400 +# define STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE) +#else +# define STRNCPY(dest,src,size) strncpy((dest),(src),(size)) +#endif + + +/***************************************************************************** + * Open directory stream DIRNAME for read and return a pointer to the + * internal working area that is used to retrieve individual directory + * entries. + */ +DIR *opendir(const char *dirname) +{ + DIR *dirp; + assert (dirname != NULL); + assert (strlen (dirname) < MAX_PATH); + + /* construct new DIR structure */ + dirp = (DIR*) malloc (sizeof (struct DIR)); + if (dirp != NULL) { + char *p; + + /* take directory name... */ + STRNCPY (dirp->patt, dirname, sizeof(dirp->patt)); + dirp->patt[MAX_PATH] = '\0'; + + /* ... and append search pattern to it */ + p = strchr (dirp->patt, '\0'); + if (dirp->patt < p && *(p-1) != '\\' && *(p-1) != ':') { + *p++ = '\\'; + } + *p++ = '*'; + *p = '\0'; + + /* open stream and retrieve first file */ + dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data); + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* invalid search pattern? */ + free (dirp); + return NULL; + } + + /* there is an un-processed directory entry in memory now */ + dirp->cached = 1; + } + + return dirp; +} + + +/***************************************************************************** + * Read a directory entry, and return a pointer to a dirent structure + * containing the name of the entry in d_name field. Individual directory + * entries returned by this very function include regular files, + * sub-directories, pseudo-directories "." and "..", but also volume labels, + * hidden files and system files may be returned. + */ +struct dirent *readdir(DIR *dirp) +{ + assert (dirp != NULL); + + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* directory stream was opened/rewound incorrectly or ended normally */ + return NULL; + } + + /* get next directory entry */ + if (dirp->cached != 0) { + /* a valid directory entry already in memory */ + dirp->cached = 0; + } else { + /* read next directory entry from disk */ + if (FindNextFileA (dirp->search_handle, &dirp->current.data) == FALSE) { + /* the very last file has been processed or an error occured */ + FindClose (dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + return NULL; + } + } + + /* copy as a multibyte character string */ + STRNCPY ( dirp->current.d_name, + dirp->current.data.cFileName, + sizeof(dirp->current.d_name) ); + dirp->current.d_name[MAX_PATH] = '\0'; + + return &dirp->current; +} + + +/***************************************************************************** + * Close directory stream opened by opendir() function. Close of the + * directory stream invalidates the DIR structure as well as any previously + * read directory entry. + */ +int closedir(DIR *dirp) +{ + assert (dirp != NULL); + + /* release search handle */ + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + FindClose (dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + } + + /* release directory handle */ + free (dirp); + return 0; +} + + +/***************************************************************************** + * Resets the position of the directory stream to which dirp refers to the + * beginning of the directory. It also causes the directory stream to refer + * to the current state of the corresponding directory, as a call to opendir() + * would have done. If dirp does not refer to a directory stream, the effect + * is undefined. + */ +void rewinddir(DIR* dirp) +{ + /* release search handle */ + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + FindClose (dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + } + + /* open new search handle and retrieve first file */ + dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data); + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* invalid search pattern? */ + free (dirp); + return; + } + + /* there is an un-processed directory entry in memory now */ + dirp->cached = 1; +} diff --git a/src/common/dirent-win32.h b/src/common/dirent-win32.h new file mode 100644 index 00000000..cbb753e6 --- /dev/null +++ b/src/common/dirent-win32.h @@ -0,0 +1,28 @@ +#ifndef DIRENT_H +#define DIRENT_H + +#include +#include +#include + +typedef struct dirent +{ + char d_name[MAX_PATH + 1]; /* current dir entry (multi-byte char string) */ + WIN32_FIND_DATAA data; /* file attributes */ +} dirent; + +typedef struct DIR +{ + dirent current; /* Current directory entry */ + int cached; /* Indicates un-processed entry in memory */ + HANDLE search_handle; /* File search handle */ + char patt[MAX_PATH + 3]; /* search pattern (3 = pattern + "\\*\0") */ +} DIR; + +/* Forward declarations */ +DIR *opendir (const char *dirname); +struct dirent *readdir (DIR *dirp); +int closedir (DIR *dirp); +void rewinddir(DIR* dirp); + +#endif /*DIRENT_H*/ diff --git a/src/common/dirent.c b/src/common/dirent.c deleted file mode 100644 index a84f1b65..00000000 --- a/src/common/dirent.c +++ /dev/null @@ -1,199 +0,0 @@ -/***************************************************************************** - * dirent.h - dirent API for Microsoft Visual Studio - * - * Copyright (C) 2006 Toni Ronkko - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * ``Software''), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Dec 15, 2009, John Cunningham - * Added rewinddir member function - * - * Jan 18, 2008, Toni Ronkko - * Using FindFirstFileA and WIN32_FIND_DATAA to avoid converting string - * between multi-byte and unicode representations. This makes the - * code simpler and also allows the code to be compiled under MingW. Thanks - * to Azriel Fasten for the suggestion. - * - * Mar 4, 2007, Toni Ronkko - * Bug fix: due to the strncpy_s() function this file only compiled in - * Visual Studio 2005. Using the new string functions only when the - * compiler version allows. - * - * Nov 2, 2006, Toni Ronkko - * Major update: removed support for Watcom C, MS-DOS and Turbo C to - * simplify the file, updated the code to compile cleanly on Visual - * Studio 2005 with both unicode and multi-byte character strings, - * removed rewinddir() as it had a bug. - * - * Aug 20, 2006, Toni Ronkko - * Removed all remarks about MSVC 1.0, which is antiqued now. Simplified - * comments by removing SGML tags. - * - * May 14 2002, Toni Ronkko - * Embedded the function definitions directly to the header so that no - * source modules need to be included in the Visual Studio project. Removed - * all the dependencies to other projects so that this very header can be - * used independently. - * - * May 28 1998, Toni Ronkko - * First version. - *****************************************************************************/ - -#include "dirent.h" - -/* Use the new safe string functions introduced in Visual Studio 2005 */ -#if defined(_MSC_VER) && _MSC_VER >= 1400 -# define STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE) -#else -# define STRNCPY(dest,src,size) strncpy((dest),(src),(size)) -#endif - - -/***************************************************************************** - * Open directory stream DIRNAME for read and return a pointer to the - * internal working area that is used to retrieve individual directory - * entries. - */ -DIR *opendir(const char *dirname) -{ - DIR *dirp; - assert (dirname != NULL); - assert (strlen (dirname) < MAX_PATH); - - /* construct new DIR structure */ - dirp = (DIR*) malloc (sizeof (struct DIR)); - if (dirp != NULL) { - char *p; - - /* take directory name... */ - STRNCPY (dirp->patt, dirname, sizeof(dirp->patt)); - dirp->patt[MAX_PATH] = '\0'; - - /* ... and append search pattern to it */ - p = strchr (dirp->patt, '\0'); - if (dirp->patt < p && *(p-1) != '\\' && *(p-1) != ':') { - *p++ = '\\'; - } - *p++ = '*'; - *p = '\0'; - - /* open stream and retrieve first file */ - dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data); - if (dirp->search_handle == INVALID_HANDLE_VALUE) { - /* invalid search pattern? */ - free (dirp); - return NULL; - } - - /* there is an un-processed directory entry in memory now */ - dirp->cached = 1; - } - - return dirp; -} - - -/***************************************************************************** - * Read a directory entry, and return a pointer to a dirent structure - * containing the name of the entry in d_name field. Individual directory - * entries returned by this very function include regular files, - * sub-directories, pseudo-directories "." and "..", but also volume labels, - * hidden files and system files may be returned. - */ -struct dirent *readdir(DIR *dirp) -{ - assert (dirp != NULL); - - if (dirp->search_handle == INVALID_HANDLE_VALUE) { - /* directory stream was opened/rewound incorrectly or ended normally */ - return NULL; - } - - /* get next directory entry */ - if (dirp->cached != 0) { - /* a valid directory entry already in memory */ - dirp->cached = 0; - } else { - /* read next directory entry from disk */ - if (FindNextFileA (dirp->search_handle, &dirp->current.data) == FALSE) { - /* the very last file has been processed or an error occured */ - FindClose (dirp->search_handle); - dirp->search_handle = INVALID_HANDLE_VALUE; - return NULL; - } - } - - /* copy as a multibyte character string */ - STRNCPY ( dirp->current.d_name, - dirp->current.data.cFileName, - sizeof(dirp->current.d_name) ); - dirp->current.d_name[MAX_PATH] = '\0'; - - return &dirp->current; -} - - -/***************************************************************************** - * Close directory stream opened by opendir() function. Close of the - * directory stream invalidates the DIR structure as well as any previously - * read directory entry. - */ -int closedir(DIR *dirp) -{ - assert (dirp != NULL); - - /* release search handle */ - if (dirp->search_handle != INVALID_HANDLE_VALUE) { - FindClose (dirp->search_handle); - dirp->search_handle = INVALID_HANDLE_VALUE; - } - - /* release directory handle */ - free (dirp); - return 0; -} - - -/***************************************************************************** - * Resets the position of the directory stream to which dirp refers to the - * beginning of the directory. It also causes the directory stream to refer - * to the current state of the corresponding directory, as a call to opendir() - * would have done. If dirp does not refer to a directory stream, the effect - * is undefined. - */ -void rewinddir(DIR* dirp) -{ - /* release search handle */ - if (dirp->search_handle != INVALID_HANDLE_VALUE) { - FindClose (dirp->search_handle); - dirp->search_handle = INVALID_HANDLE_VALUE; - } - - /* open new search handle and retrieve first file */ - dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data); - if (dirp->search_handle == INVALID_HANDLE_VALUE) { - /* invalid search pattern? */ - free (dirp); - return; - } - - /* there is an un-processed directory entry in memory now */ - dirp->cached = 1; -} diff --git a/src/common/dirent.h b/src/common/dirent.h deleted file mode 100644 index cbb753e6..00000000 --- a/src/common/dirent.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef DIRENT_H -#define DIRENT_H - -#include -#include -#include - -typedef struct dirent -{ - char d_name[MAX_PATH + 1]; /* current dir entry (multi-byte char string) */ - WIN32_FIND_DATAA data; /* file attributes */ -} dirent; - -typedef struct DIR -{ - dirent current; /* Current directory entry */ - int cached; /* Indicates un-processed entry in memory */ - HANDLE search_handle; /* File search handle */ - char patt[MAX_PATH + 3]; /* search pattern (3 = pattern + "\\*\0") */ -} DIR; - -/* Forward declarations */ -DIR *opendir (const char *dirname); -struct dirent *readdir (DIR *dirp); -int closedir (DIR *dirp); -void rewinddir(DIR* dirp); - -#endif /*DIRENT_H*/ diff --git a/src/common/makefile.mak b/src/common/makefile.mak index 8b350efc..f78a6d8d 100644 --- a/src/common/makefile.mak +++ b/src/common/makefile.mak @@ -5,7 +5,7 @@ cfgfiles.obj \ chanopt.obj \ ctcp.obj \ dcc.obj \ -dirent.obj \ +dirent-win32.obj \ history.obj \ ignore.obj \ inbound.obj \ @@ -27,13 +27,13 @@ userlist.obj \ util.obj \ xchat.obj -all: $(COMMON_OBJECTS) xchatcommon.lib dirent.lib +all: $(COMMON_OBJECTS) xchatcommon.lib dirent-win32.lib xchatcommon.lib: $(COMMON_OBJECTS) lib /nologo /out:xchatcommon.lib $(COMMON_OBJECTS) -dirent.lib: dirent.obj - lib /nologo /out:dirent.lib dirent.obj +dirent-win32.lib: dirent-win32.obj + lib /nologo /out:dirent-win32.lib dirent-win32.obj .c.obj:: $(CC) $(CFLAGS) $(GLIB) $< @@ -41,4 +41,4 @@ dirent.lib: dirent.obj clean: @del *.obj @del xchatcommon.lib - @del dirent.lib + @del dirent-win32.lib diff --git a/src/common/plugin.c b/src/common/plugin.c index ccb64e93..5ed20b87 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -1008,7 +1008,11 @@ xchat_get_info (xchat_plugin *ph, const char *id) return XCHATLIBDIR; case 0x14f51cd8: /* version */ +#ifdef WIN32 return XCHAT_RELEASE; +#else + return PACKAGE_VERSION; +#endif case 0xdd9b1abd: /* xchatdir */ return get_xdir_utf8 (); diff --git a/src/common/util.c b/src/common/util.c index ccc48657..51222e40 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -32,7 +32,7 @@ #include #include #include -#include "dirent.h" +#include "dirent-win32.h" #else #include #include diff --git a/src/fe-gtk/about.c b/src/fe-gtk/about.c index 41f3c09b..dc1cbf08 100644 --- a/src/fe-gtk/about.c +++ b/src/fe-gtk/about.c @@ -139,7 +139,7 @@ menu_about (GtkWidget * wid, gpointer sess) (portable_mode () ? "Yes" : "No"), get_cpu_arch () #else - "%s\n\n" + "\n%s\n\n" "%s\n" "Charset: %s " "Renderer: %s\n" diff --git a/src/fe-gtk/fe-gtk.h b/src/fe-gtk/fe-gtk.h index 4183f559..8fffb3cc 100644 --- a/src/fe-gtk/fe-gtk.h +++ b/src/fe-gtk/fe-gtk.h @@ -1,13 +1,6 @@ #include "../../config.h" -#ifdef WIN32 -/* If you're compiling this for Windows, your release is un-official - * and not condoned. Please don't use the XChat name. Make up your - * own name! */ #define DISPLAY_NAME "XChat-WDK" -#else -#define DISPLAY_NAME "XChat" -#endif #ifndef WIN32 #include diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 1f1be0b4..cce85d30 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -1383,7 +1383,9 @@ setup_create_color_page (void) setup_create_other_color (_("New message:"), COL_NEW_MSG, 10, tab); setup_create_other_colorR (_("Away user:"), COL_AWAY, 10, tab); setup_create_other_color (_("Highlight:"), COL_HILIGHT, 11, tab); +#if defined(USE_GTKSPELL) || defined(USE_LIBSEXY) setup_create_other_colorR (_("Spell checker:"), COL_SPELL, 11, tab); +#endif return box; } -- 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/fe-gtk/setup.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/fe-gtk/setup.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 7aecdd300972acbe86c7a01b5f1ed80a7a26123a Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Mon, 30 Jan 2012 14:37:07 +0100 Subject: avoid confusion about strftime --- src/fe-gtk/setup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/fe-gtk/setup.c') diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index cce85d30..497d012d 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -120,7 +120,11 @@ static const setting textbox_settings[] = {ST_HEADER, N_("Time Stamps"),0,0,0}, {ST_TOGGLE, N_("Enable time stamps"), P_OFFINTNL(timestamp),0,0,2}, {ST_ENTRY, N_("Time stamp format:"), P_OFFSETNL(stamp_format), - N_("See strftime manpage for details."),0,sizeof prefs.stamp_format}, +#ifdef WIN32 + N_("See the strftime MSDN article for details."),0,sizeof prefs.stamp_format}, +#else + N_("See the strftime manpage for details."),0,sizeof prefs.stamp_format}, +#endif {ST_HEADER, N_("Auto-Copy Behavior"),0,0,0}, {ST_TOGGLE, N_("Automatically copy selected text"), P_OFFINTNL(autocopy_text), -- cgit 1.4.1 From 77ca8de9b3fd241e3191441a5cbde69fad2bf375 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Wed, 15 Feb 2012 22:56:52 +0100 Subject: provide a GUI field for alternative fonts, pango.aliases replacement --- src/common/cfgfiles.c | 11 +++++++++++ src/common/xchat.h | 6 ++++++ src/fe-gtk/setup.c | 23 +++++++++++++++++++++++ 3 files changed, 40 insertions(+) (limited to 'src/fe-gtk/setup.c') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 130ad9d9..da4adbd3 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -36,6 +36,9 @@ #endif #define DEF_FONT "Monospace 9" +#ifdef WIN32 +#define DEF_FONT_ALTER "Arial Unicode MS,Lucida Sans Unicode" +#endif void list_addentry (GSList ** list, char *cmd, char *name) @@ -578,6 +581,10 @@ const struct prefs vars[] = { {"text_emoticons", P_OFFINT (emoticons), TYPE_BOOL}, #endif {"text_font", P_OFFSET (font_normal), TYPE_STR}, +#ifdef WIN32 + {"text_font_main", P_OFFSET (font_main), TYPE_STR}, + {"text_font_alternative", P_OFFSET (font_alternative), TYPE_STR}, +#endif {"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}, @@ -749,6 +756,10 @@ load_config (void) strcpy (prefs.quitreason, _("Leaving")); strcpy (prefs.partreason, prefs.quitreason); strcpy (prefs.font_normal, DEF_FONT); +#ifdef WIN32 + strcpy (prefs.font_main, DEF_FONT); + strcpy (prefs.font_alternative, DEF_FONT_ALTER); +#endif strcpy (prefs.dnsprogram, "host"); strcpy (prefs.irc_no_hilight, "NickServ,ChanServ"); diff --git a/src/common/xchat.h b/src/common/xchat.h index 6815cc39..dbffb900 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -115,7 +115,13 @@ struct xchatprefs char awayreason[256]; char quitreason[256]; char partreason[256]; +#ifdef WIN32 + char font_normal[4 * FONTNAMELEN + 1]; + char font_main[FONTNAMELEN + 1]; + char font_alternative[3 * FONTNAMELEN + 1]; +#else char font_normal[FONTNAMELEN + 1]; +#endif char doubleclickuser[256]; char gui_license[64]; char spell_langs[64]; diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 497d012d..243ebfbf 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -102,7 +102,12 @@ typedef struct static const setting textbox_settings[] = { {ST_HEADER, N_("Text Box Appearance"),0,0,0}, +#ifdef WIN32 + {ST_EFONT, N_("Main font:"), P_OFFSETNL(font_main), 0, 0, sizeof prefs.font_main}, + {ST_ENTRY, N_("Alternative fonts:"), P_OFFSETNL(font_alternative), "Separate multiple entries with commas without spaces before or after.", 0, sizeof prefs.font_alternative}, +#else {ST_EFONT, N_("Font:"), P_OFFSETNL(font_normal), 0, 0, sizeof prefs.font_normal}, +#endif {ST_EFILE, N_("Background image:"), P_OFFSETNL(background), 0, 0, sizeof prefs.background}, {ST_NUMBER, N_("Scrollback lines:"), P_OFFINTNL(max_lines),0,0,100000}, {ST_TOGGLE, N_("Colored nick names"), P_OFFINTNL(colorednicks), @@ -2056,6 +2061,11 @@ setup_apply_real (int new_pix, int do_ulist, int do_layout) static void setup_apply (struct xchatprefs *pr) { +#ifdef WIN32 + PangoFontDescription *old_desc; + PangoFontDescription *new_desc; + char buffer[4 * FONTNAMELEN + 1]; +#endif int new_pix = FALSE; int noapply = FALSE; int do_ulist = FALSE; @@ -2099,6 +2109,19 @@ setup_apply (struct xchatprefs *pr) memcpy (&prefs, pr, sizeof (prefs)); +#ifdef WIN32 /* merge font_main and font_alternative into font_normal */ + old_desc = pango_font_description_from_string (prefs.font_main); + sprintf (buffer, "%s,%s", pango_font_description_get_family (old_desc), prefs.font_alternative); + new_desc = pango_font_description_from_string (buffer); + pango_font_description_set_weight (new_desc, pango_font_description_get_weight (old_desc)); + pango_font_description_set_style (new_desc, pango_font_description_get_style (old_desc)); + pango_font_description_set_size (new_desc, pango_font_description_get_size (old_desc)); + sprintf (prefs.font_normal, "%s", pango_font_description_to_string (new_desc)); + + g_free (old_desc); + g_free (new_desc); +#endif + setup_apply_real (new_pix, do_ulist, do_layout); if (noapply) -- cgit 1.4.1 From fc3d4d31f01a639972faf5fd5f85fc6602f53c1b Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Thu, 16 Feb 2012 00:43:12 +0100 Subject: avoid unnecessary g_free() calls --- src/fe-gtk/setup.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/fe-gtk/setup.c') diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 243ebfbf..63cc0d30 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -2118,8 +2118,10 @@ setup_apply (struct xchatprefs *pr) pango_font_description_set_size (new_desc, pango_font_description_get_size (old_desc)); sprintf (prefs.font_normal, "%s", pango_font_description_to_string (new_desc)); + /* FIXME this is not required after pango_font_description_from_string() g_free (old_desc); g_free (new_desc); + */ #endif setup_apply_real (new_pix, do_ulist, do_layout); -- cgit 1.4.1 From 0ac0510be0270cde636bbd8c590ef9fbda9d90ef Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Thu, 16 Feb 2012 17:21:15 +0100 Subject: fix for time stamp format crashes --- src/common/text.c | 7 +++++++ src/fe-gtk/setup.c | 17 +++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src/fe-gtk/setup.c') diff --git a/src/common/text.c b/src/common/text.c index 93392d1a..f8afc4b3 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -686,6 +686,13 @@ get_stamp_str (char *fmt, time_t tim, char **ret) } len = strftime (dest, sizeof (dest), fmt, localtime (&tim)); +#ifdef WIN32 + if (!len) + { + /* use failsafe format until a correct one is specified */ + len = strftime (dest, sizeof (dest), "[%H:%M]", localtime (&tim)); + } +#endif if (len) { if (prefs.utf8_locale) diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 63cc0d30..f6acd5d6 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -455,7 +455,11 @@ static const setting logging_settings[] = {ST_HEADER, N_("Time Stamps"),0,0,0}, {ST_TOGGLE, N_("Insert timestamps in logs"), P_OFFINTNL(timestamp_logs), 0, 0, 2}, {ST_ENTRY, N_("Log timestamp format:"), P_OFFSETNL(timestamp_log_format), 0, 0, sizeof prefs.timestamp_log_format}, - {ST_LABEL, N_("See strftime manpage for details.")}, +#ifdef WIN32 + {ST_LABEL, N_("See the strftime MSDN article for details.")}, +#else + {ST_LABEL, N_("See the strftime manpage for details.")}, +#endif {ST_END, 0, 0, 0, 0, 0} }; @@ -2065,6 +2069,7 @@ setup_apply (struct xchatprefs *pr) PangoFontDescription *old_desc; PangoFontDescription *new_desc; char buffer[4 * FONTNAMELEN + 1]; + time_t rawtime; #endif int new_pix = FALSE; int noapply = FALSE; @@ -2109,7 +2114,8 @@ setup_apply (struct xchatprefs *pr) memcpy (&prefs, pr, sizeof (prefs)); -#ifdef WIN32 /* merge font_main and font_alternative into font_normal */ +#ifdef WIN32 + /* merge font_main and font_alternative into font_normal */ old_desc = pango_font_description_from_string (prefs.font_main); sprintf (buffer, "%s,%s", pango_font_description_get_family (old_desc), prefs.font_alternative); new_desc = pango_font_description_from_string (buffer); @@ -2122,6 +2128,13 @@ setup_apply (struct xchatprefs *pr) g_free (old_desc); g_free (new_desc); */ + + /* workaround for strftime differences between POSIX and MSVC */ + time (&rawtime); + if(!strftime (buffer, sizeof (buffer), prefs.stamp_format, localtime (&rawtime)) || !strftime (buffer, sizeof (buffer), prefs.timestamp_log_format, localtime (&rawtime))) + { + fe_message (_("Invalid time stamp format! See the strftime MSDN article for details."), FE_MSG_ERROR); + } #endif setup_apply_real (new_pix, do_ulist, do_layout); -- cgit 1.4.1 From a27d2e4d0bb1d0926473b95d0a2c1d58955a7edc Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Thu, 16 Feb 2012 17:23:08 +0100 Subject: cosmetics --- src/fe-gtk/setup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/fe-gtk/setup.c') diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index f6acd5d6..cec06b25 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -2131,7 +2131,8 @@ setup_apply (struct xchatprefs *pr) /* workaround for strftime differences between POSIX and MSVC */ time (&rawtime); - if(!strftime (buffer, sizeof (buffer), prefs.stamp_format, localtime (&rawtime)) || !strftime (buffer, sizeof (buffer), prefs.timestamp_log_format, localtime (&rawtime))) + + if (!strftime (buffer, sizeof (buffer), prefs.stamp_format, localtime (&rawtime)) || !strftime (buffer, sizeof (buffer), prefs.timestamp_log_format, localtime (&rawtime))) { fe_message (_("Invalid time stamp format! See the strftime MSDN article for details."), FE_MSG_ERROR); } -- cgit 1.4.1