initial patches for linux compatibility

This commit is contained in:
Berke Viktor 2011-12-11 17:34:02 +01:00
parent 2012320d0e
commit 132ef6cb50
44 changed files with 304 additions and 59 deletions

View File

@ -27,7 +27,7 @@
#endif #endif
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#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" #include "../../src/common/dirent.h"
#else #else
#include <dirent.h> #include <dirent.h>

4
plugins/perl/perl.def Normal file
View File

@ -0,0 +1,4 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
xchat_plugin_get_info

View File

@ -55,8 +55,14 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32
#include "../../src/common/dirent.h" #include "../../src/common/dirent.h"
#include "../../config.h" #include "../../config.h"
#else
#include <unistd.h>
#include <dirent.h>
#endif
#include "xchat-plugin.h" #include "xchat-plugin.h"
#include "Python.h" #include "Python.h"

View File

@ -32,6 +32,8 @@ static char RCSID[] = "$Id: tclplugin.c,v 1.64 2010/03/10 04:24:16 mooooooo Exp
#include <windows.h> #include <windows.h>
#define bzero(mem, sz) memset((mem), 0, (sz)) #define bzero(mem, sz) memset((mem), 0, (sz))
#define bcopy(src, dest, count) memmove((dest), (src), (count)) #define bcopy(src, dest, count) memmove((dest), (src), (count))
#else
#include <unistd.h>
#endif #endif
#include "xchat-plugin.h" #include "xchat-plugin.h"

View File

@ -5,6 +5,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "xchat-plugin.h" #include "xchat-plugin.h"
#include "../../src/common/xchat.h" #include "../../src/common/xchat.h"

View File

@ -29,11 +29,12 @@
#include "fe.h" #include "fe.h"
#include "text.h" #include "text.h"
#include "xchatc.h" #include "xchatc.h"
#include "wdkutil.h"
#ifndef WIN32 #ifndef WIN32
#include <unistd.h>
#define XCHAT_DIR ".xchat2" #define XCHAT_DIR ".xchat2"
#endif #endif
#define DEF_FONT "Monospace 9" #define DEF_FONT "Monospace 9"
void void
@ -402,7 +403,9 @@ const struct prefs vars[] = {
{"dcc_blocksize", P_OFFINT (dcc_blocksize), TYPE_INT}, {"dcc_blocksize", P_OFFINT (dcc_blocksize), TYPE_INT},
{"dcc_completed_dir", P_OFFSET (dcc_completed_dir), TYPE_STR}, {"dcc_completed_dir", P_OFFSET (dcc_completed_dir), TYPE_STR},
{"dcc_dir", P_OFFSET (dccdir), 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_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_global_max_send_cps", P_OFFINT (dcc_global_max_send_cps), TYPE_INT},
{"dcc_ip", P_OFFSET (dcc_ip_str), TYPE_STR}, {"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_lagometer", P_OFFINT (lagometer), TYPE_INT},
{"gui_license", P_OFFSET (gui_license), TYPE_STR}, {"gui_license", P_OFFSET (gui_license), TYPE_STR},
{"gui_mode_buttons", P_OFFINT (chanmodebuttons), TYPE_BOOL}, {"gui_mode_buttons", P_OFFINT (chanmodebuttons), TYPE_BOOL},
#ifdef WIN32
{"gui_one_instance", P_OFFINT (gui_one_instance), TYPE_BOOL}, {"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_left_size", P_OFFINT (gui_pane_left_size), TYPE_INT},
{"gui_pane_right_size", P_OFFINT (gui_pane_right_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}, {"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_chans", P_OFFINT (tabchannels), TYPE_BOOL},
{"tab_dialogs", P_OFFINT (privmsgtab), TYPE_BOOL}, {"tab_dialogs", P_OFFINT (privmsgtab), TYPE_BOOL},
#ifdef WIN32
{"tab_icons", P_OFFINT (tab_icons), TYPE_BOOL}, {"tab_icons", P_OFFINT (tab_icons), TYPE_BOOL},
#endif
{"tab_layout", P_OFFINT (tab_layout), TYPE_INT}, {"tab_layout", P_OFFINT (tab_layout), TYPE_INT},
{"tab_new_to_front", P_OFFINT (newtabstofront), TYPE_INT}, {"tab_new_to_front", P_OFFINT (newtabstofront), TYPE_INT},
{"tab_notices", P_OFFINT (notices_tabs), TYPE_BOOL}, {"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_sort", P_OFFINT (tab_sort), TYPE_BOOL},
{"tab_trunc", P_OFFINT (truncchans), TYPE_INT}, {"tab_trunc", P_OFFINT (truncchans), TYPE_INT},
{"tab_utils", P_OFFINT (windows_as_tabs), TYPE_BOOL}, {"tab_utils", P_OFFINT (windows_as_tabs), TYPE_BOOL},
#ifdef WIN32
{"tab_xp", P_OFFINT (tab_xp), TYPE_BOOL}, {"tab_xp", P_OFFINT (tab_xp), TYPE_BOOL},
#endif
{"text_auto_copy_color", P_OFFINT (autocopy_color), TYPE_BOOL}, {"text_auto_copy_color", P_OFFINT (autocopy_color), TYPE_BOOL},
{"text_auto_copy_stamp", P_OFFINT (autocopy_stamp), TYPE_BOOL}, {"text_auto_copy_stamp", P_OFFINT (autocopy_stamp), TYPE_BOOL},
{"text_auto_copy_text", P_OFFINT (autocopy_text), TYPE_BOOL}, {"text_auto_copy_text", P_OFFINT (autocopy_text), TYPE_BOOL},
{"text_background", P_OFFSET (background), TYPE_STR}, {"text_background", P_OFFSET (background), TYPE_STR},
{"text_color_nicks", P_OFFINT (colorednicks), TYPE_BOOL}, {"text_color_nicks", P_OFFINT (colorednicks), TYPE_BOOL},
#ifdef WIN32
{"text_emoticons", P_OFFINT (emoticons), TYPE_BOOL}, {"text_emoticons", P_OFFINT (emoticons), TYPE_BOOL},
#endif
{"text_font", P_OFFSET (font_normal), TYPE_STR}, {"text_font", P_OFFSET (font_normal), TYPE_STR},
{"text_indent", P_OFFINT (indent_nicks), TYPE_BOOL}, {"text_indent", P_OFFINT (indent_nicks), TYPE_BOOL},
{"text_max_indent", P_OFFINT (max_auto_indent), TYPE_INT}, {"text_max_indent", P_OFFINT (max_auto_indent), TYPE_INT},
@ -642,7 +653,9 @@ load_config (void)
prefs.indent_nicks = 1; prefs.indent_nicks = 1;
prefs.thin_separator = 1; prefs.thin_separator = 1;
prefs._tabs_position = 2; /* 2 = left */ prefs._tabs_position = 2; /* 2 = left */
/* prefs.fastdccsend = 1; */ #ifndef WIN32
prefs.fastdccsend = 1;
#endif
prefs.wordwrap = 1; prefs.wordwrap = 1;
prefs.autosave = 1; prefs.autosave = 1;
prefs.autodialog = 1; prefs.autodialog = 1;
@ -667,7 +680,6 @@ load_config (void)
prefs.dialog_height = 256; prefs.dialog_height = 256;
prefs.gui_join_dialog = 1; prefs.gui_join_dialog = 1;
prefs.gui_quit_dialog = 1; prefs.gui_quit_dialog = 1;
prefs.slist_skip = 1;
prefs.dcctimeout = 180; prefs.dcctimeout = 180;
prefs.dccstalltimeout = 60; prefs.dccstalltimeout = 60;
prefs.notify_timeout = 15; prefs.notify_timeout = 15;

View File

@ -8,6 +8,10 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "xchat.h" #include "xchat.h"
#include "cfgfiles.h" #include "cfgfiles.h"

View File

@ -20,6 +20,10 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "xchat.h" #include "xchat.h"
#include "cfgfiles.h" #include "cfgfiles.h"
#include "util.h" #include "util.h"
@ -133,8 +137,13 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip,
if (!strcasecmp (msg, "VERSION") && !prefs.hidever) if (!strcasecmp (msg, "VERSION") && !prefs.hidever)
{ {
#ifdef WIN32
snprintf (outbuf, sizeof (outbuf), "VERSION XChat-WDK "PACKAGE_VERSION" [x%d] / %s", snprintf (outbuf, sizeof (outbuf), "VERSION XChat-WDK "PACKAGE_VERSION" [x%d] / %s",
get_cpu_arch (), get_cpu_str ()); 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); serv->p_nctcp (serv, nick, outbuf);
} }

View File

@ -40,6 +40,8 @@
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#else
#include <unistd.h>
#endif #endif
#include "xchat.h" #include "xchat.h"
@ -56,7 +58,9 @@
#ifdef USE_DCC64 #ifdef USE_DCC64
#define BIG_STR_TO_INT(x) strtoull(x,NULL,10) #define BIG_STR_TO_INT(x) strtoull(x,NULL,10)
#ifdef WIN32
#define stat _stat64 #define stat _stat64
#endif
#else #else
#define BIG_STR_TO_INT(x) strtoul(x,NULL,10) #define BIG_STR_TO_INT(x) strtoul(x,NULL,10)
#endif #endif
@ -1983,7 +1987,9 @@ is_same_file (struct DCC *dcc, struct DCC *new_dcc)
return TRUE; return TRUE;
/* now handle case-insensitive Filesystems: HFS+, FAT */ /* 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 */ /* this fstat() shouldn't really fail */
if ((dcc->fp == -1 ? stat (dcc->destfile_fs, &st_a) : fstat (dcc->fp, &st_a)) == -1) if ((dcc->fp == -1 ? stat (dcc->destfile_fs, &st_a) : fstat (dcc->fp, &st_a)) == -1)
return FALSE; return FALSE;

View File

@ -23,6 +23,10 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "xchat.h" #include "xchat.h"
#include "ignore.h" #include "ignore.h"
#include "cfgfiles.h" #include "cfgfiles.h"

View File

@ -23,6 +23,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#ifndef WIN32
#include <unistd.h>
#endif
#define WANTARPA #define WANTARPA
#define WANTDNS #define WANTDNS
#include "inet.h" #include "inet.h"

View File

@ -25,7 +25,6 @@ tree.obj \
url.obj \ url.obj \
userlist.obj \ userlist.obj \
util.obj \ util.obj \
wdkutil.obj \
xchat.obj xchat.obj
all: $(COMMON_OBJECTS) xchatcommon.lib dirent.lib all: $(COMMON_OBJECTS) xchatcommon.lib dirent.lib

View File

@ -28,6 +28,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#ifndef WIN32
#include <unistd.h>
#endif
#define WANTSOCKET #define WANTSOCKET
#define WANTARPA #define WANTARPA
#include "inet.h" #include "inet.h"

View File

@ -23,6 +23,10 @@
#include <stdio.h> #include <stdio.h>
#include <glib.h> #include <glib.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "../../config.h" /* grab USE_IPV6 and LOOKUPD defines */ #include "../../config.h" /* grab USE_IPV6 and LOOKUPD defines */
#define WANTSOCKET #define WANTSOCKET

View File

@ -24,6 +24,10 @@
#include <fcntl.h> #include <fcntl.h>
#include <time.h> #include <time.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "xchat.h" #include "xchat.h"
#include "notify.h" #include "notify.h"
#include "cfgfiles.h" #include "cfgfiles.h"

View File

@ -30,6 +30,7 @@
#ifndef WIN32 #ifndef WIN32
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h>
#endif #endif
#include <time.h> #include <time.h>
@ -2880,6 +2881,7 @@ cmd_recv (struct session *sess, char *tbuf, char *word[], char *word_eol[])
return FALSE; return FALSE;
} }
#if 0 /* manual command for flushing prefs to disk, but we use an autosave-upon-set approach instead */
static int static int
cmd_saveconf (struct session *sess, char *tbuf, char *word[], char *word_eol[]) 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; return TRUE;
} }
#endif
static int static int
cmd_say (struct session *sess, char *tbuf, char *word[], char *word_eol[]) cmd_say (struct session *sess, char *tbuf, char *word[], char *word_eol[])
@ -3647,7 +3650,9 @@ const struct commands xc_cmds[] = {
#endif #endif
{"RECV", cmd_recv, 1, 0, 1, N_("RECV <text>, send raw data to xchat, as if it was received from the irc server")}, {"RECV", cmd_recv, 1, 0, 1, N_("RECV <text>, 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, {"SAY", cmd_say, 0, 0, 1,
N_("SAY <text>, sends the text to the object in the current window")}, N_("SAY <text>, sends the text to the object in the current window")},
{"SEND", cmd_send, 0, 0, 1, N_("SEND <nick> [<file>]")}, {"SEND", cmd_send, 0, 0, 1, N_("SEND <nick> [<file>]")},

View File

@ -1,7 +1,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <glib.h> #include <glib.h>
#include "../../plugins/xchat-plugin.h" #include "xchat-plugin.h"
#ifdef WIN32 #ifdef WIN32
#define strcasecmp stricmp #define strcasecmp stricmp

View File

@ -24,6 +24,10 @@
#include <ctype.h> #include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "xchat.h" #include "xchat.h"
#include "ctcp.h" #include "ctcp.h"
#include "fe.h" #include "fe.h"

View File

@ -36,6 +36,7 @@
#ifndef WIN32 #ifndef WIN32
#include <signal.h> #include <signal.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h>
#else #else
#include <winbase.h> #include <winbase.h>
#endif #endif
@ -1763,7 +1764,11 @@ server_connect (server *serv, char *hostname, int port, int no_login)
} }
#endif #endif
serv->childpid = pid; serv->childpid = pid;
#ifdef WIN32
serv->iotag = fe_input_add (serv->childread, FIA_READ|FIA_FD, server_read_child, 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); serv);
} }

View File

@ -22,6 +22,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "xchat.h" #include "xchat.h"
#include <glib/ghash.h> #include <glib/ghash.h>

View File

@ -25,6 +25,11 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifndef WIN32
#include <unistd.h>
#include <sys/mman.h>
#endif
#include "xchat.h" #include "xchat.h"
#include <glib/ghash.h> #include <glib/ghash.h>
#include "cfgfiles.h" #include "cfgfiles.h"
@ -270,6 +275,12 @@ scrollback_load (session *sess)
time_t stamp; time_t stamp;
int lines; int lines;
#ifndef WIN32
char *map, *end_map;
struct stat statbuf;
const char *begin, *eol;
#endif
if (sess->text_scrollback == SET_DEFAULT) if (sess->text_scrollback == SET_DEFAULT)
{ {
if (!prefs.text_replay) if (!prefs.text_replay)
@ -288,6 +299,65 @@ scrollback_load (session *sess)
if (fh == -1) if (fh == -1)
return; 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; lines = 0;
while (waitline (fh, buf, sizeof buf, FALSE) != -1) while (waitline (fh, buf, sizeof buf, FALSE) != -1)
{ {
@ -318,6 +388,7 @@ scrollback_load (session *sess)
fe_print_text (sess, buf, 0); fe_print_text (sess, buf, 0);
/*EMIT_SIGNAL (XP_TE_GENMSG, sess, "*", buf, NULL, NULL, NULL, 0);*/ /*EMIT_SIGNAL (XP_TE_GENMSG, sess, "*", buf, NULL, NULL, NULL, 0);*/
} }
#endif
close (fh); close (fh);
} }

View File

@ -27,17 +27,21 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef WIN32 #ifdef WIN32
#include <sys/timeb.h> #include <sys/timeb.h>
#include <process.h> #include <process.h>
#include <io.h>
#include "dirent.h"
#else #else
#include <sys/types.h> #include <unistd.h>
#include <pwd.h> #include <pwd.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <dirent.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>
#include "dirent.h"
#include <errno.h> #include <errno.h>
#include "xchat.h" #include "xchat.h"
#include "xchatc.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
}

View File

@ -57,5 +57,7 @@ guint32 str_hash (const char *key);
guint32 str_ihash (const unsigned char *key); guint32 str_ihash (const unsigned char *key);
void safe_strcpy (char *dest, const char *src, int bytes_left); void safe_strcpy (char *dest, const char *src, int bytes_left);
void canonalize_key (char *key); void canonalize_key (char *key);
int portable_mode ();
int xtray_mode ();
#endif #endif

View File

@ -1,27 +0,0 @@
#include <io.h>
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;
}
}

View File

@ -1,2 +0,0 @@
int portable_mode ();
int xtray_mode ();

View File

@ -31,6 +31,7 @@
#else #else
#include <sys/wait.h> #include <sys/wait.h>
#include <signal.h> #include <signal.h>
#include <unistd.h>
#endif #endif
#include "xchat.h" #include "xchat.h"
@ -39,7 +40,7 @@
#include "cfgfiles.h" #include "cfgfiles.h"
#include "chanopt.h" #include "chanopt.h"
#include "ignore.h" #include "ignore.h"
#include "../../plugins/xchat-plugin.h" #include "xchat-plugin.h"
#include "plugin.h" #include "plugin.h"
#include "plugin-timer.h" #include "plugin-timer.h"
#include "notify.h" #include "notify.h"
@ -49,7 +50,6 @@
#include "text.h" #include "text.h"
#include "url.h" #include "url.h"
#include "xchatc.h" #include "xchatc.h"
#include "wdkutil.h"
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
#include <openssl/ssl.h> /* SSL_() */ #include <openssl/ssl.h> /* SSL_() */

View File

@ -186,7 +186,9 @@ struct xchatprefs
int gui_usermenu; int gui_usermenu;
int gui_join_dialog; int gui_join_dialog;
int gui_quit_dialog; int gui_quit_dialog;
#ifdef WIN32
int gui_one_instance; int gui_one_instance;
#endif
int dialog_left; int dialog_left;
int dialog_top; int dialog_top;
int dialog_width; int dialog_width;
@ -304,10 +306,12 @@ struct xchatprefs
unsigned int wait_on_exit; unsigned int wait_on_exit;
unsigned int confmode; unsigned int confmode;
unsigned int utf8_locale; unsigned int utf8_locale;
#ifdef WIN32
unsigned int identd; unsigned int identd;
unsigned int emoticons; unsigned int emoticons;
unsigned int tab_icons; unsigned int tab_icons;
unsigned int tab_xp; unsigned int tab_xp;
#endif
unsigned int ctcp_number_limit; /*flood */ unsigned int ctcp_number_limit; /*flood */
unsigned int ctcp_time_limit; /*seconds of floods */ unsigned int ctcp_time_limit; /*seconds of floods */

View File

@ -39,7 +39,6 @@
#include "../common/xchat.h" #include "../common/xchat.h"
#include "../common/util.h" #include "../common/util.h"
#include "../common/wdkutil.h"
#include "../common/xchatc.h" #include "../common/xchatc.h"
#include "palette.h" #include "palette.h"
#include "pixmaps.h" #include "pixmaps.h"
@ -71,7 +70,7 @@ menu_about (GtkWidget * wid, gpointer sess)
"(C) 1998-2005 Peter Zelezny", author, buf, 0)); "(C) 1998-2005 Peter Zelezny", author, buf, 0));
} }
#else #endif
static GtkWidget *about = 0; static GtkWidget *about = 0;
@ -171,4 +170,3 @@ menu_about (GtkWidget * wid, gpointer sess)
gtk_widget_show_all (about); gtk_widget_show_all (about);
} }
#endif

View File

@ -22,6 +22,10 @@
#include <fcntl.h> #include <fcntl.h>
#include <time.h> #include <time.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "fe-gtk.h" #include "fe-gtk.h"
#include <gtk/gtkhbox.h> #include <gtk/gtkhbox.h>

View File

@ -22,6 +22,10 @@
#include <fcntl.h> #include <fcntl.h>
#include <time.h> #include <time.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "fe-gtk.h" #include "fe-gtk.h"
#include <gtk/gtkalignment.h> #include <gtk/gtkalignment.h>

View File

@ -22,6 +22,11 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "fe-gtk.h" #include "fe-gtk.h"
#include <gtk/gtkstock.h> #include <gtk/gtkstock.h>

View File

@ -31,7 +31,11 @@
#include <gtk/gtkmessagedialog.h> #include <gtk/gtkmessagedialog.h>
#include <gtk/gtkversion.h> #include <gtk/gtkversion.h>
#ifdef WIN32
#include <gdk/gdkwin32.h> #include <gdk/gdkwin32.h>
#else
#include <unistd.h>
#endif
#include "../common/xchat.h" #include "../common/xchat.h"
#include "../common/fe.h" #include "../common/fe.h"
@ -411,7 +415,7 @@ log_handler (const gchar *log_domain,
{ {
session *sess; session *sess;
/* if (getenv ("XCHAT_WARNING_IGNORE")) */ /* if (getenv ("XCHAT_WARNING_IGNORE")) this gets ignored sometimes, so simply just disable all warnings */
return; return;
sess = find_dialog (serv_list->data, "(warnings)"); sess = find_dialog (serv_list->data, "(warnings)");

View File

@ -24,6 +24,10 @@
#include <fcntl.h> #include <fcntl.h>
#include <ctype.h> #include <ctype.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "fe-gtk.h" #include "fe-gtk.h"
#include <gtk/gtklabel.h> #include <gtk/gtklabel.h>
@ -314,7 +318,7 @@ key_handle_key_press (GtkWidget *wid, GdkEventKey *evt, session *sess)
key_action_tab_clean (); key_action_tab_clean ();
break; break;
#if defined(USE_GTKSPELL)/* && !defined(WIN32) #if defined(USE_GTKSPELL)/* && !defined(WIN32) */
/* gtktextview has no 'activate' event, so we trap ENTER here */ /* gtktextview has no 'activate' event, so we trap ENTER here */
case GDK_Return: case GDK_Return:
case GDK_KP_Enter: case GDK_KP_Enter:

View File

@ -23,6 +23,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include "fe-gtk.h" #include "fe-gtk.h"
#include <gtk/gtkbutton.h> #include <gtk/gtkbutton.h>
@ -50,9 +51,12 @@
#include "../common/util.h" #include "../common/util.h"
#include "gtkutil.h" #include "gtkutil.h"
#include "pixmaps.h" #include "pixmaps.h"
#ifdef WIN32 #ifdef WIN32
#include "../common/fe.h" #include "../common/fe.h"
#include "../common/thread.h" #include "../common/thread.h"
#else
#include <unistd.h>
#endif #endif
/* gtkutil.c, just some gtk wrappers */ /* gtkutil.c, just some gtk wrappers */

View File

@ -12,6 +12,10 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include <gtk/gtkbbox.h> #include <gtk/gtkbbox.h>
#include <gtk/gtkbutton.h> #include <gtk/gtkbutton.h>
#include <gtk/gtkdialog.h> #include <gtk/gtkdialog.h>

View File

@ -53,7 +53,8 @@
#include "../common/plugin.h" #include "../common/plugin.h"
#include "../common/modes.h" #include "../common/modes.h"
#include "../common/url.h" #include "../common/url.h"
#include "../common/wdkutil.h" #include "../common/util.h"
#include "fe-gtk.h" #include "fe-gtk.h"
#include "banlist.h" #include "banlist.h"
#include "gtkutil.h" #include "gtkutil.h"

View File

@ -23,6 +23,8 @@
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#else
#include <unistd.h>
#endif #endif
#include "fe-gtk.h" #include "fe-gtk.h"
@ -1121,6 +1123,7 @@ usermenu_update (void)
} }
} }
#if 0
static void static void
menu_saveconf (void) menu_saveconf (void)
{ {
@ -1135,6 +1138,7 @@ menu_saveconf (void)
PrintText (sess, "Error saving settings.\n"); PrintText (sess, "Error saving settings.\n");
} }
} }
#endif
static void static void
menu_newserver_window (GtkWidget * wid, gpointer none) 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}, {N_("Userlist Popup..."), menu_ulpopup, 0, M_MENUITEM, 0, 0, 1},
{0, 0, 0, M_END, 0, 0, 0}, /* 53 */ {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_("_Window"), 0, 0, M_NEWMENU, 0, 0, 1},
{N_("Ban List..."), menu_banlist, 0, M_MENUITEM, 0, 0, 1}, {N_("Ban List..."), menu_banlist, 0, M_MENUITEM, 0, 0, 1},

View File

@ -22,6 +22,10 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "fe-gtk.h" #include "fe-gtk.h"
#include "palette.h" #include "palette.h"

View File

@ -1,20 +1,23 @@
/* Copyright (C) 2006-2007 Peter Zelezny. */ /* Copyright (C) 2006-2007 Peter Zelezny. */
#include <string.h> #include <string.h>
#include "../../plugins/xchat-plugin.h" #include "../common/xchat-plugin.h"
#include "../common/xchat.h" #include "../common/xchat.h"
#include "../common/xchatc.h" #include "../common/xchatc.h"
#include "../common/inbound.h" #include "../common/inbound.h"
#include "../common/server.h" #include "../common/server.h"
#include "../common/fe.h" #include "../common/fe.h"
#include "../common/util.h" #include "../common/util.h"
#include "../common/wdkutil.h"
#include "fe-gtk.h" #include "fe-gtk.h"
#include "pixmaps.h" #include "pixmaps.h"
#include "maingui.h" #include "maingui.h"
#include "menu.h" #include "menu.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
#ifndef WIN32
#include <unistd.h>
#endif
#ifdef USE_LIBNOTIFY #ifdef USE_LIBNOTIFY
#include <libnotify/notify.h> #include <libnotify/notify.h>
#ifndef NOTIFY_CHECK_VERSION #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, _("_Hide Window"), tray_menu_restore_cb, NULL);
tray_make_item (menu, NULL, tray_menu_quit_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")); submenu = mg_submenu (menu, _("_Blink on"));
blink_item (&prefs.input_tray_chans, submenu, _("Channel Message")); blink_item (&prefs.input_tray_chans, submenu, _("Channel Message"));
blink_item (&prefs.input_tray_priv, submenu, _("Private 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); tray_make_item (menu, NULL, tray_menu_quit_cb, NULL);
#endif #endif
mg_create_icon_item (_("_Quit"), GTK_STOCK_QUIT, menu, tray_menu_quit_cb, NULL); mg_create_icon_item (_("_Quit"), GTK_STOCK_QUIT, menu, tray_menu_quit_cb, NULL);
menu_add_plugin_items (menu, "\x5$TRAY", 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); sticon = gtk_status_icon_new_from_pixbuf (ICON_NORMAL);
if (!sticon) if (!sticon)
return; 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_signal_connect (G_OBJECT (sticon), "activate",
G_CALLBACK (tray_menu_restore_cb), NULL); G_CALLBACK (tray_menu_restore_cb), NULL);
} }

View File

@ -35,7 +35,7 @@
#include "../common/xchat.h" #include "../common/xchat.h"
#define PLUGIN_C #define PLUGIN_C
typedef struct session xchat_context; typedef struct session xchat_context;
#include "../../plugins/xchat-plugin.h" #include "../common/xchat-plugin.h"
#include "../common/plugin.h" #include "../common/plugin.h"
#include "../common/util.h" #include "../common/util.h"
#include "../common/outbound.h" #include "../common/outbound.h"
@ -146,10 +146,13 @@ plugingui_load_cb (session *sess, char *file)
void void
plugingui_load (void) plugingui_load (void)
{ {
gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, current_sess,
current_sess, #ifdef WIN32
"Plugins and Scripts\0*.dll;*.lua;*.pl;*.py;*.tcl\0" "Plugins and Scripts\0*.dll;*.lua;*.pl;*.py;*.tcl\0"
"All files\0*.*\0\0", 0); "All files\0*.*\0\0", 0);
#else
NULL, FRF_ADDFOLDER);
#endif
} }
static void static void

View File

@ -21,6 +21,10 @@
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "fe-gtk.h" #include "fe-gtk.h"
#include <gtk/gtkbutton.h> #include <gtk/gtkbutton.h>

View File

@ -14,7 +14,6 @@
#include "../common/text.h" #include "../common/text.h"
#include "../common/userlist.h" #include "../common/userlist.h"
#include "../common/util.h" #include "../common/util.h"
#include "../common/wdkutil.h"
#include "../common/xchatc.h" #include "../common/xchatc.h"
#include "fe-gtk.h" #include "fe-gtk.h"
#include "gtkutil.h" #include "gtkutil.h"
@ -111,7 +110,7 @@ static const setting textbox_settings[] =
{ST_TOGGLR, N_("Indent nick names"), P_OFFINTNL(indent_nicks), {ST_TOGGLR, N_("Indent nick names"), P_OFFINTNL(indent_nicks),
N_("Make nick names right-justified"),0,0}, 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), {ST_TOGGLR, N_("Show marker line"), P_OFFINTNL(show_marker),
N_("Insert a red line after the last read text."),0,0}, 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_("Red:"), P_OFFINTNL(tint_red),0,0,0},
@ -153,7 +152,11 @@ static const setting inputbox_settings[] =
#if defined(USE_GTKSPELL) || defined(USE_LIBSEXY) #if defined(USE_GTKSPELL) || defined(USE_LIBSEXY)
{ST_TOGGLE, N_("Spell checking"), P_OFFINTNL(gui_input_spell),0,0,0}, {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_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.")}, {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 #endif
{ST_HEADER, N_("Nick Completion"),0,0,0}, {ST_HEADER, N_("Nick Completion"),0,0,0},
@ -413,6 +416,7 @@ static const setting advanced_settings[] =
{ST_END, 0, 0, 0, 0, 0} {ST_END, 0, 0, 0, 0, 0}
}; };
#ifdef WIN32
static const setting advanced_settings_oneinstance[] = static const setting advanced_settings_oneinstance[] =
{ {
{ST_HEADER, N_("Advanced Settings"),0,0,0}, {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} {ST_END, 0, 0, 0, 0, 0}
}; };
#endif
static const setting logging_settings[] = 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[10], book, setup_create_page (logging_settings));
setup_add_page (cata[11], book, setup_create_sound_page ()); setup_add_page (cata[11], book, setup_create_sound_page ());
#ifdef WIN32
if (portable_mode ()) if (portable_mode ())
{ {
setup_add_page (cata[12], book, setup_create_page (advanced_settings)); 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)); 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[14], book, setup_create_page (network_settings));
setup_add_page (cata[15], book, setup_create_page (filexfer_settings)); setup_add_page (cata[15], book, setup_create_page (filexfer_settings));

View File

@ -33,7 +33,9 @@
#include "sexy-iso-codes.h" #include "sexy-iso-codes.h"
#include "sexy-marshal.h" #include "sexy-marshal.h"
#ifdef WIN32
#include "typedef.h" #include "typedef.h"
#endif
#include "../common/cfgfiles.h" #include "../common/cfgfiles.h"
#include "../common/xchatc.h" #include "../common/xchatc.h"
@ -141,9 +143,18 @@ initialize_enchant ()
GModule *enchant; GModule *enchant;
gpointer funcptr; gpointer funcptr;
#ifdef WIN32
enchant = g_module_open("libenchant.dll", 0); enchant = g_module_open("libenchant.dll", 0);
#else
enchant = g_module_open("libenchant", 0);
#endif
if (enchant == NULL) if (enchant == NULL)
{ {
#ifndef WIN32
enchant = g_module_open("libenchant.so.1", 0);
if (enchant == NULL)
return;
#endif
return; return;
} }

View File

@ -74,6 +74,8 @@
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#include <gdk/gdkwin32.h> #include <gdk/gdkwin32.h>
#else
#include <unistd.h>
#endif #endif
/* is delimiter */ /* is delimiter */