You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(106) |
Oct
(334) |
Nov
(246) |
Dec
(145) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(42) |
Feb
(53) |
Mar
(232) |
Apr
(109) |
May
(137) |
Jun
(63) |
Jul
(26) |
Aug
(263) |
Sep
(193) |
Oct
(507) |
Nov
(440) |
Dec
(241) |
2003 |
Jan
(567) |
Feb
(195) |
Mar
(504) |
Apr
(481) |
May
(524) |
Jun
(522) |
Jul
(594) |
Aug
(502) |
Sep
(643) |
Oct
(508) |
Nov
(430) |
Dec
(377) |
2004 |
Jan
(361) |
Feb
(251) |
Mar
(219) |
Apr
(499) |
May
(461) |
Jun
(419) |
Jul
(314) |
Aug
(519) |
Sep
(416) |
Oct
(247) |
Nov
(305) |
Dec
(382) |
2005 |
Jan
(267) |
Feb
(282) |
Mar
(327) |
Apr
(338) |
May
(189) |
Jun
(400) |
Jul
(462) |
Aug
(530) |
Sep
(316) |
Oct
(523) |
Nov
(481) |
Dec
(650) |
2006 |
Jan
(536) |
Feb
(361) |
Mar
(287) |
Apr
(146) |
May
(101) |
Jun
(169) |
Jul
(221) |
Aug
(498) |
Sep
(300) |
Oct
(236) |
Nov
(209) |
Dec
(205) |
2007 |
Jan
(30) |
Feb
(23) |
Mar
(26) |
Apr
(15) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: HS-Crawler <bo...@hs...> - 2002-10-11 09:19:23
|
HS-Crawler is a new tool to enhance your business! Stop buying email lists and pay a lot of money for them. Just build your own lists. Use search engine results to submit them to HS-Crawler and collect all email addresses on the appropriate sites! Gather addresses from newslists or email collections as easy as never before! And the best of all: your grabbed email addresses are of high quality! Because you use search engines and use the results. So you don't get "a lot" of not usable addresses, you'll get exactly the addresses you are searching for! How it works? Download your free demo of HS-Crawler and you will see! www.email-grab.hs-media.net/en To "opt-out" please click www.email-grab.hs-media.net/en/remove.htm?liste=hs-crawler |
From: Sean E. <sea...@us...> - 2002-10-11 05:40:59
|
Update of /cvsroot/gaim/gaim/src/protocols/yahoo In directory usw-pr-cvs1:/tmp/cvs-serv31413/src/protocols/yahoo Modified Files: Tag: gtk1-stable yahoo.c Log Message: Thanks Craig Index: yahoo.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/yahoo/yahoo.c,v retrieving revision 1.43.2.5 retrieving revision 1.43.2.6 diff -u -d -r1.43.2.5 -r1.43.2.6 --- yahoo.c 17 Sep 2002 15:56:28 -0000 1.43.2.5 +++ yahoo.c 11 Oct 2002 05:40:57 -0000 1.43.2.6 @@ -525,6 +525,9 @@ l = l->next; } + if (!msg) + return; + if (!g_strncasecmp(msg, "TYPING", strlen("TYPING"))) { if (*stat == '1') serv_got_typing(gc, from, 0); |
From: Sean E. <sea...@us...> - 2002-10-11 05:40:59
|
Update of /cvsroot/gaim/gaim In directory usw-pr-cvs1:/tmp/cvs-serv31413 Modified Files: Tag: gtk1-stable ChangeLog Log Message: Thanks Craig Index: ChangeLog =================================================================== RCS file: /cvsroot/gaim/gaim/ChangeLog,v retrieving revision 1.509.2.36 retrieving revision 1.509.2.37 diff -u -d -r1.509.2.36 -r1.509.2.37 --- ChangeLog 6 Oct 2002 19:25:02 -0000 1.509.2.36 +++ ChangeLog 11 Oct 2002 05:40:57 -0000 1.509.2.37 @@ -1,5 +1,8 @@ Gaim: The Pimpin' Penguin IM Clone thats good for the soul! +version 0.59.5 + * Fixed a Yahoo! segfault (Thanks, Craig Metz) + version 0.59.4 (10/06/2002): * Removed color keybinnding altogether. * Added a horizontal scrollbar to Edit page of |
From: Sean E. <sea...@us...> - 2002-10-11 05:39:40
|
Update of /cvsroot/gaim/gaim/src/protocols/yahoo In directory usw-pr-cvs1:/tmp/cvs-serv31077/src/protocols/yahoo Modified Files: yahoo.c Log Message: Bug fix by Craig Metz Index: yahoo.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/yahoo/yahoo.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- yahoo.c 11 Oct 2002 03:14:01 -0000 1.53 +++ yahoo.c 11 Oct 2002 05:39:37 -0000 1.54 @@ -536,6 +536,9 @@ game = pair->value; l = l->next; } + + if (!msg) + return; if (!g_strncasecmp(msg, "TYPING", strlen("TYPING"))) { if (*stat == '1') |
From: Rob F. <rob...@us...> - 2002-10-11 04:45:00
|
Update of /cvsroot/gaim/gaim/src/protocols/oscar In directory usw-pr-cvs1:/tmp/cvs-serv19191/src/protocols/oscar Modified Files: oscar.c Log Message: This should be a little happier Index: oscar.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/oscar.c,v retrieving revision 1.157 retrieving revision 1.158 diff -u -d -r1.157 -r1.158 --- oscar.c 11 Oct 2002 04:39:36 -0000 1.157 +++ oscar.c 11 Oct 2002 04:44:57 -0000 1.158 @@ -1591,7 +1591,7 @@ * -- wtm */ struct sigaction act; act.sa_handler = oscar_sendfile_timeout; - act.sa_flags = SA_ONESHOT; + act.sa_flags = SA_RESETHAND; sigemptyset (&act.sa_mask); sigaction(SIGALRM, &act, NULL); alarm(OFT_TIMEOUT); |
From: Rob F. <rob...@us...> - 2002-10-11 04:41:46
|
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv18416 Added Files: Makefile.mingw Log Message: Howd did I miss this? --- NEW FILE: Makefile.mingw --- # # Makefile.mingw # # Description: Makefile for win32 (mingw) version of Gaim # # # PATHS # BUILD_TOOLS = /usr/local/mingw INCLUDE_DIR := . GTK_TOP := ../../win32-dev/gtk_2_0 GAIM_TOP := .. GAIM_SRC := . PERL_LIB_DIR := ../../win32-dev/perl56 PERL_INCLUDE := $(PERL_LIB_DIR)/CORE GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir ## ## VARIABLE DEFINITIONS ## TARGET = gaim VERSION := $(shell cat $(GAIM_TOP)/VERSION) # Compiler and Linker Options GCOPTS = -B $(BUILD_TOOLS) CC = gcc.exe $(GCOPTS) CFLAGS = -g -mno-cygwin -fnative-struct DEFINES = -DHAVE_CONFIG_H -DVERSION=\"$(VERSION)\" -DGTK_ENABLE_BROKEN LDFLAGS = -mwindows #-mconsole #-mwindows ## ## INCLUDE MAKEFILES ## ## ## INCLUDE PATHS ## INCLUDE_PATHS = -I$(INCLUDE_DIR) \ -I$(INCLUDE_DIR)/win32 \ -I$(GAIM_TOP) \ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/include/pango-1.0 \ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ -I$(PERL_INCLUDE) LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(GAIM_SRC) \ -L$(PERL_LIB_DIR) ## ## SOURCES, OBJECTS ## SOUND_H_FILES = $(GAIM_TOP)/sounds/BuddyArrive.h \ $(GAIM_TOP)/sounds/BuddyLeave.h \ $(GAIM_TOP)/sounds/Receive.h \ $(GAIM_TOP)/sounds/RedAlert.h \ $(GAIM_TOP)/sounds/Send.h HEADER_DEPS = $(SOUND_H_FILES) DLL_C_SRC = aim.c \ about.c \ away.c \ browser.c \ buddy.c \ buddy_chat.c \ conversation.c \ core.c \ dialogs.c \ ft.c \ gaimrc.c \ gtkimhtml.c \ gtkspell.c \ html.c \ idle.c \ list.c \ md5.c \ module.c \ multi.c \ perl.c \ prefs.c \ proxy.c \ prpl.c \ server.c \ sound.c \ util.c \ win32/win32dep.c \ win32/MinimizeToTray.c RC_SRC = win32/gaimrc.rc EXE_C_SRC = win_aim.c DLL_OBJECTS = $(DLL_C_SRC:%.c=%.o) EXE_OBJECTS = $(EXE_C_SRC:%.c=%.o) $(RC_SRC:%.rc=%.o) ## ## LIBRARIES ## DLL_LIBS = -lgtk-win32-2.0 \ -lpango-1.0 \ -lglib-2.0 \ -lgdk-win32-2.0 \ -lgobject-2.0 \ -lintl \ -lgmodule-2.0 \ -lgdk_pixbuf-2.0 \ -lws2_32 \ -liberty \ -lwinmm \ -lperl56 EXE_LIBS = -lgaim -lglib-2.0 ## ## RULES ## # Make Sound headers $(GAIM_TOP)/sounds/%.h: $(MAKE) -C $(GAIM_TOP)/sounds -f Makefile.mingw $(@F) # How to make a C file %.o: %.c $(CC) $(CFLAGS) $(INCLUDE_PATHS) $(DEFINES) -c $< -o $@ # How to make an RC file %.o: %.rc windres -i $< -o $@ ## ## TARGET DEFINITIONS ## .PHONY: all clean all: $(TARGET).exe $(TARGET).dll install: cp $(GAIM_SRC)/gaim.exe $(GAIM_SRC)/gaim.dll $(GAIM_INSTALL_DIR) # # BUILD DLL # $(TARGET).def: $(HEADER_DEPS) $(DLL_OBJECTS) dlltool -D $(TARGET).dll -z $(TARGET).def --export-all-symbols \ --exclude-symbols WinMain@16 $^ $(TARGET).base: $(HEADER_DEPS) $(DLL_OBJECTS) gcc -mdll $(LDFLAGS) -o junk.tmp -Wl,--base-file,$@ $(DLL_OBJECTS) $(LIB_PATHS) $(DLL_LIBS) rm -rf junk.tmp $(TARGET).exp: $(TARGET).base $(TARGET).def dlltool --dllname $(TARGET).dll --base-file $(TARGET).base \ --output-exp $(TARGET).exp --def $(TARGET).def $(TARGET).dll: $(HEADER_DEPS) $(DLL_OBJECTS) $(TARGET).exp gcc -mdll $(LDFLAGS) -o $(TARGET).dll $(DLL_OBJECTS) -Wl,$(TARGET).exp $(LIB_PATHS) $(DLL_LIBS) rm -rf $(TARGET).exp $(TARGET).def $(TARGET).base $(TARGET).lib: $(TARGET).def dlltool -D $(TARGET).dll -d $(TARGET).def -l $(TARGET).lib # # BUILD EXE # $(TARGET).exe: $(TARGET).lib $(EXE_OBJECTS) gcc $(LDFLAGS) $(EXE_OBJECTS) $(LIB_PATHS) $(EXE_LIBS) -o $(TARGET).exe # -Wl,--subsystem,windows ## ## CLEAN RULES ## clean: $(MAKE) -C $(GAIM_TOP)/sounds -f Makefile.mingw clean rm -rf *.o ./win32/*.o rm -rf $(TARGET).dll rm -rf $(TARGET).lib rm -rf $(TARGET).exe |
From: Rob F. <rob...@us...> - 2002-10-11 04:39:39
|
Update of /cvsroot/gaim/gaim/src/protocols/oscar In directory usw-pr-cvs1:/tmp/cvs-serv17813 Modified Files: oscar.c Log Message: Sorry, paco Index: oscar.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/oscar.c,v retrieving revision 1.156 retrieving revision 1.157 diff -u -d -r1.156 -r1.157 --- oscar.c 11 Oct 2002 03:14:01 -0000 1.156 +++ oscar.c 11 Oct 2002 04:39:36 -0000 1.157 @@ -2214,7 +2214,7 @@ if (chan == 2) { char *cookie = va_arg(ap, char *); - va_end(va); + va_end(ap); return gaim_parse_clientauto_rend(sess, who, reason, cookie); |
From: Rob F. <rob...@us...> - 2002-10-11 04:02:00
|
Update of /cvsroot/gaim/gaim In directory usw-pr-cvs1:/tmp/cvs-serv9017 Added Files: config.h.mingw Log Message: lalal --- NEW FILE: config.h.mingw --- /* config.h. Generated automatically by configure. */ /* config.h.in. Generated automatically from configure.in by autoheader. */ /* Define if using alloca.c. */ /* #undef C_ALLOCA */ /* Define to empty if the keyword does not work. */ /* #undef const */ /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ /* #undef CRAY_STACKSEG_END */ /* Define if you have alloca, as a function or macro. */ #define HAVE_ALLOCA 1 /* Define if you have <alloca.h> and it should be used (not on Ultrix). */ /* #undef HAVE_ALLOCA_H */ /* Define if you have a working `mmap' system call. */ /* #undef HAVE_MMAP */ /* Define if you have the strftime function. */ #define HAVE_STRFTIME 1 /* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ /* #undef HAVE_SYS_WAIT_H */ /* Define if your struct tm has tm_zone. */ /* #undef HAVE_TM_ZONE */ /* Define if you don't have tm_zone but do have the external array tzname. */ /* #undef HAVE_TZNAME */ /* Define as __inline if that's what the C compiler calls it. */ /* #undef inline */ /* Define to `long' if <sys/types.h> doesn't define. */ /* #undef off_t */ /* Define as the return type of signal handlers (int or void). */ #define RETSIGTYPE void /* Define to `unsigned' if <sys/types.h> doesn't define. */ /* #undef size_t */ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if your <sys/time.h> declares struct tm. */ /* #undef TM_IN_SYS_TIME */ /* Define if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ /* #undef WORDS_BIGENDIAN */ #define ENABLE_NLS 1 /* #undef HAVE_CATGETS */ /* #undef HAVE_GETTEXT */ /* #undef HAVE_LC_MESSAGES */ /* #undef HAVE_STPCPY */ /* #undef HAVE_LIBSM */ /* #undef USE_APPLET */ /* #undef USE_GNOME */ /* #undef USE_PIXBUF */ /* #undef USE_SCREENSAVER */ /* #undef NO_MULTI */ /* #define DEBUG 1 */ #define GAIM_PLUGINS 1 #define USE_PERL 1 /* #undef NAS_SOUND */ /* #undef ESD_SOUND */ /* #undef ARTSC_SOUND */ /* #undef _REENTRANT */ /* #undef NEED_GNOMESUPPORT_H */ #define ZEPHYR_INT32 long /* #undef ZEPHYR_USES_KERBEROS */ #ifndef STATIC_PROTO_INIT #define STATIC_PROTO_INIT void static_proto_init() { } #endif #define socklen_t int /* #undef HAVE_TM_GMTOFF */ /* Define if you have the Perl_eval_pv function. */ /* #undef HAVE_PERL_EVAL_PV */ /* Define if you have the __argz_count function. */ /* #undef HAVE___ARGZ_COUNT */ /* Define if you have the __argz_next function. */ /* #undef HAVE___ARGZ_NEXT */ /* Define if you have the __argz_stringify function. */ /* #undef HAVE___ARGZ_STRINGIFY */ /* Define if you have the atexit function. */ #define HAVE_ATEXIT 1 /* Define if you have the bswap_16 function. */ /* #undef HAVE_BSWAP_16 */ /* Define if you have the bswap_32 function. */ /* #undef HAVE_BSWAP_32 */ /* Define if you have the connect function. */ /* #undef HAVE_CONNECT */ /* Define if you have the dcgettext function. */ /* #undef HAVE_DCGETTEXT */ /* Define if you have the feof_unlocked function. */ /* #undef HAVE_FEOF_UNLOCKED */ /* Define if you have the fgets_unlocked function. */ /* #undef HAVE_FGETS_UNLOCKED */ /* Define if you have the getaddrinfo function. */ /* #undef HAVE_GETADDRINFO */ /* Define if you have the getcwd function. */ #define HAVE_GETCWD 1 /* Define if you have the getegid function. */ /* #undef HAVE_GETEGID */ /* Define if you have the geteuid function. */ /* #undef HAVE_GETEUID */ /* Define if you have the getgid function. */ /* #undef HAVE_GETGID */ /* Define if you have the gethostid function. */ /* #undef HAVE_GETHOSTID */ /* Define if you have the getopt_long function. */ /* #undef HAVE_GETOPT_LONG */ /* Define if you have the getpagesize function. */ #define HAVE_GETPAGESIZE 1 /* Define if you have the getuid function. */ /* #undef HAVE_GETUID */ /* Define if you have the krb_get_err_text function. */ /* #undef HAVE_KRB_GET_ERR_TEXT */ /* Define if you have the krb_get_lrealm function. */ /* #undef HAVE_KRB_GET_LREALM */ /* Define if you have the krb_log function. */ /* #undef HAVE_KRB_LOG */ /* Define if you have the krb_rd_req function. */ /* #undef HAVE_KRB_RD_REQ */ /* Define if you have the krb_set_key function. */ /* #undef HAVE_KRB_SET_KEY */ /* Define if you have the lrand48 function. */ /* #undef HAVE_LRAND48 */ /* Define if you have the memcpy function. */ #define HAVE_MEMCPY 1 /* Define if you have the memmove function. */ #define HAVE_MEMMOVE 1 /* Define if you have the mempcpy function. */ /* #undef HAVE_MEMPCPY */ /* Define if you have the munmap function. */ /* #undef HAVE_MUNMAP */ /* Define if you have the putenv function. */ #define HAVE_PUTENV 1 /* Define if you have the random function. */ /* #undef HAVE_RANDOM */ /* Define if you have the setenv function. */ /* #undef HAVE_SETENV */ /* Define if you have the setlocale function. */ #define HAVE_SETLOCALE 1 /* Define if you have the snprintf function. */ #define HAVE_SNPRINTF 1 /* Define if you have the socket function. */ /* #undef HAVE_SOCKET */ /* Define if you have the stpcpy function. */ /* #undef HAVE_STPCPY */ /* Define if you have the strcasecmp function. */ #define HAVE_STRCASECMP 1 /* Define if you have the strchr function. */ #define HAVE_STRCHR 1 /* Define if you have the strdup function. */ #define HAVE_STRDUP 1 /* Define if you have the strerror function. */ #define HAVE_STRERROR 1 /* Define if you have the strstr function. */ #define HAVE_STRSTR 1 /* Define if you have the strtoul function. */ #define HAVE_STRTOUL 1 /* Define if you have the tsearch function. */ /* #undef HAVE_TSEARCH */ /* Define if you have the vprintf function. */ #define HAVE_VPRINTF 1 /* Define if you have the <X11/SM/SMlib.h> header file. */ /* #undef HAVE_X11_SM_SMLIB_H */ /* Define if you have the <argz.h> header file. */ /* #undef HAVE_ARGZ_H */ /* Define if you have the <arpa/nameser_compat.h> header file. */ /* #undef HAVE_ARPA_NAMESER_COMPAT_H */ /* Define if you have the <asm/byteorder.h> header file. */ /* #undef HAVE_ASM_BYTEORDER_H */ /* Define if you have the <byteswap.h> header file. */ /* #undef HAVE_BYTESWAP_H */ /* Define if you have the <dlfcn.h> header file. */ /* #undef HAVE_DLFCN_H */ /* Define if you have the <endian.h> header file. */ /* #undef HAVE_ENDIAN_H */ /* Define if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 /* Define if you have the <limits.h> header file. */ #define HAVE_LIMITS_H 1 /* Define if you have the <locale.h> header file. */ #define HAVE_LOCALE_H 1 /* Define if you have the <machine/endian.h> header file. */ /* #undef HAVE_MACHINE_ENDIAN_H */ /* Define if you have the <malloc.h> header file. */ #define HAVE_MALLOC_H 1 /* Define if you have the <nl_types.h> header file. */ /* #undef HAVE_NL_TYPES_H */ /* Define if you have the <paths.h> header file. */ /* #undef HAVE_PATHS_H */ /* Define if you have the <sgtty.h> header file. */ /* #undef HAVE_SGTTY_H */ /* Define if you have the <signal.h> header file. */ /*#define HAVE_SIGNAL_H 1*/ /* Define if you have the <stdarg.h> header file. */ #define HAVE_STDARG_H 1 /* Define if you have the <stddef.h> header file. */ #define HAVE_STDDEF_H 1 /* Define if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define if you have the <sys/cdefs.h> header file. */ /* #undef HAVE_SYS_CDEFS_H */ /* Define if you have the <sys/file.h> header file. */ #define HAVE_SYS_FILE_H 1 /* Define if you have the <sys/filio.h> header file. */ /* #undef HAVE_SYS_FILIO_H */ /* Define if you have the <sys/ioctl.h> header file. */ /* #undef HAVE_SYS_IOCTL_H */ /* Define if you have the <sys/msgbuf.h> header file. */ /* #undef HAVE_SYS_MSGBUF_H */ /* Define if you have the <sys/param.h> header file. */ /* #undef HAVE_SYS_PARAM_H */ /* Define if you have the <sys/select.h> header file. */ /* #undef HAVE_SYS_SELECT_H */ /* Define if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 /* Define if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define if you have the <sys/uio.h> header file. */ /* #undef HAVE_SYS_UIO_H */ /* Define if you have the <sys/utsname.h> header file. */ /* #undef HAVE_SYS_UTSNAME_H */ /* Define if you have the <sys/wait.h> header file. */ /* #undef HAVE_SYS_WAIT_H */ /* Define if you have the <termios.h> header file. */ /* #undef HAVE_TERMIOS_H */ /* Define if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define if you have the nsl library (-lnsl). */ /* #undef HAVE_LIBNSL */ /* Define if you have the resolv library (-lresolv). */ /* #undef HAVE_LIBRESOLV */ /* Name of package */ #define PACKAGE "gaim" /* Version number of package */ /*#define VERSION */ /* Define if you have the iconv() function. */ /* #undef HAVE_ICONV */ /* Define as const if the declaration of iconv() needs const. */ /* #undef ICONV_CONST */ /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ /* #undef HAVE_LANGINFO_CODESET */ /* Define if your <locale.h> file defines LC_MESSAGES. */ /* #undef HAVE_LC_MESSAGES */ /* Define to 1 if translation of program messages to the user's native language is requested. */ #define ENABLE_NLS 1 /* Define if the GNU gettext() function is already present or preinstalled. */ /* #undef HAVE_GETTEXT */ /* Define if you have the external 'timezone' variable. */ #define HAVE_TIMEZONE 1 /* Define if you have the external 'altzone' variable. */ /* #undef HAVE_ALTZONE */ /* Define if you have the external 'daylight' variable. */ #define HAVE_DAYLIGHT 1 /* * Following are added for Win32 version of Gaim */ #define HAVE_VSNPRINTF |
From: Rob F. <rob...@us...> - 2002-10-11 03:52:10
|
Update of /cvsroot/gaim/gaim In directory usw-pr-cvs1:/tmp/cvs-serv6493 Modified Files: ChangeLog Log Message: Take *THAT*, Paco-Paco Index: ChangeLog =================================================================== RCS file: /cvsroot/gaim/gaim/ChangeLog,v retrieving revision 1.561 retrieving revision 1.562 diff -u -d -r1.561 -r1.562 --- ChangeLog 11 Oct 2002 03:46:54 -0000 1.561 +++ ChangeLog 11 Oct 2002 03:52:07 -0000 1.562 @@ -1,6 +1,6 @@ Gaim: The Pimpin' Penguin IM Clone thats good for the soul! -version 0.60: +version 0.60: * French translation updated (thanks, Stephane Wirtel, and Sebastian Carpe) * Polish translation updated (Thanks, Przemyslaw Sulek) |
From: Rob F. <rob...@us...> - 2002-10-11 03:46:57
|
Update of /cvsroot/gaim/gaim In directory usw-pr-cvs1:/tmp/cvs-serv5115 Modified Files: ChangeLog Log Message: uhh yeah Index: ChangeLog =================================================================== RCS file: /cvsroot/gaim/gaim/ChangeLog,v retrieving revision 1.560 retrieving revision 1.561 diff -u -d -r1.560 -r1.561 --- ChangeLog 11 Oct 2002 03:21:34 -0000 1.560 +++ ChangeLog 11 Oct 2002 03:46:54 -0000 1.561 @@ -84,7 +84,7 @@ * Improved typing notification support for Jabber and Yahoo! (Thanks Nathan Walp) * Generic File Transfer PRPL interface (Thanks William T. Mahan) - * DCC File Send / Receive support for IRC + * DCC File Receive support for IRC * File receive support for Jabber (Thanks, Nathan Walp) * File send/receive support for Oscar (Thanks, William T. Mahan) |
From: Rob F. <rob...@us...> - 2002-10-11 03:46:41
|
Update of /cvsroot/gaim/gaim/src/protocols/irc In directory usw-pr-cvs1:/tmp/cvs-serv5043/src/protocols/irc Modified Files: irc.c Log Message: Lets not do file send just yet its buggy, I need to redo it Index: irc.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/irc/irc.c,v retrieving revision 1.97 retrieving revision 1.98 diff -u -d -r1.97 -r1.98 --- irc.c 11 Oct 2002 03:13:59 -0000 1.97 +++ irc.c 11 Oct 2002 03:46:38 -0000 1.98 @@ -492,16 +492,8 @@ void irc_read_dcc_ack (gpointer data, gint source, GaimInputCondition condition) { - struct irc_file_transfer *ift = data; - struct irc_data *id = (struct irc_data *)ift->gc->proto_data; - int len; - guint32 ack; - - printf("I got here.\n"); - len = recv(source, (char *)&ack, 4, MSG_PEEK); - printf("Len is: %d\n", len); - printf("Ack is: %d\n", ack); - recv(source, (char *)&ack, 4, 0); + /* Read ACK Here */ + } void dcc_send_callback (gpointer data, gint source, GaimInputCondition condition) { @@ -517,11 +509,11 @@ ift->fd = accept(ift->fd, (struct sockaddr *)&addr, &len); if (!ift->fd) { /* FIXME: Handle this gracefully XXX */ - printf("Something bad happened here, bubba!"); + printf("Something bad happened here, bubba!\n"); return; } -// ift->awatcher = gaim_input_add(ift->fd, GAIM_INPUT_READ, irc_read_dcc_ack, ift); + /* ift->awatcher = gaim_input_add(ift->fd, GAIM_INPUT_READ, irc_read_dcc_ack, ift); */ if (transfer_out_do(ift->xfer, ift->fd, 0)) { gaim_input_remove(ift->watcher); @@ -2149,6 +2141,7 @@ ift->port = ntohs(addr.sin_port); ift->watcher = gaim_input_add (ift->fd, GAIM_INPUT_READ, dcc_send_callback, ift); + printf("watcher is %d\n", ift->watcher); snprintf(buf, sizeof(buf), "\001DCC SEND %s %s %d %d\001\n", name, ift->ip, ift->port, totsize); printf("Trying: %s\n", buf); @@ -2226,13 +2219,13 @@ pbm->callback = irc_start_chat; pbm->gc = gc; m = g_list_append(m, pbm); - +/* pbm = g_new0(struct proto_buddy_menu, 1); pbm->label = _("DCC Send"); pbm->callback = irc_ask_send_file; pbm->gc = gc; m = g_list_append(m, pbm); - +*/ return m; } |
From: Rob F. <rob...@us...> - 2002-10-11 03:21:37
|
Update of /cvsroot/gaim/gaim In directory usw-pr-cvs1:/tmp/cvs-serv31311 Modified Files: ChangeLog Log Message: Well, I didn't mean to commit the oscar FT patch(es) and the Jabber FT patch, but like I said, I dont care (Besides, I've used them and they work fine for me) Index: ChangeLog =================================================================== RCS file: /cvsroot/gaim/gaim/ChangeLog,v retrieving revision 1.559 retrieving revision 1.560 diff -u -d -r1.559 -r1.560 --- ChangeLog 11 Oct 2002 01:47:27 -0000 1.559 +++ ChangeLog 11 Oct 2002 03:21:34 -0000 1.560 @@ -85,6 +85,8 @@ Yahoo! (Thanks Nathan Walp) * Generic File Transfer PRPL interface (Thanks William T. Mahan) * DCC File Send / Receive support for IRC + * File receive support for Jabber (Thanks, Nathan Walp) + * File send/receive support for Oscar (Thanks, William T. Mahan) version 0.59 (06/24/2002): * Hungarian translation added (Thanks, Sutto Zoltan) |
From: Rob F. <rob...@us...> - 2002-10-11 03:15:56
|
Update of /cvsroot/gaim/gaim/src/win32 In directory usw-pr-cvs1:/tmp/cvs-serv29895/src/win32 Added Files: gaimrc.rc Log Message: Yeah ok --- NEW FILE: gaimrc.rc --- #include "resource.h" IDI_ICON2 ICON "../pixmaps/gaim.ico" |
From: Rob F. <rob...@us...> - 2002-10-11 03:15:56
|
Update of /cvsroot/gaim/gaim/sounds In directory usw-pr-cvs1:/tmp/cvs-serv29895/sounds Added Files: wav2h.c Log Message: Yeah ok --- NEW FILE: wav2h.c --- #include <windows.h> #include <stdio.h> #include <conio.h> #define BUF_SIZE 10 unsigned long load_file( char* filename, char** wavePtr ) { HANDLE inHandle; unsigned long waveSize, action; /* Open the WAVE file */ if (INVALID_HANDLE_VALUE != (inHandle = CreateFile( filename, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, 0))) { /* I'm going to skip checking that this is a WAVE file. I'll assume that it is. * Normally, you'd check it's RIFF header. */ /* Get the size of the file */ if(0xFFFFFFFF == (waveSize = GetFileSize(inHandle, 0)) && waveSize) { printf("Bad wave file size\n"); exit(1); } /* Allocate some memory to load the file */ if ((*wavePtr = (char *)VirtualAlloc(0, waveSize, MEM_COMMIT, PAGE_READWRITE))) { /* Read in WAVE file */ if (ReadFile(inHandle, *wavePtr, waveSize, &action, 0) && waveSize == action) { return waveSize; } else { printf("Error loading WAVE!\r\n"); } /* Free the memory */ VirtualFree(*wavePtr, waveSize, MEM_FREE); } else { printf("Can't get memory!\r\n"); } } else { printf("Bad WAVE size!\r\n"); } /* Close the WAVE file */ CloseHandle(inHandle); return 0; } void usage() { printf("Usage: wav2h NameOfFile.wav\n"); exit(1); } int main(int argc, char **argv) { FILE *f_in=0; FILE *f_out=0; int res, i, j, ext=0; char *wavedata=0; int wavesize=0; char dataname[100]; char filename[100]; char outfile[100]; if(argc<2 || argc>2) { usage(); } for(i=0;i<strlen(argv[1]);i++) { if( argv[1][i] == '/' || argv[1][i] == ':' ) { printf("You must run wav2h from the directory containing the wav files.\n"); usage(); } else if( argv[1][i] == '.' ) { if( i+3 >= strlen(argv[1]) || !(argv[1][i+1] == 'w' && argv[1][i+2] == 'a' && argv[1][i+3] == 'v') || i+4 != strlen(argv[1])) { printf("Error: wav2h only works with wav files (with wav extension)\n"); usage(); } dataname[i] = '\0'; ext=1; break; } else dataname[i] = argv[1][i]; } if(!ext) { printf("Error: wav2h only works with wav files (with wav extension)\n"); usage(); } sprintf(filename, ".\\%s", argv[1]); sprintf(outfile, ".\\%s.h", dataname); if((wavesize = load_file( filename, &wavedata )) == 0) { printf("Error loading file to memory\n"); exit(1); } f_out = fopen(outfile, "w+"); if (!f_out) { perror("fopen"); exit(1); } fprintf(f_out, "static unsigned char %s[] = {\n", dataname); for(i=0,j=0;i<wavesize;i++,j++) { fprintf(f_out, "%#x, ", wavedata[i] & 0xff); if(j==BUF_SIZE) { j=0; fprintf(f_out, "\n"); } } fprintf(f_out,"};\n"); fclose(f_out); VirtualFree(wavedata, wavesize, MEM_FREE); return(0); } |
From: Rob F. <rob...@us...> - 2002-10-11 03:14:29
|
Update of /cvsroot/gaim/gaim/plugins/ticker In directory usw-pr-cvs1:/tmp/cvs-serv28946/plugins/ticker Modified Files: ticker.c Added Files: Makefile.mingw Log Message: Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. --- NEW FILE: Makefile.mingw --- # # Makefile.mingw # # Description: Makefile for ticker plugin. # # # PATHS # INCLUDE_DIR := . GTK_TOP := ../../../win32-dev/gtk_2_0 GAIM_TOP := ../.. TICKER_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir DLL_INSTALL_DIR := $(GAIM_INSTALL_DIR)/plugins ## ## VARIABLE DEFINITIONS ## TARGET = ticker VERSION := $(shell cat $(GAIM_TOP)/VERSION) # Compiler Options CC = gcc.exe CFLAGS = -O2 -Werror -Wall -mno-cygwin -fnative-struct DEFINES = -DGTK_ENABLE_BROKEN -DVERSION=\"$(VERSION)\" ## ## INCLUDE MAKEFILES ## ## ## INCLUDE PATHS ## INCLUDE_PATHS += -I$(TICKER_ROOT) \ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/include/pango-1.0 \ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ -I$(GAIM_TOP)/src \ -I$(GAIM_TOP)/src/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(GAIM_TOP)/src ## ## SOURCES, OBJECTS ## C_SRC = ticker.c \ gtkticker.c OBJECTS = $(C_SRC:%.c=%.o) ## ## LIBRARIES ## LIBS = -lgtk-win32-2.0 -lglib-2.0 -lgdk-win32-2.0 -lgmodule-2.0 -lgobject-2.0 -lws2_32 -lintl -lgaim ## ## RULES ## # How to make a C file %.o: %.c $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@ -c $< ## ## TARGET DEFINITIONS ## .PHONY: all clean all: $(TARGET).dll install: cp $(TICKER_ROOT)/$(TARGET).dll $(DLL_INSTALL_DIR) ## ## BUILD Dependencies ## $(GAIM_TOP)/src/gaim.lib: $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib ## ## BUILD DLL ## $(TARGET).def: $(OBJECTS) dlltool --dllname $(TARGET).dll -z $(TARGET).def \ $(OBJECTS) $(TARGET).base: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib gcc -mdll -o junk.tmp -Wl,--base-file,$@ $(OBJECTS) $(LIB_PATHS) $(LIBS) rm -rf junk.tmp $(TARGET).exp: $(TARGET).def $(TARGET).base dlltool --dllname $(TARGET).dll --base-file $(TARGET).base \ --output-exp $(TARGET).exp --def $(TARGET).def rm -rf $(TARGET).base $(TARGET).dll: $(OBJECTS) $(TARGET).exp $(GAIM_TOP)/src/gaim.lib gcc -mdll -o $(TARGET).dll $(OBJECTS) -Wl,$(TARGET).exp $(LIB_PATHS) $(LIBS) rm -rf $(TARGET).exp ## ## CLEAN RULES ## clean: rm -rf *.o rm -rf $(TARGET).dll rm -rf $(TARGET).def Index: ticker.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/ticker/ticker.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ticker.c 26 Sep 2002 07:37:51 -0000 1.4 +++ ticker.c 11 Oct 2002 03:13:57 -0000 1.5 @@ -31,6 +31,9 @@ #include "gaim.h" #include "prpl.h" #include "pixmaps/no_icon.xpm" +#ifdef _WIN32 +#include "win32dep.h" +#endif static GtkWidget *tickerwindow = NULL; static GtkWidget *ticker; @@ -49,6 +52,10 @@ gboolean userclose = FALSE; GtkWidget *msgw; +/* for win32 compatability */ +G_MODULE_IMPORT GSList *connections; +G_MODULE_IMPORT GtkWidget *blist; + void BuddyTickerDestroyWindow( GtkWidget *window ); void BuddyTickerCreateWindow( void ); void BuddyTickerAddUser( char *name, char *alias, GdkPixmap *pm, GdkBitmap *bm ); @@ -372,7 +379,7 @@ } void signoff_cb(struct gaim_connection *gc) { - if (!connections->next) { + if (connections && !connections->next) { gtk_widget_destroy(tickerwindow); tickerwindow = NULL; ticker = NULL; @@ -401,7 +408,19 @@ gdk_bitmap_unref(bm); } -char *gaim_plugin_init(GModule *h) { +/* + * EXPORTED FUNCTIONS + */ + +G_MODULE_EXPORT char *name() { + return "Buddy Ticker"; +} + +G_MODULE_EXPORT char *description() { + return "Scrolls online buddies from your buddy list."; +} + +G_MODULE_EXPORT char *gaim_plugin_init(GModule *h) { handle = h; gaim_signal_connect(h, event_buddy_signon, signon_cb, NULL); @@ -414,11 +433,11 @@ return NULL; } -void gaim_plugin_remove() { - gtk_widget_destroy(tickerwindow); +G_MODULE_EXPORT void gaim_plugin_remove() { + BuddyTickerDestroyWindow(tickerwindow); } struct gaim_plugin_description desc; -struct gaim_plugin_description *gaim_plugin_desc() { +G_MODULE_EXPORT struct gaim_plugin_description *gaim_plugin_desc() { desc.api_version = PLUGIN_API_VERSION; desc.name = g_strdup("Ticker"); desc.version = g_strdup(VERSION); |
From: Rob F. <rob...@us...> - 2002-10-11 03:14:29
|
Update of /cvsroot/gaim/gaim/plugins In directory usw-pr-cvs1:/tmp/cvs-serv28946/plugins Modified Files: autorecon.c chatlist.c iconaway.c spellchk.c Added Files: Makefile.mingw Log Message: Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. --- NEW FILE: Makefile.mingw --- # # Makefile.mingw # # Description: Makefile for win32 (mingw) version of Gaim Plugins # # # PATHS # GAIM_PLUGINS := . GAIM_TOP := .. GTK_TOP := ../../win32-dev/gtk_2_0 OSCAR_ROOT := ../src/protocols/oscar GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir TICKER := ./ticker ## ## VARIABLE DEFINITIONS ## VERSION := $(shell cat $(GAIM_TOP)/VERSION) # Compiler Options CC = gcc.exe CFLAGS = -O2 -Wall -Werror -mno-cygwin -fnative-struct DEFINES = -DGTK_ENABLE_BROKEN -DVERSION=\"$(VERSION)\" .SUFFIXES: .SUFFIXES: .c .dll ## ## INCLUDE MAKEFILES ## ## ## INCLUDE PATHS ## INCLUDE_PATHS += -I$(OSCAR_ROOT) \ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/include/pango-1.0 \ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ -I$(GAIM_TOP) \ -I$(GAIM_TOP)/src \ -I$(GAIM_TOP)/src/win32 LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(GAIM_TOP)/src ## ## LIBRARIES ## LIBS = -lgtk-win32-2.0 -lglib-2.0 -lgdk-win32-2.0 -lgobject-2.0 -lgmodule-2.0 -lintl -lws2_32 -liberty -lgaim ## ## RULES ## ## ## TARGET DEFINITIONS ## .PHONY: all clean all: plugins $(MAKE) -C $(TICKER) -f Makefile.mingw install: cp $(GAIM_PLUGINS)/*.dll $(GAIM_PLUGINS)/*.pl $(GAIM_INSTALL_DIR)/plugins $(MAKE) -C $(TICKER) -f Makefile.mingw install # # BUILD Plugin # .c.dll: $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o tmp$@.o -c $< dlltool -D $@ -z $@.def tmp$@.o gcc -mdll -o junk.tmp -Wl,--base-file,$@.base tmp$@.o $(LIB_PATHS) $(LIBS) dlltool -D $@ -b $@.base -e $@.exp -d $@.def gcc -mdll -o $@ tmp$@.o -Wl,$@.exp $(LIB_PATHS) $(LIBS) rm -rf $@.base $@.def $@.exp junk.tmp plugins: autorecon.dll iconaway.dll spellchk.dll ## ## CLEAN RULES ## clean: rm -rf *.o rm -rf *.dll $(MAKE) -C $(TICKER) -f Makefile.mingw clean Index: autorecon.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/autorecon.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- autorecon.c 1 Oct 2001 00:13:13 -0000 1.15 +++ autorecon.c 11 Oct 2002 03:13:56 -0000 1.16 @@ -2,6 +2,10 @@ #include "gaim.h" #include "prpl.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + #define INITIAL 8000 #define MAXTIME 1024000 @@ -9,14 +13,6 @@ static guint tim = 0; -char *name() { - return "Auto Reconnect"; -} - -char *description() { - return "When you are kicked offline, this reconnects you."; -} - static gboolean do_signon(gpointer data) { struct aim_user *u = data; if (g_slist_index(aim_users, u) < 0) @@ -41,7 +37,19 @@ } } -char *gaim_plugin_init(GModule *handle) { +/* + * EXPORTED FUNCTIONS + */ + +G_MODULE_EXPORT char *name() { + return "Auto Reconnect"; +} + +G_MODULE_EXPORT char *description() { + return "When you are kicked offline, this reconnects you."; +} + +G_MODULE_EXPORT char *gaim_plugin_init(GModule *handle) { hash = g_hash_table_new(g_int_hash, g_int_equal); gaim_signal_connect(handle, event_signoff, reconnect, NULL); @@ -49,7 +57,7 @@ return NULL; } -void gaim_plugin_remove() { +G_MODULE_EXPORT void gaim_plugin_remove() { if (tim) g_source_remove(tim); g_hash_table_destroy(hash); Index: chatlist.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/chatlist.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- chatlist.c 28 Sep 2002 21:39:44 -0000 1.15 +++ chatlist.c 11 Oct 2002 03:13:57 -0000 1.16 @@ -10,6 +10,9 @@ #include <stdlib.h> #include <string.h> +#ifdef _WIN32 +#include "win32dep.h" +#endif #define AOL_SRCHSTR "aim:GoChat?RoomName=" @@ -293,7 +296,7 @@ parent = NULL; } -GtkWidget *gaim_plugin_config_gtk() +G_MODULE_EXPORT GtkWidget *gaim_plugin_config_gtk() { GtkWidget *ret, *vbox; GtkWidget *list1, *list2; @@ -390,14 +393,14 @@ setup_buddy_chats(); } -char *gaim_plugin_init(GModule *m) +G_MODULE_EXPORT char *gaim_plugin_init(GModule *m) { restore_chat_prefs(); gaim_signal_connect(m, event_signon, handle_signon, NULL); return NULL; } -void gaim_plugin_remove() +G_MODULE_EXPORT void gaim_plugin_remove() { if (parent) gtk_widget_destroy(parent); @@ -428,12 +431,12 @@ return &desc; } -char *name() +G_MODULE_EXPORT char *name() { return "Chat List"; } -char *description() +G_MODULE_EXPORT char *description() { return "Allows you to add chat rooms to your buddy list. Click the configure button to choose" " which rooms."; Index: iconaway.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/iconaway.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- iconaway.c 28 Sep 2002 17:46:10 -0000 1.17 +++ iconaway.c 11 Oct 2002 03:13:57 -0000 1.18 @@ -1,14 +1,18 @@ -#include "../config.h" +#define GAIM_PLUGINS #include "gaim.h" #include <gtk/gtk.h> +#ifdef _WIN32 +#include "win32dep.h" +#endif + void *handle; -extern GtkWidget *imaway; -extern GtkWidget *blist; -extern GtkWidget *all_chats; -extern GtkWidget *all_convos; +G_MODULE_IMPORT GtkWidget *imaway; +G_MODULE_IMPORT GtkWidget *blist; +G_MODULE_IMPORT GtkWidget *all_chats; +G_MODULE_IMPORT GtkWidget *all_convos; #ifdef USE_APPLET extern void applet_destroy_buddy(); @@ -25,7 +29,11 @@ gtk_window_iconify(GTK_WINDOW(all_chats)); } -char *gaim_plugin_init(GModule *h) { +/* + * EXPORTED FUNCTIONS + */ + +G_MODULE_EXPORT char *gaim_plugin_init(GModule *h) { handle = h; gaim_signal_connect(handle, event_away, iconify_windows, NULL); @@ -34,7 +42,7 @@ } struct gaim_plugin_description desc; -struct gaim_plugin_description *gaim_plugin_desc() { +G_MODULE_EXPORT struct gaim_plugin_description *gaim_plugin_desc() { desc.api_version = PLUGIN_API_VERSION; desc.name = g_strdup("Iconify on away"); desc.version = g_strdup(VERSION); @@ -44,10 +52,10 @@ return &desc; } -char *name() { +G_MODULE_EXPORT char *name() { return "Iconify On Away"; } -char *description() { +G_MODULE_EXPORT char *description() { return "Iconifies the away box and the buddy list when you go away."; } Index: spellchk.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/spellchk.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- spellchk.c 28 Sep 2002 21:39:44 -0000 1.24 +++ spellchk.c 11 Oct 2002 03:13:57 -0000 1.25 @@ -18,6 +18,9 @@ #include <sys/types.h> #include <unistd.h> #include <fcntl.h> +#ifdef _WIN32 +#include "win32dep.h" +#endif struct replace_words { char *bad; @@ -136,35 +139,7 @@ free(ibuf); } -char *gaim_plugin_init(GModule *handle) { - load_conf(); - - gaim_signal_connect(handle, event_im_send, substitute_words, NULL); - gaim_signal_connect(handle, event_chat_send, substitute_words, NULL); - return NULL; -} - -void gaim_plugin_remove() { -} - -struct gaim_plugin_description desc; -struct gaim_plugin_description *gaim_plugin_desc() { - desc.api_version = PLUGIN_API_VERSION; - desc.name = g_strdup("Text replacement"); - desc.version = g_strdup(VERSION); - desc.description = g_strdup("Replaces text in outgoing messages according to user-defined rules."); - desc.authors = g_strdup("Eric Warmehoven <er...@wa...>"); - desc.url = g_strdup(WEBSITE); - return &desc; -} - -char *name() { - return "IM Spell Check"; -} -char *description() { - return "Watches outgoing IM text and corrects common spelling errors."; -} static int num_words(char *m) { int count = 0; @@ -358,7 +333,41 @@ } } -GtkWidget *gaim_plugin_config_gtk() { +/* + * EXPORTED FUNCTIONS + */ + +G_MODULE_EXPORT char *gaim_plugin_init(GModule *handle) { + load_conf(); + + gaim_signal_connect(handle, event_im_send, substitute_words, NULL); + gaim_signal_connect(handle, event_chat_send, substitute_words, NULL); + return NULL; +} + +G_MODULE_EXPORT void gaim_plugin_remove() { +} + +struct gaim_plugin_description desc; +G_MODULE_EXPORT struct gaim_plugin_description *gaim_plugin_desc() { + desc.api_version = PLUGIN_API_VERSION; + desc.name = g_strdup("Text replacement"); + desc.version = g_strdup(VERSION); + desc.description = g_strdup("Replaces text in outgoing messages according to user-defined rules."); + desc.authors = g_strdup("Eric Warmehoven <er...@wa...>"); + desc.url = g_strdup(WEBSITE); + return &desc; +} + +G_MODULE_EXPORT char *name() { + return "IM Spell Check"; +} + +G_MODULE_EXPORT char *description() { + return "Watches outgoing IM text and corrects common spelling errors."; +} + +G_MODULE_EXPORT GtkWidget *gaim_plugin_config_gtk() { GtkWidget *ret, *vbox, *win; GtkWidget *hbox; GtkWidget *button; |
Update of /cvsroot/gaim/gaim/src/protocols/oscar In directory usw-pr-cvs1:/tmp/cvs-serv28946/src/protocols/oscar Modified Files: aim.h aim_internal.h conn.c ft.c im.c meta.c oscar.c ssi.c txqueue.c Added Files: Makefile.mingw Log Message: Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. --- NEW FILE: Makefile.mingw --- # # Makefile.mingw # # Description: Makefile for win32 (mingw) version of liboscar # # # PATHS # OSCAR_ROOT := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir ## ## VARIABLE DEFINITIONS ## TARGET = liboscar VERSION := $(shell cat $(GAIM_TOP)/VERSION) # Compiler Options CC = gcc.exe $(GCOPTS) # Only use -g flag when building STATIC version CFLAGS = -O2 -Wall -Werror DEFINES = -DHAVE_CONFIG_H \ -DVERSION=\"$(VERSION)\" \ -DAIM_BUILDDATE=\"`date +%Y%m%d`\" \ -DAIM_BUILDTIME=\"`date +%H%M%S`\" # Static or Plugin... ifeq ($(TYPE),STATIC) DEFINES += -DSTATIC DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR) else ifeq ($(TYPE),PLUGIN) DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR)/plugins endif endif ## ## INCLUDE MAKEFILES ## ## ## INCLUDE PATHS ## INCLUDE_PATHS += -I$(OSCAR_ROOT) \ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/include/pango-1.0 \ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ -I$(GAIM_TOP)/src \ -I$(GAIM_TOP)/src/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(GAIM_TOP)/src ## ## SOURCES, OBJECTS ## C_SRC = admin.c \ adverts.c \ auth.c \ bos.c \ buddylist.c \ chat.c \ chatnav.c \ conn.c \ ft.c \ icq.c \ im.c \ info.c \ invite.c \ meta.c \ misc.c \ msgcookie.c \ popups.c \ rxhandlers.c \ rxqueue.c \ search.c \ service.c \ snac.c \ ssi.c \ stats.c \ tlv.c \ translate.c \ txqueue.c \ util.c \ oscar.c OBJECTS = $(C_SRC:%.c=%.o) ## ## LIBRARIES ## LIBS = -lgtk-win32-2.0 -lglib-2.0 -lgdk-win32-2.0 -lgmodule-2.0 -lgobject-2.0 -lintl -lws2_32 -liberty -lgaim ## ## RULES ## # How to make a C file %.o: %.c $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@ -c $< ## ## TARGET DEFINITIONS ## .PHONY: all clean all: $(TARGET).dll install: cp $(OSCAR_ROOT)/$(TARGET).dll $(DLL_INSTALL_DIR) ## ## BUILD Dependencies ## $(GAIM_TOP)/src/gaim.lib: $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib ## ## BUILD DLL ## $(TARGET).def: $(OBJECTS) dlltool --dllname $(TARGET).dll -z $(TARGET).def --export-all-symbols $(OBJECTS) $(TARGET).base: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib gcc -mdll -o junk.tmp -Wl,--base-file,$@ $(OBJECTS) $(LIB_PATHS) $(LIBS) rm -rf junk.tmp $(TARGET).exp: $(TARGET).def $(TARGET).base dlltool --dllname $(TARGET).dll --base-file $(TARGET).base \ --output-exp $(TARGET).exp --def $(TARGET).def rm -rf $(TARGET).base $(TARGET).dll: $(OBJECTS) $(TARGET).exp $(GAIM_TOP)/src/gaim.lib dlltool -D $(TARGET).dll -d $(TARGET).def -l $(TARGET).lib gcc -mdll -o $(TARGET).dll $(OBJECTS) -Wl,$(TARGET).exp $(LIB_PATHS) $(LIBS) rm -rf $(TARGET).exp ## ## CLEAN RULES ## clean: rm -rf *.o rm -rf $(TARGET).dll rm -rf $(TARGET).lib rm -rf $(TARGET).def Index: aim.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/aim.h,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- aim.h 6 Oct 2002 03:08:46 -0000 1.47 +++ aim.h 11 Oct 2002 03:14:00 -0000 1.48 @@ -25,14 +25,13 @@ #include <errno.h> #include <time.h> -#ifdef _WIN32 -#include <windows.h> -#include <io.h> -#else +#ifndef _WIN32 #include <sys/time.h> #include <unistd.h> #include <netinet/in.h> #include <sys/socket.h> +#else +#include <winsock.h> #endif /* XXX adjust these based on autoconf-detected platform */ @@ -42,14 +41,6 @@ typedef fu32_t aim_snacid_t; typedef fu16_t flap_seqnum_t; -/* Portability stuff (DMP) */ - -#ifdef _WIN32 -#define sleep(x) Sleep((x)*1000) -#define snprintf _snprintf /* I'm not sure whats wrong with Microsoft here */ -#define close(x) closesocket(x) /* no comment */ -#endif - #if defined(mach) && defined(__APPLE__) #define gethostbyname(x) gethostbyname2(x, AF_INET) #endif @@ -707,6 +698,7 @@ int state; struct aim_fileheader_t fh; }; +#define OFT_TIMEOUT (60) struct aim_chat_roominfo { unsigned short exchange; @@ -866,6 +858,12 @@ fu32_t bgcolor; const char *rtfmsg; } rtfmsg; + struct { + fu16_t multiple; + fu16_t totfiles; + fu32_t totsize; + char *filename; + } sendfile; } info; void *destructor; /* used internally only */ }; @@ -893,15 +891,18 @@ faim_export aim_conn_t *aim_directim_connect(aim_session_t *, const char *sn, const char *addr, const fu8_t *cookie); faim_export int aim_send_im_ch2_geticqmessage(aim_session_t *sess, const char *sn, int type); -faim_export aim_conn_t *aim_sendfile_initiate(aim_session_t *, const char *destsn, const char *filename, fu16_t numfiles, fu32_t totsize); +faim_export aim_conn_t *aim_sendfile_initiate(aim_session_t *, const char *destsn, const char *filename, fu16_t numfiles, fu32_t totsize, char *cookret); faim_export int aim_send_im_ch4(aim_session_t *sess, char *sn, fu16_t type, fu8_t *message); faim_export int aim_mtn_send(aim_session_t *sess, fu16_t type1, char *sn, fu16_t type2); faim_export aim_conn_t *aim_getfile_initiate(aim_session_t *sess, aim_conn_t *conn, const char *destsn); faim_export int aim_oft_getfile_request(aim_session_t *sess, aim_conn_t *conn, const char *name, int size); +faim_export int aim_oft_sendfile_request(aim_session_t *sess, aim_conn_t *conn, + const char *name, int filesdone, int numfiles, int size, + int totsize); faim_export int aim_oft_getfile_ack(aim_session_t *sess, aim_conn_t *conn); -faim_export int aim_oft_getfile_end(aim_session_t *sess, aim_conn_t *conn); +faim_export int aim_oft_end(aim_session_t *sess, aim_conn_t *conn); /* aim_info.c */ #define AIM_CAPS_BUDDYICON 0x00000001 @@ -964,7 +965,11 @@ #define AIM_TRANSFER_DENY_DECLINE 0x0001 #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002 faim_export int aim_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, unsigned short code); -faim_export aim_conn_t *aim_accepttransfer(aim_session_t *sess, aim_conn_t *conn, const char *sn, const fu8_t *cookie, const fu8_t *ip, fu16_t listingfiles, fu16_t listingtotsize, fu16_t listingsize, fu32_t listingchecksum, fu16_t rendid); +faim_export aim_conn_t *aim_accepttransfer(aim_session_t *sess, aim_conn_t *conn, const char *sn, const fu8_t *cookie, const fu8_t *ip, fu16_t port, fu16_t rendid, ...); +faim_export int aim_canceltransfer(aim_session_t *sess, aim_conn_t *conn, + const char *cookie, const char *sn, int rendid); +faim_export fu32_t aim_update_checksum(aim_session_t *sess, aim_conn_t *conn, + const unsigned char *buffer, int bufferlen); faim_export int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, unsigned short); faim_export int aim_sendbuddyoncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info); Index: aim_internal.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/aim_internal.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- aim_internal.h 10 Dec 2001 00:48:27 -0000 1.12 +++ aim_internal.h 11 Oct 2002 03:14:00 -0000 1.13 @@ -91,7 +91,7 @@ faim_internal int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *cur); faim_internal flap_seqnum_t aim_get_next_txseqnum(aim_conn_t *); -faim_internal aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, fu8_t framing, fu8_t chan, int datalen); +faim_internal aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, fu8_t framing, fu16_t chan, int datalen); faim_internal void aim_frame_destroy(aim_frame_t *); faim_internal int aim_tx_enqueue(aim_session_t *, aim_frame_t *); faim_internal int aim_tx_printqueue(aim_session_t *); Index: conn.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/conn.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- conn.c 8 Mar 2002 18:12:55 -0000 1.11 +++ conn.c 11 Oct 2002 03:14:00 -0000 1.12 @@ -14,6 +14,8 @@ #include <netdb.h> #include <sys/socket.h> #include <netinet/in.h> +#else +#include <winsock.h> #endif /* @@ -317,7 +319,11 @@ { if (deadconn->fd >= 3) +#ifndef _WIN32 close(deadconn->fd); +#else + closesocket(deadconn->fd); +#endif deadconn->fd = -1; if (deadconn->handlerlist) aim_clearhandlers(deadconn); @@ -429,7 +435,11 @@ fd = socket(hp->h_addrtype, SOCK_STREAM, 0); if (connect(fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) < 0) { faimdprintf(sess, 0, "proxyconnect: unable to connect to proxy\n"); +#ifndef _WIN32 close(fd); +#else + closesocket(fd); +#endif return -1; } @@ -445,22 +455,40 @@ buf[2] = 0x00; i = 3; } - +#ifndef _WIN32 if (write(fd, buf, i) < i) { +#else + if (send(fd, buf, i, 0) < i) { +#endif *statusret = errno; +#ifndef _WIN32 close(fd); +#else + closesocket(fd); +#endif return -1; } - +#ifndef _WIN32 if (read(fd, buf, 2) < 2) { +#else + if (recv(fd, buf, 2, 0) < 2) { +#endif *statusret = errno; +#ifndef _WIN32 close(fd); +#else + closesocket(fd); +#endif return -1; } if ((buf[0] != 0x05) || (buf[1] == 0xff)) { *statusret = EINVAL; +#ifndef _WIN32 close(fd); +#else + closesocket(fd); +#endif return -1; } @@ -471,19 +499,39 @@ i += aimutil_putstr(buf+i, sess->socksproxy.username, strlen(sess->socksproxy.username)); i += aimutil_put8(buf+i, strlen(sess->socksproxy.password)); i += aimutil_putstr(buf+i, sess->socksproxy.password, strlen(sess->socksproxy.password)); +#ifndef _WIN32 if (write(fd, buf, i) < i) { +#else + if (send(fd, buf, i, 0) < i) { +#endif *statusret = errno; +#ifndef _WIN32 close(fd); +#else + closesocket(fd); +#endif return -1; } +#ifndef _WIN32 if (read(fd, buf, 2) < 2) { +#else + if (recv(fd, buf, 2, 0) < 2) { +#endif *statusret = errno; +#ifndef _WIN32 close(fd); +#else + closesocket(fd); +#endif return -1; } if ((buf[0] != 0x01) || (buf[1] != 0x00)) { *statusret = EINVAL; +#ifndef _WIN32 close(fd); +#else + closesocket(fd); +#endif return -1; } } @@ -495,27 +543,49 @@ i += aimutil_put8(buf+i, strlen(host)); i += aimutil_putstr(buf+i, host, strlen(host)); i += aimutil_put16(buf+i, port); - +#ifndef _WIN32 if (write(fd, buf, i) < i) { +#else + if (send(fd, buf, i, 0) < i) { +#endif *statusret = errno; +#ifndef _WIN32 close(fd); +#else + closesocket(fd); +#endif return -1; } +#ifndef _WIN32 if (read(fd, buf, 10) < 10) { +#else + if (recv(fd, buf, 10, 0) < 10) { +#endif *statusret = errno; +#ifndef _WIN32 close(fd); +#else + closesocket(fd); +#endif return -1; } if ((buf[0] != 0x05) || (buf[1] != 0x00)) { *statusret = EINVAL; +#ifndef _WIN32 close(fd); +#else + closesocket(fd); +#endif return -1; } } else { /* connecting directly */ struct sockaddr_in sa; struct hostent *hp; - +#ifdef _WIN32 + int imode = 1; + int w_errno = 0; +#endif if (!(hp = gethostbyname(host))) { *statusret = (h_errno | AIM_CONN_STATUS_RESOLVERR); return -1; @@ -529,17 +599,29 @@ fd = socket(hp->h_addrtype, SOCK_STREAM, 0); if (sess->flags & AIM_SESS_FLAGS_NONBLOCKCONNECT) +#ifndef _WIN32 fcntl(fd, F_SETFL, O_NONBLOCK); /* XXX save flags */ - +#else + ioctlsocket(fd, FIONBIO, (unsigned long *)&imode); +#endif if (connect(fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) < 0) { if (sess->flags & AIM_SESS_FLAGS_NONBLOCKCONNECT) { +#ifndef _WIN32 if ((errno == EINPROGRESS) || (errno == EINTR)) { +#else + w_errno = WSAGetLastError(); + if ((w_errno == WSAEINPROGRESS) || (w_errno == WSAEINTR)) { +#endif if (statusret) *statusret |= AIM_CONN_STATUS_INPROGRESS; return fd; } } +#ifndef _WIN32 close(fd); +#else + closesocket(fd); +#endif fd = -1; } } @@ -987,7 +1069,12 @@ { fd_set fds, wfds; struct timeval tv; - int res, error = ETIMEDOUT; + int res; +#ifndef _WIN32 + int error = ETIMEDOUT; +#else + int error = 0; +#endif aim_rxcallback_t userfunc; if (!conn || (conn->fd == -1)) @@ -1004,7 +1091,11 @@ tv.tv_usec = 0; if ((res = select(conn->fd+1, &fds, &wfds, NULL, &tv)) == -1) { +#ifndef _WIN32 error = errno; +#else + error = WSAGetLastError(); +#endif aim_conn_close(conn); errno = error; return -1; @@ -1015,9 +1106,13 @@ if (FD_ISSET(conn->fd, &fds) || FD_ISSET(conn->fd, &wfds)) { int len = sizeof(error); - +#ifndef _WIN32 if (getsockopt(conn->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) error = errno; +#else + if (getsockopt(conn->fd, SOL_SOCKET, SO_ERROR, (char*)&error, &len) < 0) + error = WSAGetLastError(); +#endif } if (error) { @@ -1025,9 +1120,9 @@ errno = error; return -1; } - +#ifndef _WIN32 fcntl(conn->fd, F_SETFL, 0); /* XXX should restore original flags */ - +#endif conn->status &= ~AIM_CONN_STATUS_INPROGRESS; if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE))) Index: ft.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/ft.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- ft.c 12 Mar 2002 17:21:44 -0000 1.16 +++ ft.c 11 Oct 2002 03:14:00 -0000 1.17 @@ -16,11 +16,13 @@ #include <sys/socket.h> #include <netinet/in.h> #include <sys/utsname.h> /* for aim_directim_initiate */ - #include <arpa/inet.h> /* for inet_ntoa */ - +#else +#include "win32dep.h" #endif +#include "gaim.h" [...1126 lines suppressed...] ft = (struct aim_filetransfer_priv *)conn->priv; ft->state = 4; /* no longer wanting data */ - ft->fh.nrecvd = ft->fh.size; - ft->fh.recvcsum = ft->fh.checksum; ft->fh.flags = 0x21; if (!(aim_oft_buildheader((unsigned char *)newoft->hdr.oft.hdr2, &(ft->fh)))) { - newoft->lock = 0; aim_frame_destroy(newoft); return -1; } - newoft->lock = 0; aim_tx_enqueue(sess, newoft); return 0; -#endif /* 0 */ } Index: im.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/im.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- im.c 6 Oct 2002 03:08:47 -0000 1.25 +++ im.c 11 Oct 2002 03:14:01 -0000 1.26 @@ -21,6 +21,10 @@ #define FAIM_INTERNAL #include <aim.h> +#ifdef _WIN32 +#include "win32dep.h" +#endif + /* * Takes a msghdr (and a length) and returns a client type * code. Note that this is *only a guess* and has a low likelihood @@ -722,7 +726,7 @@ aimbs_put16(&fr->data, 2+2+4+strlen(filename)+4); /* ? */ - aimbs_put16(&fr->data, 0x0001); + aimbs_put16(&fr->data, (numfiles > 1) ? 0x0002 : 0x0001); aimbs_put16(&fr->data, numfiles); aimbs_put32(&fr->data, totsize); aimbs_putraw(&fr->data, filename, strlen(filename)); @@ -730,6 +734,11 @@ /* ? */ aimbs_put32(&fr->data, 0x00000000); +#if 0 + /* from brian's patch (?) -- wtm */ + aimbs_put32(&fr->data, 0x00030000); +#endif + aim_tx_enqueue(sess, fr); return 0; @@ -1526,6 +1535,30 @@ return; } +static void incomingim_ch2_sendfile_free(aim_session_t *sess, struct aim_incomingim_ch2_args *args) +{ + free(args->info.sendfile.filename); +} + +static void incomingim_ch2_sendfile(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata) +{ + + args->destructor = (void *)incomingim_ch2_sendfile_free; + + if (servdata) { + /* 0x0001 for one file, 0x0002 for multiple files. */ + args->info.sendfile.multiple = aimbs_get16(servdata); + args->info.sendfile.totfiles = aimbs_get16(servdata); + args->info.sendfile.totsize = aimbs_get32(servdata); + args->info.sendfile.filename = aimbs_getstr(servdata, + servdata->len - (2+2+4+4)); + + aimbs_get32(servdata); /* 0x00030000 (?) */ + } + + return; +} + typedef void (*ch2_args_destructor_t)(aim_session_t *sess, struct aim_incomingim_ch2_args *args); static int incomingim_ch2(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, fu16_t channel, aim_userinfo_t *userinfo, aim_tlvlist_t *tlvlist, fu8_t *cookie) @@ -1697,6 +1730,8 @@ incomingim_ch2_chat(sess, mod, rx, snac, userinfo, &args, sdbsptr); else if (args.reqclass & AIM_CAPS_ICQSERVERRELAY) incomingim_ch2_icqserverrelay(sess, mod, rx, snac, userinfo, &args, sdbsptr); + else if (args.reqclass & AIM_CAPS_SENDFILE) + incomingim_ch2_sendfile(sess, mod, rx, snac, userinfo, &args, sdbsptr); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) @@ -1994,6 +2029,16 @@ snlen = aimbs_get8(bs); sn = aimbs_getstr(bs, snlen); reason = aimbs_get16(bs); + + if (channel == 2) { + /* File transfer declined. */ + if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) + ret = userfunc(sess, rx, channel, sn, reason, ck); + + free(sn); + free(ck); + return ret; + } switch (reason) { case 0x0003: { /* ICQ status message. Maybe other stuff too, you never know with these people. */ Index: meta.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/meta.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- meta.c 5 Nov 2001 02:05:06 -0000 1.3 +++ meta.c 11 Oct 2002 03:14:01 -0000 1.4 @@ -7,6 +7,10 @@ #define FAIM_INTERNAL #include <aim.h> +#ifdef _WIN32 +#include "win32dep.h" +#endif + faim_export char *aim_getbuilddate(void) { return AIM_BUILDDATE; Index: oscar.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/oscar.c,v retrieving revision 1.155 retrieving revision 1.156 diff -u -d -r1.155 -r1.156 --- oscar.c 6 Oct 2002 18:43:02 -0000 1.155 +++ oscar.c 11 Oct 2002 03:14:01 -0000 1.156 @@ -25,25 +25,35 @@ #include <config.h> #endif - +#ifndef _WIN32 #include <netdb.h> -#include <unistd.h> -#include <errno.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <sys/socket.h> +#include <unistd.h> +#else +#include <winsock.h> +#endif + +#include <errno.h> #include <ctype.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <time.h> -#include <sys/socket.h> #include <sys/stat.h> +#include <signal.h> + #include "multi.h" #include "prpl.h" #include "gaim.h" #include "aim.h" #include "proxy.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + #include "pixmaps/protocols/oscar/ab.xpm" #include "pixmaps/protocols/oscar/admin_icon.xpm" #include "pixmaps/protocols/oscar/aol_icon.xpm" @@ -73,7 +83,12 @@ #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" -static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE; +/* For win32 compatability */ +G_MODULE_IMPORT GSList *connections; +G_MODULE_IMPORT int report_idle; + +static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | + AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE; /* Set AIM caps, because Gaim can still do them over ICQ and * Winicq doesn't mind. */ @@ -104,6 +119,7 @@ GSList *oscar_chats; GSList *direct_ims; + GSList *file_transfers; GSList *hasicons; GHashTable *supports_tn; @@ -156,6 +172,22 @@ fu8_t cookie[8]; }; +struct oscar_file_transfer { + enum { OFT_SENDFILE_IN, OFT_SENDFILE_OUT } type; + aim_conn_t *conn; + struct file_transfer *xfer; + char *sn; + char ip[64]; + fu16_t port; + fu8_t cookie[8]; + int totsize; + int filesdone; + int totfiles; + int watcher; +}; + +static struct oscar_file_transfer *oft_listening; + struct icon_req { char *user; time_t timestamp; @@ -242,6 +274,55 @@ return c; } +/* XXX there must be a better way than this.... -- wtm */ +static struct oscar_file_transfer *find_oft_by_conn(struct gaim_connection *gc, + aim_conn_t *conn) { + GSList *g = ((struct oscar_data *)gc->proto_data)->file_transfers; + struct oscar_file_transfer *f = NULL; + + while (g) { + f = (struct oscar_file_transfer *)g->data; + if (f->conn == conn) + break; + g = g->next; + f = NULL; + } + + return f; +} + +static struct oscar_file_transfer *find_oft_by_xfer(struct gaim_connection *gc, + struct file_transfer *xfer) { + GSList *g = ((struct oscar_data *)gc->proto_data)->file_transfers; + struct oscar_file_transfer *f = NULL; + + while (g) { + f = (struct oscar_file_transfer *)g->data; + if (f->xfer == xfer) + break; + g = g->next; + f = NULL; + } + + return f; +} + +static struct oscar_file_transfer *find_oft_by_cookie(struct gaim_connection *gc, + const char *cookie) { + GSList *g = ((struct oscar_data *)gc->proto_data)->file_transfers; + struct oscar_file_transfer *f = NULL; + + while (g) { + f = (struct oscar_file_transfer *)g->data; + if (!strncmp(f->cookie, cookie, 8)) + break; + g = g->next; + f = NULL; + } + + return f; +} + static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); @@ -290,6 +371,14 @@ static int gaim_directim_typing (aim_session_t *, aim_frame_t *, ...); static int gaim_update_ui (aim_session_t *, aim_frame_t *, ...); +static int oscar_file_transfer_do(aim_session_t *, aim_frame_t *, ...); +static void oscar_file_transfer_disconnect(aim_session_t *, + aim_conn_t *); +static void oscar_cancel_transfer(struct gaim_connection *, + struct file_transfer *); +static int oscar_sendfile_request(aim_session_t *sess, + struct oscar_file_transfer *oft); + static char *msgerrreason[] = { "Invalid error", "Invalid SNAC", @@ -319,6 +408,26 @@ }; static int msgerrreasonlen = 25; +static void oscar_file_transfer_disconnect(aim_session_t *sess, + aim_conn_t *conn) { + struct gaim_connection *gc = sess->aux_data; + struct oscar_data *od = (struct oscar_data *)gc->proto_data; + struct oscar_file_transfer *oft = find_oft_by_conn(gc, + conn); + + od->file_transfers = g_slist_remove(od->file_transfers, oft); + + if (oft->watcher) { + gaim_input_remove(oft->watcher); + oft->watcher = 0; + } + + aim_conn_kill(sess, &conn); + + g_free(oft->sn); + g_free(oft); +} + static void gaim_directim_disconnect(aim_session_t *sess, aim_conn_t *conn) { struct gaim_connection *gc = sess->aux_data; struct oscar_data *od = (struct oscar_data *)gc->proto_data; @@ -425,6 +534,13 @@ } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) gaim_directim_disconnect(odata->sess, conn); + else if (conn->subtype == AIM_CONN_SUBTYPE_OFT_SENDFILE) { + struct oscar_file_transfer *oft = find_oft_by_conn(gc, conn); + if (oft) { + transfer_abort(oft->xfer, _("Buddy canceled transfer")); + } + oscar_file_transfer_disconnect(odata->sess, conn); + } else { debug_printf("No handler for rendezvous disconnect (%d).\n", source); @@ -463,7 +579,11 @@ aim_conn_t *conn; if (!g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif return; } @@ -559,6 +679,13 @@ odata->direct_ims = g_slist_remove(odata->direct_ims, n); g_free(n); } + while (odata->file_transfers) { + struct oscar_file_transfer *n = odata->file_transfers->data; + if (n->watcher > 0) + gaim_input_remove(n->watcher); + odata->file_transfers = g_slist_remove(odata->file_transfers, n); + g_free(n); + } while (odata->hasicons) { struct icon_req *n = odata->hasicons->data; g_free(n->user); @@ -603,7 +730,11 @@ aim_conn_t *bosconn; if (!g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif return; } @@ -623,6 +754,33 @@ set_login_progress(gc, 4, _("Connection established, cookie sent")); } +static void oscar_ask_send_file(struct gaim_connection *gc, char *destsn) { + struct oscar_data *od = (struct oscar_data *)gc->proto_data; + struct oscar_file_transfer *oft = oft_listening; + + /* Kludge: if we try to send a file to a client that doesn't + * support it, the BOS server sends us back an error without + * any information identifying which transfer was aborted. So + * we only allow one sendfile request at a time, to ensure that + * the transfer referenced by an error is unambiguous. It's ugly, + * but what else can we do? -- wtm + */ + if (oft) { + do_error_dialog(_("Sorry, you already have an outgoing transfer pending. Due to limitations of the Oscar protocol, only one outgoing transfer request is permitted at a time."), NULL, GAIM_ERROR); + } + else { + struct oscar_file_transfer *oft = g_new0(struct oscar_file_transfer, + 1); + + oft->type = OFT_SENDFILE_OUT; + oft->sn = g_strdup(destsn); + + od->file_transfers = g_slist_append(od->file_transfers, oft); + + oft->xfer = transfer_out_add(gc, oft->sn); + } +} + static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; struct aim_authresp_info *info; @@ -770,7 +928,11 @@ int x = 0; unsigned char m[17]; +#ifndef _WIN32 while (read(pos->fd, &in, 1) == 1) { +#else + while (recv(pos->fd, &in, 1, 0) == 1) { +#endif if (in == '\n') x++; else if (in != '\r') @@ -784,18 +946,30 @@ _("You may be disconnected shortly. You may want to use TOC until " "this is fixed. Check " WEBSITE " for updates."), GAIM_WARNING); gaim_input_remove(pos->inpa); +#ifndef _WIN32 close(pos->fd); +#else + closesocket(pos->fd); +#endif g_free(pos); return; } +#ifndef _WIN32 read(pos->fd, m, 16); +#else + recv(pos->fd, m, 16, 0); +#endif m[16] = '\0'; debug_printf("Sending hash: "); for (x = 0; x < 16; x++) debug_printf("%02x ", (unsigned char)m[x]); debug_printf("\n"); gaim_input_remove(pos->inpa); +#ifndef _WIN32 close(pos->fd); +#else + closesocket(pos->fd); +#endif aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); g_free(pos); } @@ -817,7 +991,11 @@ g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", pos->offset, pos->len, pos->modname ? pos->modname : ""); +#ifndef _WIN32 write(pos->fd, buf, strlen(buf)); +#else + send(pos->fd, buf, strlen(buf), 0); +#endif if (pos->modname) g_free(pos->modname); pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); @@ -959,7 +1137,11 @@ aim_conn_t *tstconn; if (!g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif return; } @@ -987,7 +1169,11 @@ aim_conn_t *tstconn; if (!g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif return; } @@ -1016,7 +1202,11 @@ aim_conn_t *tstconn; if (!g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif g_free(ccon->show); g_free(ccon->name); g_free(ccon); @@ -1278,6 +1468,193 @@ oscar_callback, dim->conn); } +static int oscar_sendfile_out_done(aim_session_t *sess, aim_frame_t *fr, ...) { + struct gaim_connection *gc = sess->aux_data; + va_list ap; + aim_conn_t *conn; + const char *cook; + struct oscar_file_transfer *oft; + + va_start(ap, fr); + conn = va_arg(ap, aim_conn_t *); + cook = va_arg(ap, const char *); + va_end(ap); + + oft = find_oft_by_cookie(gc, cook); + if (oft->filesdone == oft->totfiles) + oscar_file_transfer_disconnect(sess, conn); + else + /* Send header for next file */ + oscar_sendfile_request(sess, oft); + + return 0; +} + +/* Called once for each file before sending the raw data. */ +static int oscar_sendfile_request(aim_session_t *sess, + struct oscar_file_transfer *oft) { + char *name; + int size; + + transfer_get_file_info(oft->xfer, &size, &name); + aim_oft_sendfile_request(sess, oft->conn, name, oft->filesdone, + oft->totfiles, size, oft->totsize); + + return 0; +} + +static int oscar_sendfile_accepted(aim_session_t *sess, aim_frame_t *fr, ...) { + struct gaim_connection *gc = sess->aux_data; + struct oscar_data *od = (struct oscar_data *)gc->proto_data; + struct oscar_file_transfer *oft; + va_list ap; + aim_conn_t *conn, *listenerconn; + + alarm(0); /* reset timeout alarm */ + va_start(ap, fr); + conn = va_arg(ap, aim_conn_t *); + listenerconn = va_arg(ap, aim_conn_t *); + va_end(ap); + + oft = find_oft_by_conn(gc, listenerconn); + oft->conn = conn; + /* Stop watching listener conn; watch transfer conn instead */ + gaim_input_remove(oft->watcher); + aim_conn_kill(sess, &listenerconn); + /* We no longer need to block other outgoing transfers. */ + oft_listening = NULL; + + aim_conn_addhandler(od->sess, oft->conn, AIM_CB_FAM_OFT, + AIM_CB_OFT_GETFILEFILESEND, + oscar_file_transfer_do, + 0); + aim_conn_addhandler(sess, conn, + AIM_CB_FAM_OFT, + AIM_CB_OFT_GETFILECOMPLETE, + oscar_sendfile_out_done, + 0); + oft->watcher = gaim_input_add(oft->conn->fd, GAIM_INPUT_READ, + oscar_callback, oft->conn); + + oscar_sendfile_request(sess, oft); + + return 0; +} + +void oscar_sendfile_timeout(int sig) +{ + struct oscar_file_transfer *oft = oft_listening; + + if (oft) { + aim_session_t *sess = aim_conn_getsess(oft->conn); + aim_conn_t *bosconn; + { + /* XXX is this valid? is there a better way? -- wtm */ + struct gaim_connection *gc = sess->aux_data; + struct oscar_data *odata = (struct oscar_data *)gc->proto_data; + bosconn = odata->conn; + } + + oft_listening = NULL; + aim_canceltransfer(sess, bosconn, oft->cookie, + oft->sn, AIM_CAPS_SENDFILE); + + transfer_abort(oft->xfer, _("Transfer timed out")); + oscar_file_transfer_disconnect(sess, oft->conn); + } +} + +/* Called once at the beginning of an outgoing transfer session. */ +static void oscar_start_transfer_out(struct gaim_connection *gc, + struct file_transfer *xfer, const char *name, int totfiles, + int totsize) { + struct oscar_data *od = (struct oscar_data *)gc->proto_data; + struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); + + oft->xfer = xfer; + oft->totsize = totsize; + oft->totfiles = totfiles; + oft->filesdone = 0; + oft_listening = oft; + + oft->conn = aim_sendfile_initiate(od->sess, oft->sn, + name, totfiles, oft->totsize, oft->cookie); + if (!oft->conn) { + do_error_dialog(_("Couldn't open listener to send file"), + _("File transfer aborted"), + GAIM_ERROR); + return; + } + + { + /* XXX is there a good glib-oriented way of doing this? + * -- wtm */ + struct sigaction act; + act.sa_handler = oscar_sendfile_timeout; + act.sa_flags = SA_ONESHOT; + sigemptyset (&act.sa_mask); + sigaction(SIGALRM, &act, NULL); + alarm(OFT_TIMEOUT); + } + + aim_conn_addhandler(od->sess, oft->conn, AIM_CB_FAM_OFT, + AIM_CB_OFT_GETFILEINITIATE, + oscar_sendfile_accepted, + 0); + oft->watcher = gaim_input_add(oft->conn->fd, GAIM_INPUT_READ, + oscar_callback, oft->conn); +} + +static void oscar_transfer_data_chunk(struct gaim_connection *gc, + struct file_transfer *xfer, const char *buf, int len) +{ + struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); + aim_session_t *sess = aim_conn_getsess(oft->conn); + + if (oft->type == OFT_SENDFILE_IN) + aim_update_checksum(sess, oft->conn, buf, len); +} + +static void oscar_start_transfer_in(struct gaim_connection *gc, + struct file_transfer *xfer, int offset) { + struct oscar_data *od = (struct oscar_data *)gc->proto_data; + struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); + + oft->xfer = xfer; + oft->conn = aim_accepttransfer(od->sess, od->conn, oft->sn, + oft->cookie, oft->ip, + oft->port, + AIM_CAPS_SENDFILE); + if (!oft->conn) { + char *buf = g_strdup_printf("Couldn't connect to remote host"); + do_error_dialog(buf, NULL, GAIM_ERROR); + g_free(buf); + return; + } + + aim_conn_addhandler(od->sess, oft->conn, AIM_CB_FAM_OFT, + AIM_CB_OFT_GETFILEFILEREQ, oscar_file_transfer_do, + 0); + + oft->watcher = gaim_input_add(oft->conn->fd, GAIM_INPUT_READ, + oscar_callback, oft->conn); +} + +static void oscar_cancel_transfer(struct gaim_connection *gc, + struct file_transfer *xfer) { + struct oscar_data *od = (struct oscar_data *)gc->proto_data; + struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); + + if (oft->type == OFT_SENDFILE_IN) + aim_denytransfer(od->sess, oft->sn, oft->cookie, + AIM_TRANSFER_DENY_DECLINE); + + od->file_transfers = g_slist_remove(od->file_transfers, oft); + aim_conn_kill(od->sess, &oft->conn); + g_free(oft->sn); + g_free(oft); +} + static int accept_direct_im(gpointer w, struct ask_direct *d) { struct gaim_connection *gc = d->gc; struct oscar_data *od = (struct oscar_data *)gc->proto_data; @@ -1428,8 +1805,26 @@ debug_printf("rendezvous status %d (%s)\n", args->status, userinfo->sn); - if (args->status != AIM_RENDEZVOUS_PROPOSE) + + if (args->status == AIM_RENDEZVOUS_CANCEL) { + struct oscar_file_transfer *oft; + oft = find_oft_by_cookie(gc, args->cookie); + if (oft) { + transfer_abort(oft->xfer, _("Buddy canceled transfer")); + oscar_file_transfer_disconnect(sess, oft->conn); + } + return 0; + } + else if (args->status == AIM_RENDEZVOUS_ACCEPT) { + /* The user accepted our transfer request, but we don't + * really need to do anything yet. + * -- wtm + */ + return 0; + } + else if (args->status != AIM_RENDEZVOUS_PROPOSE) { return 1; + } if (args->reqclass & AIM_CAPS_CHAT) { char *name = extract_name(args->info.chat.roominfo.name); @@ -1446,6 +1841,39 @@ if (name) g_free(name); } else if (args->reqclass & AIM_CAPS_SENDFILE) { + struct oscar_file_transfer *oft; + + if (!args->verifiedip) { + /* It seems that Trillian sends a message + * with no file data during multiple-file + * transfers. + */ + debug_printf("sendfile: didn't get any data\n"); + return -1; + } + + oft = g_new0(struct oscar_file_transfer, 1); + + debug_printf("%s (%s) requests to send a file to %s\n", + userinfo->sn, args->verifiedip, gc->username); + + oft->type = OFT_SENDFILE_IN; + oft->sn = g_strdup(userinfo->sn); + strncpy(oft->ip, args->verifiedip, sizeof(oft->ip)); + oft->port = args->port; + memcpy(oft->cookie, args->cookie, 8); + + { /* XXX ugly... */ + struct gaim_connection *gc = sess->aux_data; + struct oscar_data *od = gc->proto_data; + od->file_transfers = g_slist_append(od->file_transfers, oft); + } + + oft->xfer = transfer_in_add(gc, userinfo->sn, + args->info.sendfile.filename, + args->info.sendfile.totsize, + args->info.sendfile.totfiles, + args->msg); } else if (args->reqclass & AIM_CAPS_GETFILE) { } else if (args->reqclass & AIM_CAPS_VOICE) { } else if (args->reqclass & AIM_CAPS_BUDDYICON) { @@ -1745,6 +2173,34 @@ return g_strdup_printf("Online"); } +static int gaim_parse_clientauto_rend(aim_session_t *sess, + const char *who, int reason, const char *cookie) { + struct gaim_connection *gc = sess->aux_data; + struct oscar_file_transfer *oft; + char *buf; + + switch (reason) { + case 3: /* Decline sendfile. */ + oft = find_oft_by_cookie(gc, cookie); + + if (oft) { + buf = g_strdup_printf(_("%s has declined to receive a file from %s.\n"), + who, gc->username); + alarm(0); /* reset timeout alarm */ + oft_listening = NULL; + transfer_abort(oft->xfer, buf); + g_free(buf); + oscar_file_transfer_disconnect(sess, oft->conn); + } + break; + default: + debug_printf("Received an unknown rendezvous client auto-response from %s. Type 0x%04x\n", who, reason); + + } + + return 0; +} + static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { struct gaim_connection *gc = sess->aux_data; va_list ap; @@ -1756,6 +2212,14 @@ who = va_arg(ap, char *); reason = (fu16_t)va_arg(ap, unsigned int); + if (chan == 2) { + char *cookie = va_arg(ap, char *); + va_end(va); + + return gaim_parse_clientauto_rend(sess, who, reason, + cookie); + } + switch(reason) { case 0x0003: { /* Reply from an ICQ status message request */ int state = (int)va_arg(ap, fu32_t); @@ -1827,12 +2291,27 @@ char *destn; fu16_t reason; char buf[1024]; + struct oscar_file_transfer *oft = oft_listening; va_start(ap, fr); reason = (fu16_t)va_arg(ap, unsigned int); destn = va_arg(ap, char *); va_end(ap); + if (oft) { + /* If we try to send a file but it isn't supported, then + * we get this error without any information identifying + * the failed connection. So we can only have one outgoing + * transfer at a time. Ugh. -- wtm + */ + oft_listening = NULL; + transfer_abort(oft->xfer, + (reason < msgerrreasonlen) ? msgerrreason[reason] : _("No reason was given.")); + + oscar_file_transfer_disconnect(sess, oft->conn); + return 1; + } + snprintf(buf, sizeof(buf), _("Your message to %s did not get sent:"), destn); do_error_dialog(buf, (reason < msgerrreasonlen) ? msgerrreason[reason] : _("No reason was given."), GAIM_ERROR); @@ -2806,7 +3285,12 @@ } else if (len != -1) { /* Trying to send an IM image outside of a direct connection. */ oscar_ask_direct_im(gc, name); +#ifndef _WIN32 return -ENOTCONN; +#else + WSASetLastError( WSAENOTCONN ); + return SOCKET_ERROR; +#endif } if (imflags & IM_FLAG_AWAY) { ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message); @@ -3538,6 +4022,80 @@ return NULL; } +void oscar_transfer_nextfile(struct gaim_connection *gc, + struct file_transfer *xfer) { + struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); + aim_conn_t *conn = oft->conn; + aim_session_t *sess = aim_conn_getsess(conn); + + oft->filesdone++; + oft->watcher = gaim_input_add(conn->fd, GAIM_INPUT_READ, + oscar_callback, conn); + + /* If this is an incoming sendfile transfer, we send an OK + * message to the sender; if this is an outgoing sendfile, we + * will get an OK from the receiver that will be handled in + * oscar_sendfile_out_done(), so we don't need to do anything + * yet. + */ + + if (oft->type == OFT_SENDFILE_IN) + aim_oft_end(sess, conn); +} + +void oscar_transfer_done(struct gaim_connection *gc, + struct file_transfer *xfer) { + struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); + aim_conn_t *conn = oft->conn; + aim_session_t *sess = aim_conn_getsess(conn); + + oft->filesdone++; + if (oft->type == OFT_SENDFILE_IN) { + aim_oft_end(sess, conn); + oscar_file_transfer_disconnect(sess, conn); + } + else if (oft->type == OFT_SENDFILE_OUT) { +#if 0 + /* Wait for response before closing connection. */ + oft->watcher = gaim_input_add(conn->fd, GAIM_INPUT_READ, + oscar_callback, conn); +#else + oscar_file_transfer_disconnect(sess, conn); +#endif + } +} + +static int oscar_file_transfer_do(aim_session_t *sess, aim_frame_t *fr, ...) { + struct gaim_connection *gc = sess->aux_data; + va_list ap; + aim_conn_t *conn; + struct oscar_file_transfer *oft; + + va_start(ap, fr); + conn = va_arg(ap, aim_conn_t *); + + oft = find_oft_by_conn(gc, conn); + + /* Don't use the regular input handler for the raw data. */ + gaim_input_remove(oft->watcher); + oft->watcher = 0; + + if (oft->type == OFT_SENDFILE_IN) { + const char *name = va_arg(ap, const char *); + int size = va_arg(ap, int); + if (transfer_in_do(oft->xfer, conn->fd, name, size)) + oscar_file_transfer_disconnect(sess, oft->conn); + } + else { + int offset = va_arg(ap, int); + if (transfer_out_do(oft->xfer, conn->fd, offset)) + oscar_file_transfer_disconnect(sess, oft->conn); + } + va_end(ap); + + return 0; +} + static int gaim_directim_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; struct gaim_connection *gc = sess->aux_data; @@ -3766,6 +4324,12 @@ pbm->gc = gc; m = g_list_append(m, pbm); } + + pbm = g_new0(struct proto_buddy_menu, 1); + pbm->label = _("Send File"); + pbm->callback = oscar_ask_send_file; + pbm->gc = gc; + m = g_list_append(m, pbm); } pbm = g_new0(struct proto_buddy_menu, 1); @@ -4015,7 +4579,7 @@ static struct prpl *my_protocol = NULL; -void oscar_init(struct prpl *ret) { +G_MODULE_EXPORT void oscar_init(struct prpl *ret) { struct proto_user_opt *puo; ret->protocol = PROTO_OSCAR; ret->options = OPT_PROTO_BUDDY_ICON | OPT_PROTO_IM_IMAGE; @@ -4043,6 +4607,12 @@ ret->add_buddies = oscar_add_buddies; ret->group_buddy = oscar_move_buddy; ret->rename_group = oscar_rename_group; + ret->file_transfer_cancel = oscar_cancel_transfer; + ret->file_transfer_in = oscar_start_transfer_in; + ret->file_transfer_out = oscar_start_transfer_out; + ret->file_transfer_data_chunk = oscar_transfer_data_chunk; + ret->file_transfer_nextfile = oscar_transfer_nextfile; + ret->file_transfer_done = oscar_transfer_done; ret->remove_buddy = oscar_remove_buddy; ret->remove_buddies = oscar_remove_buddies; ret->add_permit = oscar_add_permit; @@ -4077,7 +4647,7 @@ #ifndef STATIC -void *gaim_prpl_init(struct prpl *prpl) +G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl) { oscar_init(prpl); prpl->plug->desc.api_version = PLUGIN_API_VERSION; Index: ssi.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/ssi.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- ssi.c 6 Oct 2002 03:08:47 -0000 1.14 +++ ssi.c 11 Oct 2002 03:14:01 -0000 1.15 @@ -500,7 +500,7 @@ /* Look up the parent group */ if (!(parentgroup = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, gn, AIM_SSI_TYPE_GROUP))) { - aim_ssi_addgroups(sess, conn, &gn, 1); + aim_ssi_addgroups(sess, conn, (const char **)&gn, 1); if (!(parentgroup = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, gn, AIM_SSI_TYPE_GROUP))) return -ENOMEM; } Index: txqueue.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/txqueue.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- txqueue.c 15 Mar 2002 00:56:15 -0000 1.5 +++ txqueue.c 11 Oct 2002 03:14:01 -0000 1.6 @@ -10,6 +10,8 @@ #ifndef _WIN32 #include <sys/socket.h> +#else +#include "win32dep.h" #endif /* @@ -24,7 +26,7 @@ * chan = channel for FLAP, hdrtype for OFT * */ -faim_internal aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, fu8_t framing, fu8_t chan, int datalen) +faim_internal aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, fu8_t framing, fu16_t chan, int datalen) { aim_frame_t *fr; |
From: Rob F. <rob...@us...> - 2002-10-11 03:14:05
|
Update of /cvsroot/gaim/gaim/src/protocols/toc In directory usw-pr-cvs1:/tmp/cvs-serv28946/src/protocols/toc Modified Files: toc.c Added Files: Makefile.mingw Log Message: Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. --- NEW FILE: Makefile.mingw --- # # Makefile.mingw # # Description: Makefile for win32 (mingw) version of libtoc # # # PATHS # INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. TOC_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir ## ## VARIABLE DEFINITIONS ## TARGET = libtoc VERSION := $(shell cat $(GAIM_TOP)/VERSION) # Compiler Options CC = gcc CFLAGS = -O2 -Werror -Wall -mno-cygwin -fnative-struct DEFINES = -DAIM_BUILDDATE=\"`date +%Y%m%d`\" \ -DAIM_BUILDTIME=\"`date +%H%M%S`\" \ -DVERSION=\"$(VERSION)\" \ -DHAVE_CONFIG_H # Static or Plugin... ifeq ($(TYPE),STATIC) DEFINES += -DSTATIC DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR) else ifeq ($(TYPE),PLUGIN) DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR)/plugins endif endif ## ## INCLUDE MAKEFILES ## ## ## INCLUDE PATHS ## INCLUDE_PATHS += -I$(TOC_ROOT) \ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/include/pango-1.0 \ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ -I$(GAIM_TOP)/src \ -I$(GAIM_TOP)/src/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(GAIM_TOP)/src ## ## SOURCES, OBJECTS ## C_SRC = toc.c OBJECTS = $(C_SRC:%.c=%.o) ## ## LIBRARIES ## LIBS = -lgtk-win32-2.0 -lglib-2.0 -lgdk-win32-2.0 -lgmodule-2.0 -lgobject-2.0 -lws2_32 -lintl -lgaim # -liberty ## ## RULES ## # How to make a C file %.o: %.c $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@ -c $< ## ## TARGET DEFINITIONS ## .PHONY: all clean all: $(TARGET).dll install: cp $(TOC_ROOT)/$(TARGET).dll $(DLL_INSTALL_DIR) ## ## BUILD Dependencies ## $(GAIM_TOP)/src/gaim.lib: $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib ## ## BUILD DLL ## $(TARGET).def: $(OBJECTS) dlltool --dllname $(TARGET).dll -z $(TARGET).def \ $(OBJECTS) $(TARGET).base: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib gcc -mdll -o junk.tmp -Wl,--base-file,$@ $(OBJECTS) $(LIB_PATHS) $(LIBS) rm -rf junk.tmp $(TARGET).exp: $(TARGET).def $(TARGET).base dlltool --dllname $(TARGET).dll --base-file $(TARGET).base \ --output-exp $(TARGET).exp --def $(TARGET).def rm -rf $(TARGET).base $(TARGET).dll: $(OBJECTS) $(TARGET).exp $(GAIM_TOP)/src/gaim.lib dlltool -D $(TARGET).dll -d $(TARGET).def -l $(TARGET).lib gcc -mdll -o $(TARGET).dll $(OBJECTS) -Wl,$(TARGET).exp $(LIB_PATHS) $(LIBS) rm -rf $(TARGET).exp ## ## CLEAN RULES ## clean: rm -rf *.o rm -rf $(TARGET).dll rm -rf $(TARGET).lib rm -rf $(TARGET).def Index: toc.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/toc/toc.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- toc.c 30 Sep 2002 01:05:18 -0000 1.53 +++ toc.c 11 Oct 2002 03:14:01 -0000 1.54 @@ -24,17 +24,23 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif + +#ifndef _WIN32 #include <netdb.h> -#include <gtk/gtk.h> #include <unistd.h> -#include <errno.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <sys/socket.h> +#else +#include <winsock.h> +#endif + +#include <gtk/gtk.h> +#include <errno.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <time.h> -#include <sys/socket.h> #include <sys/types.h> #include <sys/stat.h> #include "prpl.h" @@ -42,6 +48,10 @@ #include "gaim.h" #include "proxy.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + #include "pixmaps/protocols/oscar/admin_icon.xpm" #include "pixmaps/protocols/oscar/aol_icon.xpm" #include "pixmaps/protocols/oscar/away_icon.xpm" @@ -49,6 +59,9 @@ #include "pixmaps/protocols/oscar/free_icon.xpm" #include "pixmaps/protocols/oscar/wireless_icon.xpm" +/* for win32 compatability */ +G_MODULE_IMPORT GSList *connections; + #define REVISION "penguin" #define TYPE_SIGNON 1 @@ -134,6 +147,36 @@ static void toc_callback(gpointer, gint, GaimInputCondition); static void accept_file_dialog(struct ft_request *); +/* The following were added for win32 port - Herman */ + +int toc_write(int fd, const void *buffer, int len) +{ +#ifndef _WIN32 + return write(fd, buffer, len); +#else + return send(fd, buffer, len, 0); +#endif +} + +int toc_read(int fd, void *buffer, int size) +{ +#ifndef _WIN32 + return read(fd, buffer, size); +#else + return recv(fd, buffer, size, 0); +#endif +} + +int toc_soc_close( int fd ) +{ +#ifndef _WIN32 + return close(fd); +#else + return closesocket(fd); +#endif +} + + /* ok. this function used to take username/password, and return 0 on success. * now, it takes username/password, and returns NULL on error or a new gaim_connection * on success. */ @@ -173,7 +216,7 @@ char buf[80]; if (!g_slist_find(connections, data)) { - close(source); + toc_soc_close(source); return; } @@ -190,7 +233,7 @@ tdt->toc_fd = source; debug_printf("* Client sends \"FLAPON\\r\\n\\r\\n\"\n"); - if (write(tdt->toc_fd, FLAPON, strlen(FLAPON)) < 0) { + if (toc_write(tdt->toc_fd, FLAPON, strlen(FLAPON)) < 0) { hide_login_progress(gc, "Disconnected."); signoff(gc); return; @@ -211,7 +254,7 @@ if (gc->inpa > 0) gaim_input_remove(gc->inpa); gc->inpa = 0; - close(((struct toc_data *)gc->proto_data)->toc_fd); + toc_soc_close(((struct toc_data *)gc->proto_data)->toc_fd); g_free(gc->proto_data); } @@ -327,7 +370,7 @@ slen += 1; } - return write(tdt->toc_fd, obuf, slen); + return toc_write(tdt->toc_fd, obuf, slen); } static int wait_reply(struct gaim_connection *gc, char *buffer, size_t buflen) @@ -336,7 +379,7 @@ struct sflap_hdr *hdr; int ret; - if (read(tdt->toc_fd, buffer, sizeof(struct sflap_hdr)) < 0) { + if (toc_read(tdt->toc_fd, buffer, sizeof(struct sflap_hdr)) < 0) { debug_printf("error, couldn't read flap header\n"); return -1; } @@ -354,7 +397,7 @@ ret = 0; do { count += ret; - ret = read(tdt->toc_fd, + ret = toc_read(tdt->toc_fd, buffer + sizeof(struct sflap_hdr) + count, ntohs(hdr->len) - count); } while (count + ret < ntohs(hdr->len) && ret > 0); buffer[sizeof(struct sflap_hdr) + count + ret] = '\0'; @@ -1356,7 +1399,7 @@ static struct prpl *my_protocol = NULL; -void toc_init(struct prpl *ret) +G_MODULE_EXPORT void toc_init(struct prpl *ret) { struct proto_user_opt *puo; ret->protocol = PROTO_TOC; @@ -1413,7 +1456,7 @@ #ifndef STATIC -void *gaim_prpl_init(struct prpl *prpl) +G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl) { toc_init(prpl); prpl->plug->desc.api_version = PLUGIN_API_VERSION; @@ -1516,8 +1559,8 @@ char *buf; frombase64(ft->cookie, &buf, NULL); - read(source, ft, 8); - read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); + toc_read(source, ft, 8); + toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); debug_header(ft); ft->hdr.hdrtype = 0x202; @@ -1525,7 +1568,7 @@ g_free(buf); ft->hdr.encrypt = 0; ft->hdr.compress = 0; debug_header(ft); - write(source, ft, 256); + toc_write(source, ft, 256); if (ft->files == 1) { ft->file = fopen(ft->filename, "w"); @@ -1534,7 +1577,7 @@ do_error_dialog(buf, strerror(errno), GAIM_ERROR); g_free(buf); gaim_input_remove(ft->inpa); - close(source); + toc_soc_close(source); g_free(ft->filename); g_free(ft->user); g_free(ft->ip); @@ -1551,7 +1594,7 @@ do_error_dialog(buf, strerror(errno), GAIM_ERROR); g_free(buf); gaim_input_remove(ft->inpa); - close(source); + toc_soc_close(source); g_free(ft->filename); g_free(ft->user); g_free(ft->ip); @@ -1563,11 +1606,11 @@ return; } - rt = read(source, buf, MIN(ntohl(ft->hdr.size) - ft->recvsize, 1024)); + rt = toc_read(source, buf, MIN(ntohl(ft->hdr.size) - ft->recvsize, 1024)); if (rt < 0) { do_error_dialog("File transfer failed; other side probably canceled.", NULL, GAIM_ERROR); gaim_input_remove(ft->inpa); - close(source); + toc_soc_close(source); g_free(ft->user); g_free(ft->ip); g_free(ft->cookie); @@ -1587,13 +1630,13 @@ ft->hdr.recvcsum = ft->hdr.checksum; /* uh... */ ft->hdr.nrecvd = htons(ntohs(ft->hdr.nrecvd) + 1); ft->hdr.flags = 0; - write(source, ft, 256); + toc_write(source, ft, 256); debug_header(ft); ft->recvsize = 0; fclose(ft->file); if (ft->hdr.filesleft == 0) { gaim_input_remove(ft->inpa); - close(source); + toc_soc_close(source); g_free(ft->filename); g_free(ft->user); g_free(ft->ip); @@ -1671,7 +1714,7 @@ int i; for (i = 0; i < remain; i++) fscanf(ft->file, "%c", &buf[i]); - write(source, buf, remain); + toc_write(source, buf, remain); ft->recvsize += remain; if (ft->recvsize == ntohl(ft->hdr.totsize)) { gaim_input_remove(ft->inpa); @@ -1685,8 +1728,8 @@ struct tm *fortime; struct stat st; - read(source, ft, 8); - read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); + toc_read(source, ft, 8); + toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); debug_header(ft); stat(ft->filename, &st); @@ -1695,27 +1738,27 @@ fortime->tm_mon + 1, fortime->tm_mday, fortime->tm_year + 1900, fortime->tm_hour + 1, fortime->tm_min + 1, (long)st.st_size, g_basename(ft->filename)); - write(source, buf, ntohl(ft->hdr.size)); + toc_write(source, buf, ntohl(ft->hdr.size)); return; } if (ft->hdr.hdrtype == htons(0x1209)) { - read(source, ft, 8); - read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); + toc_read(source, ft, 8); + toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); debug_header(ft); return; } if (ft->hdr.hdrtype == htons(0x120b)) { - read(source, ft, 8); - read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); + toc_read(source, ft, 8); + toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); debug_header(ft); if (ft->hdr.hdrtype != htons(0x120c)) { g_snprintf(buf, sizeof(buf), "%s decided to cancel the transfer", ft->user); do_error_dialog(buf, NULL, GAIM_ERROR); gaim_input_remove(ft->inpa); - close(source); + toc_soc_close(source); g_free(ft->filename); g_free(ft->user); g_free(ft->ip); @@ -1729,13 +1772,13 @@ ft->hdr.hdrtype = 0x0101; ft->hdr.totfiles = htons(1); ft->hdr.filesleft = htons(1); ft->hdr.flags = 0x20; - write(source, ft, 256); + toc_write(source, ft, 256); return; } if (ft->hdr.hdrtype == 0x0101) { - read(source, ft, 8); - read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); + toc_read(source, ft, 8); + toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); debug_header(ft); gaim_input_remove(ft->inpa); @@ -1745,12 +1788,12 @@ } if (ft->hdr.hdrtype == 0x0202) { - read(source, ft, 8); - read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); + toc_read(source, ft, 8); + toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); debug_header(ft); gaim_input_remove(ft->inpa); - close(source); + toc_soc_close(source); g_free(ft->filename); g_free(ft->user); g_free(ft->ip); @@ -1798,7 +1841,7 @@ hdr->lnameoffset = 0x1A; hdr->lsizeoffset = 0x10; g_snprintf(hdr->name, 64, "listing.txt"); - if (write(src, hdr, 256) < 0) { + if (toc_write(src, hdr, 256) < 0) { do_error_dialog(_("Could not write file header. The file will not be transferred."), NULL, GAIM_ERROR); fclose(ft->file); g_free(ft->filename); @@ -1889,7 +1932,7 @@ ft->files = fr->files; ft->window = window = gtk_file_selection_new(_("Gaim - Save As...")); - g_snprintf(buf, sizeof(buf), "%s/%s", g_get_home_dir(), fr->filename ? fr->filename : ""); + g_snprintf(buf, sizeof(buf), "%s/%s", gaim_home_dir(), fr->filename ? fr->filename : ""); gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(cancel_callback), ft); |
From: Rob F. <rob...@us...> - 2002-10-11 03:14:04
|
Update of /cvsroot/gaim/gaim/src/protocols/zephyr In directory usw-pr-cvs1:/tmp/cvs-serv28946/src/protocols/zephyr Modified Files: ZVariables.c zephyr.c Log Message: Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. Index: ZVariables.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZVariables.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ZVariables.c 31 Jul 2001 01:00:39 -0000 1.1 +++ ZVariables.c 11 Oct 2002 03:14:01 -0000 1.2 @@ -118,7 +118,7 @@ char *envptr; struct passwd *pwd; - envptr = getenv("HOME"); + envptr = gaim_home_dir(); if (envptr) (void) strcpy(bfr, envptr); else { Index: zephyr.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/zephyr.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- zephyr.c 30 Sep 2002 01:05:18 -0000 1.25 +++ zephyr.c 11 Oct 2002 03:14:01 -0000 1.26 @@ -86,17 +86,17 @@ /* just for debugging static void handle_unknown(ZNotice_t notice) { - g_print("z_packet: %s\n", notice.z_packet); - g_print("z_version: %s\n", notice.z_version); - g_print("z_kind: %d\n", notice.z_kind); - g_print("z_class: %s\n", notice.z_class); - g_print("z_class_inst: %s\n", notice.z_class_inst); - g_print("z_opcode: %s\n", notice.z_opcode); - g_print("z_sender: %s\n", notice.z_sender); - g_print("z_recipient: %s\n", notice.z_recipient); - g_print("z_message: %s\n", notice.z_message); - g_print("z_message_len: %d\n", notice.z_message_len); - g_print("\n"); + debug_printf("z_packet: %s\n", notice.z_packet); + debug_printf("z_version: %s\n", notice.z_version); + debug_printf("z_kind: %d\n", notice.z_kind); + debug_printf("z_class: %s\n", notice.z_class); + debug_printf("z_class_inst: %s\n", notice.z_class_inst); + debug_printf("z_opcode: %s\n", notice.z_opcode); + debug_printf("z_sender: %s\n", notice.z_sender); + debug_printf("z_recipient: %s\n", notice.z_recipient); + debug_printf("z_message: %s\n", notice.z_message); + debug_printf("z_message_len: %d\n", notice.z_message_len); + debug_printf("\n"); } */ @@ -499,7 +499,7 @@ gchar *fname; gchar buff[BUFSIZ]; - fname = g_strdup_printf("%s/.zephyr.subs", g_getenv("HOME")); + fname = g_strdup_printf("%s/.zephyr.subs", gaim_home_dir()); f = fopen(fname, "r"); if (f) { char **triple; @@ -566,7 +566,7 @@ FILE *fd; gchar buff[BUFSIZ], *filename; - filename = g_strconcat(g_get_home_dir(), "/.anyone", NULL); + filename = g_strconcat(gaim_home_dir(), "/.anyone", NULL); if ((fd = fopen(filename, "r")) != NULL) { while (fgets(buff, BUFSIZ, fd)) { strip_comments(buff); @@ -623,7 +623,7 @@ char *fname; char** triple; - fname = g_strdup_printf("%s/.zephyr.subs", g_get_home_dir()); + fname = g_strdup_printf("%s/.zephyr.subs", gaim_home_dir()); fd = fopen(fname, "w"); if (!fd) { @@ -660,7 +660,7 @@ char *ptr, *fname, *ptr2; FILE *fd; - fname = g_strdup_printf("%s/.anyone", g_get_home_dir()); + fname = g_strdup_printf("%s/.anyone", gaim_home_dir()); fd = fopen(fname, "w"); if (!fd) { g_free(fname); |
From: Rob F. <rob...@us...> - 2002-10-11 03:14:04
|
Update of /cvsroot/gaim/gaim/src/protocols/yahoo In directory usw-pr-cvs1:/tmp/cvs-serv28946/src/protocols/yahoo Modified Files: yahoo.c Added Files: Makefile.mingw Log Message: Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. --- NEW FILE: Makefile.mingw --- # # Makefile.mingw # # Description: Makefile for win32 (mingw) version of libyahoo # # # PATHS # BUILD_TOOLS = /usr/local/mingw INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. YAHOO_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir ## ## VARIABLE DEFINITIONS ## TARGET = libyahoo VERSION := $(shell cat $(GAIM_TOP)/VERSION) # Compiler Options GCOPTS = -B $(BUILD_TOOLS) CC = gcc.exe $(GCOPTS) CFLAGS = -O2 -Werror -Wall -mno-cygwin -fnative-struct DEFINES = -DAIM_BUILDDATE=\"`date +%Y%m%d`\" \ -DAIM_BUILDTIME=\"`date +%H%M%S`\" \ -DVERSION=\"$(VERSION)\" \ -DHAVE_CONFIG_H # Static or Plugin... ifeq ($(TYPE),STATIC) DEFINES += -DSTATIC DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR) else ifeq ($(TYPE),PLUGIN) DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR)/plugins endif endif ## ## INCLUDE MAKEFILES ## ## ## INCLUDE PATHS ## INCLUDE_PATHS += -I$(YAHOO_ROOT) \ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/include/pango-1.0 \ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ -I$(GAIM_TOP)/src \ -I$(GAIM_TOP)/src/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(GAIM_TOP)/src ## ## SOURCES, OBJECTS ## C_SRC = yahoo.c \ crypt.c OBJECTS = $(C_SRC:%.c=%.o) ## ## LIBRARIES ## LIBS = -lgtk-win32-2.0 -lglib-2.0 -lgdk-win32-2.0 -lgmodule-2.0 -lgobject-2.0 -lws2_32 -lintl -lgaim # -liberty ## ## RULES ## # How to make a C file %.o: %.c $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@ -c $< ## ## TARGET DEFINITIONS ## .PHONY: all clean all: $(TARGET).dll install: cp $(YAHOO_ROOT)/$(TARGET).dll $(DLL_INSTALL_DIR) ## ## BUILD Dependencies ## $(GAIM_TOP)/src/gaim.lib: $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib ## ## BUILD DLL ## $(TARGET).def: $(OBJECTS) dlltool --dllname $(TARGET).dll -z $(TARGET).def \ $(OBJECTS) $(TARGET).base: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib gcc -mdll -o junk.tmp -Wl,--base-file,$@ $(OBJECTS) $(LIB_PATHS) $(LIBS) rm -rf junk.tmp $(TARGET).exp: $(TARGET).def $(TARGET).base dlltool --dllname $(TARGET).dll --base-file $(TARGET).base \ --output-exp $(TARGET).exp --def $(TARGET).def rm -rf $(TARGET).base $(TARGET).dll: $(OBJECTS) $(TARGET).exp $(GAIM_TOP)/src/gaim.lib dlltool -D $(TARGET).dll -d $(TARGET).def -l $(TARGET).lib gcc -mdll -o $(TARGET).dll $(OBJECTS) -Wl,$(TARGET).exp $(LIB_PATHS) $(LIBS) rm -rf $(TARGET).exp ## ## CLEAN RULES ## clean: rm -rf *.o rm -rf $(TARGET).dll rm -rf $(TARGET).lib rm -rf $(TARGET).def Index: yahoo.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/yahoo/yahoo.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- yahoo.c 6 Oct 2002 05:01:50 -0000 1.52 +++ yahoo.c 11 Oct 2002 03:14:01 -0000 1.53 @@ -24,17 +24,21 @@ #include "config.h" #endif - +#ifndef _WIN32 #include <netdb.h> #include <unistd.h> -#include <errno.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <sys/socket.h> +#else +#include <winsock.h> +#endif + +#include <errno.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <time.h> -#include <sys/socket.h> #include <sys/stat.h> #include <ctype.h> #include "multi.h" @@ -43,8 +47,15 @@ #include "proxy.h" #include "md5.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + extern char *yahoo_crypt(char *, char *); +/* for win32 compatability */ +G_MODULE_IMPORT GSList *connections; + #include "pixmaps/status-away.xpm" #include "pixmaps/status-here.xpm" #include "pixmaps/status-idle.xpm" @@ -354,8 +365,11 @@ yahoo_packet_write(pkt, data + pos); yahoo_packet_dump(data, len); +#ifndef _WIN32 ret = write(yd->fd, data, len); - +#else + ret = send(yd->fd, data, len, 0); +#endif g_free(data); return ret; @@ -877,9 +891,19 @@ char buf[1024]; int len; +#ifndef _WIN32 len = read(yd->fd, buf, sizeof(buf)); +#else + len = recv(yd->fd, buf, sizeof(buf), 0); +#endif if (len <= 0) { +#ifdef _WIN32 + if(len == SOCKET_ERROR) + debug_printf("Error reading socket: %d\n", WSAGetLastError()); + else if( len == 0 ) + debug_printf("Connection was gracefully closed.\n"); +#endif hide_login_progress_error(gc, "Unable to read"); signoff(gc); return; @@ -941,7 +965,11 @@ struct yahoo_packet *pkt; if (!g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif return; } @@ -1009,7 +1037,11 @@ g_hash_table_foreach_remove(yd->games, yahoo_destroy_hash, NULL); g_hash_table_destroy(yd->games); if (yd->fd >= 0) +#ifndef _WIN32 close(yd->fd); +#else + closesocket(yd->fd); +#endif if (yd->rxqueue) g_free(yd->rxqueue); yd->rxlen = 0; @@ -1410,7 +1442,7 @@ static struct prpl *my_protocol = NULL; -void yahoo_init(struct prpl *ret) { +G_MODULE_EXPORT void yahoo_init(struct prpl *ret) { struct proto_user_opt *puo; ret->protocol = PROTO_YAHOO; ret->options = OPT_PROTO_MAIL_CHECK; @@ -1448,7 +1480,7 @@ #ifndef STATIC -void *gaim_prpl_init(struct prpl *prpl) +G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl) { yahoo_init(prpl); prpl->plug->desc.api_version = PLUGIN_API_VERSION; |
From: Rob F. <rob...@us...> - 2002-10-11 03:14:04
|
Update of /cvsroot/gaim/gaim/src/win32 In directory usw-pr-cvs1:/tmp/cvs-serv28946/src/win32 Added Files: MinimizeToTray.c MinimizeToTray.h StdAfx.h resource.h win32dep.c win32dep.h Log Message: Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. --- NEW FILE: MinimizeToTray.c --- /* MinimizeToTray * * A couple of routines to show how to make it produce a custom caption * animation to make it look like we are minimizing to and maximizing * from the system tray * * These routines are public domain, but it would be nice if you dropped * me a line if you use them! * * 1.0 29.06.2000 Initial version * 1.1 01.07.2000 The window retains it's place in the Z-order of windows * when minimized/hidden. This means that when restored/shown, it doen't * always appear as the foreground window unless we call SetForegroundWindow * * Copyright 2000 Matthew Ellis <m.t...@bi...> */ #include "stdafx.h" #ifndef IDANI_OPEN #define IDANI_OPEN 1 #endif #ifndef IDANI_CLOSE #define IDANI_CLOSE 2 #endif #ifndef IDANI_CAPTION #define IDANI_CAPTION 3 #endif #define DEFAULT_RECT_WIDTH 150 #define DEFAULT_RECT_HEIGHT 30 static void GetTrayWndRect(LPRECT lpTrayRect) { APPBARDATA appBarData; HWND hShellTrayWnd=FindWindowEx(NULL,NULL,TEXT("Shell_TrayWnd"),NULL); if(hShellTrayWnd) { HWND hTrayNotifyWnd=FindWindowEx(hShellTrayWnd,NULL,TEXT("TrayNotifyWnd"),NULL); if(hTrayNotifyWnd) { GetWindowRect(hTrayNotifyWnd,lpTrayRect); return; } } appBarData.cbSize=sizeof(appBarData); if(SHAppBarMessage(ABM_GETTASKBARPOS,&appBarData)) { switch(appBarData.uEdge) { case ABE_LEFT: case ABE_RIGHT: lpTrayRect->top=appBarData.rc.bottom-100; lpTrayRect->bottom=appBarData.rc.bottom-16; lpTrayRect->left=appBarData.rc.left; lpTrayRect->right=appBarData.rc.right; break; case ABE_TOP: case ABE_BOTTOM: lpTrayRect->top=appBarData.rc.top; lpTrayRect->bottom=appBarData.rc.bottom; lpTrayRect->left=appBarData.rc.right-100; lpTrayRect->right=appBarData.rc.right-16; break; } return; } hShellTrayWnd=FindWindowEx(NULL,NULL,TEXT("Shell_TrayWnd"),NULL); if(hShellTrayWnd) { GetWindowRect(hShellTrayWnd,lpTrayRect); if(lpTrayRect->right-lpTrayRect->left>DEFAULT_RECT_WIDTH) lpTrayRect->left=lpTrayRect->right-DEFAULT_RECT_WIDTH; if(lpTrayRect->bottom-lpTrayRect->top>DEFAULT_RECT_HEIGHT) lpTrayRect->top=lpTrayRect->bottom-DEFAULT_RECT_HEIGHT; return; } SystemParametersInfo(SPI_GETWORKAREA,0,lpTrayRect,0); lpTrayRect->left=lpTrayRect->right-DEFAULT_RECT_WIDTH; lpTrayRect->top=lpTrayRect->bottom-DEFAULT_RECT_HEIGHT; } static int GetDoAnimateMinimize(void) { ANIMATIONINFO ai; ai.cbSize=sizeof(ai); SystemParametersInfo(SPI_GETANIMATION,sizeof(ai),&ai,0); return ai.iMinAnimate?TRUE:FALSE; } void MinimizeWndToTray(HWND hWnd) { if(GetDoAnimateMinimize()) { RECT rcFrom,rcTo; GetWindowRect(hWnd,&rcFrom); GetTrayWndRect(&rcTo); DrawAnimatedRects(hWnd,IDANI_CAPTION,&rcFrom,&rcTo); } ShowWindow(hWnd,SW_HIDE); } void RestoreWndFromTray(HWND hWnd) { if(GetDoAnimateMinimize()) { RECT rcFrom,rcTo; GetTrayWndRect(&rcFrom); GetWindowRect(hWnd,&rcTo); DrawAnimatedRects(hWnd,IDANI_CAPTION,&rcFrom,&rcTo); } ShowWindow(hWnd,SW_SHOW); SetActiveWindow(hWnd); SetForegroundWindow(hWnd); } --- NEW FILE: MinimizeToTray.h --- #ifndef _MINIMIZE_TO_TRAY_H_ #define _MINIMIZE_TO_TRAY_H_ void MinimizeWndToTray(HWND hWnd); void RestoreWndFromTray(HWND hWnd); #endif /* _MINIMIZE_TO_TRAY_H_ */ --- NEW FILE: StdAfx.h --- // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) #define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include <windows.h> #include <shellapi.h> // TODO: reference additional headers your program requires here //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) --- NEW FILE: resource.h --- #define IDI_ICON2 104 --- NEW FILE: win32dep.c --- /* * win32dep.c * * Author: Herman Bloggs <her...@ya...> * Date: June, 2002 * Description: Windows dependant code for Gaim */ #include <windows.h> #include <stdlib.h> #include <stdio.h> #include <glib.h> #include "gaim.h" #include "stdafx.h" #include "resource.h" /* * DEFINES & MACROS */ #define WM_TRAYMESSAGE WM_USER #define GAIM_SYSTRAY_HINT "Gaim Instant Messenger" /* * LOCALS */ static char install_dir[MAXPATHLEN]; static char lib_dir[MAXPATHLEN]; static char locale_dir[MAXPATHLEN]; static int bhide_icon; /* * GLOBALS */ HINSTANCE g_hInstance = 0; /* * STATIC CODE */ static void ShowNotifyIcon(HWND hWnd,BOOL bAdd) { NOTIFYICONDATA nid; ZeroMemory(&nid,sizeof(nid)); nid.cbSize=sizeof(NOTIFYICONDATA); nid.hWnd=hWnd; nid.uID=0; nid.uFlags=NIF_ICON | NIF_MESSAGE | NIF_TIP; nid.uCallbackMessage=WM_TRAYMESSAGE; nid.hIcon=LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON2)); lstrcpy(nid.szTip,TEXT(GAIM_SYSTRAY_HINT)); if(bAdd) Shell_NotifyIcon(NIM_ADD,&nid); else Shell_NotifyIcon(NIM_DELETE,&nid); } static GdkFilterReturn traymsg_filter_func( GdkXEvent *xevent, GdkEvent *event, gpointer data) { MSG *msg = (MSG*)xevent; if( msg->lParam == WM_LBUTTONDBLCLK ) { RestoreWndFromTray(msg->hwnd); bhide_icon = TRUE; return GDK_FILTER_REMOVE; } if( msg->lParam == WM_LBUTTONUP ) { if(bhide_icon) { ShowNotifyIcon(msg->hwnd,FALSE); bhide_icon = FALSE; } } return GDK_FILTER_REMOVE; } /* * PUBLIC CODE */ char* wgaim_install_dir(void) { HMODULE hmod; char* buf; hmod = GetModuleHandle(NULL); if( hmod == 0 ) { buf = g_win32_error_message( GetLastError() ); debug_printf("GetModuleHandle error: %s\n", buf); free(buf); return NULL; } if(GetModuleFileName( hmod, (char*)&install_dir, MAXPATHLEN ) == 0) { buf = g_win32_error_message( GetLastError() ); debug_printf("GetModuleFileName error: %s\n", buf); free(buf); return NULL; } buf = g_path_get_dirname( install_dir ); strcpy( (char*)&install_dir, buf ); free( buf ); return (char*)&install_dir; } char* wgaim_lib_dir(void) { strcpy(lib_dir, wgaim_install_dir()); strcat(lib_dir, G_DIR_SEPARATOR_S "plugins"); return (char*)&lib_dir; } char* wgaim_locale_dir(void) { strcpy(locale_dir, wgaim_install_dir()); strcat(locale_dir, G_DIR_SEPARATOR_S "locale"); return (char*)&locale_dir; } GdkFilterReturn wgaim_window_filter( GdkXEvent *xevent, GdkEvent *event, gpointer data) { MSG *msg = (MSG*)xevent; switch( msg->message ) { case WM_SYSCOMMAND: if( msg->wParam == SC_MINIMIZE ) { MinimizeWndToTray(msg->hwnd); ShowNotifyIcon(msg->hwnd,TRUE); SetWindowLong(msg->hwnd,DWL_MSGRESULT,0); return GDK_FILTER_REMOVE; } break; case WM_CLOSE: MinimizeWndToTray(msg->hwnd); ShowNotifyIcon(msg->hwnd,TRUE); return GDK_FILTER_REMOVE; } return GDK_FILTER_CONTINUE; } void wgaim_init(void) { /* Filter to catch systray events */ gdk_add_client_message_filter (GDK_POINTER_TO_ATOM (WM_TRAYMESSAGE), traymsg_filter_func, NULL); } --- NEW FILE: win32dep.h --- /* * win32dep.h */ #ifndef _WIN32DEP_H_ #define _WIN32DEP_H_ #include <gdk/gdkevents.h> extern char* wgaim_install_dir(void); extern char* wgaim_lib_dir(void); extern char* wgaim_locale_dir(void); extern GdkFilterReturn wgaim_window_filter(GdkXEvent *xevent, GdkEvent *event, gpointer data); extern void wgaim_init(void); #define unlink _unlink #define bzero( dest, size ) memset( ## dest ##, 0, ## size ## ) #define sleep(x) Sleep((x)*1000) #define snprintf _snprintf #define vsnprintf _vsnprintf #define DATADIR wgaim_install_dir() /* Needed for accessing global variables outside the current module */ #ifdef G_MODULE_IMPORT #undef G_MODULE_IMPORT #endif #define G_MODULE_IMPORT __declspec(dllimport) #define LIBDIR wgaim_lib_dir() #define LOCALEDIR wgaim_locale_dir() #endif /* _WIN32DEP_H_ */ |
From: Rob F. <rob...@us...> - 2002-10-11 03:14:03
|
Update of /cvsroot/gaim/gaim/src/protocols/napster In directory usw-pr-cvs1:/tmp/cvs-serv28946/src/protocols/napster Modified Files: napster.c Added Files: Makefile.mingw Log Message: Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. --- NEW FILE: Makefile.mingw --- # # Makefile.mingw # # Description: Makefile for win32 (mingw) version of libnapster # # # PATHS # INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. NAPSTER_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir ## ## VARIABLE DEFINITIONS ## TARGET = libnapster VERSION := $(shell cat $(GAIM_TOP)/VERSION) # Compiler Options CC = gcc CFLAGS = -O2 -Werror -Wall -mno-cygwin -fnative-struct DEFINES = -DAIM_BUILDDATE=\"`date +%Y%m%d`\" \ -DAIM_BUILDTIME=\"`date +%H%M%S`\" \ -DVERSION=\"$(VERSION)\" \ -DHAVE_CONFIG_H # Static or Plugin... ifeq ($(TYPE),STATIC) DEFINES += -DSTATIC DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR) else ifeq ($(TYPE),PLUGIN) DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR)/plugins endif endif ## ## INCLUDE MAKEFILES ## ## ## INCLUDE PATHS ## INCLUDE_PATHS += -I$(NAPSTER_ROOT) \ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/include/pango-1.0 \ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ -I$(GAIM_TOP)/src \ -I$(GAIM_TOP)/src/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(GAIM_TOP)/src ## ## SOURCES, OBJECTS ## C_SRC = napster.c OBJECTS = $(C_SRC:%.c=%.o) ## ## LIBRARIES ## LIBS = -lgtk-win32-2.0 -lglib-2.0 -lgdk-win32-2.0 -lgmodule-2.0 -lgobject-2.0 -lws2_32 -lintl -lgaim # -liberty ## ## RULES ## # How to make a C file %.o: %.c $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@ -c $< ## ## TARGET DEFINITIONS ## .PHONY: all clean all: $(TARGET).dll install: cp $(NAPSTER_ROOT)/$(TARGET).dll $(DLL_INSTALL_DIR) ## ## BUILD Dependencies ## $(GAIM_TOP)/src/gaim.lib: $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib ## ## BUILD DLL ## $(TARGET).def: $(OBJECTS) dlltool --dllname $(TARGET).dll -z $(TARGET).def \ $(OBJECTS) $(TARGET).base: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib gcc -mdll -o junk.tmp -Wl,--base-file,$@ $(OBJECTS) $(LIB_PATHS) $(LIBS) rm -rf junk.tmp $(TARGET).exp: $(TARGET).def $(TARGET).base dlltool --dllname $(TARGET).dll --base-file $(TARGET).base \ --output-exp $(TARGET).exp --def $(TARGET).def rm -rf $(TARGET).base $(TARGET).dll: $(OBJECTS) $(TARGET).exp $(GAIM_TOP)/src/gaim.lib dlltool -D $(TARGET).dll -d $(TARGET).def -l $(TARGET).lib gcc -mdll -o $(TARGET).dll $(OBJECTS) -Wl,$(TARGET).exp $(LIB_PATHS) $(LIBS) rm -rf $(TARGET).exp ## ## CLEAN RULES ## clean: rm -rf *.o rm -rf $(TARGET).dll rm -rf $(TARGET).lib rm -rf $(TARGET).def Index: napster.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/napster/napster.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- napster.c 6 Oct 2002 02:59:26 -0000 1.23 +++ napster.c 11 Oct 2002 03:14:00 -0000 1.24 @@ -21,24 +21,37 @@ #include <config.h> +#ifndef _WIN32 #include <netdb.h> #include <unistd.h> -#include <errno.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <sys/socket.h> +#else +#include <winsock.h> +#endif + +#include <errno.h> #include <time.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <time.h> -#include <sys/socket.h> #include <sys/stat.h> #include "multi.h" #include "prpl.h" #include "gaim.h" #include "proxy.h" + +#ifdef _WIN32 +#include "win32dep.h" +#endif + #include "pixmaps/protocols/napster/napster.xpm" +/* for win32 compatability */ +G_MODULE_IMPORT GSList *connections; + #define NAP_BUF_LEN 4096 #define USEROPT_NAPSERVER 3 @@ -71,9 +84,15 @@ size = strlen(message); +#ifndef _WIN32 write(ndata->fd, &size, 2); write(ndata->fd, &command, 2); write(ndata->fd, message, size); +#else + send(ndata->fd, (char*)&size, 2, 0); + send(ndata->fd, (char*)&command, 2, 0); + send(ndata->fd, message, size, 0); +#endif } static int nap_send_im(struct gaim_connection *gc, char *who, char *message, int len, int flags) @@ -156,7 +175,13 @@ gchar **res; int i; - if (recv(source, header, 4, 0) != 4) { + if (recv(source, +#ifndef _WIN32 + header, +#else + (char*)header, +#endif + 4, 0) != 4) { hide_login_progress(gc, "Unable to read"); signoff(gc); return; @@ -358,12 +383,19 @@ unsigned short header[2]; int len; int command; - +#ifndef _WIN32 read(source, header, 4); +#else + recv(source, (char*)header, 4, 0); +#endif len = header[0]; command = header[1]; +#ifndef _WIN32 read(source, buf, len); +#else + recv(source, buf, len, 0); +#endif buf[len] = 0; /* If we have some kind of error, get outta here */ @@ -372,7 +404,11 @@ do_error_dialog(buf, NULL, GAIM_ERROR); gaim_input_remove(ndata->inpa); ndata->inpa = 0; +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif signoff(gc); return; } @@ -405,7 +441,11 @@ char buf[NAP_BUF_LEN]; if (!g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif return; } @@ -551,7 +591,7 @@ static struct prpl *my_protocol = NULL; -void napster_init(struct prpl *ret) +G_MODULE_EXPORT void napster_init(struct prpl *ret) { struct proto_user_opt *puo; ret->add_buddies = nap_add_buddies; @@ -615,7 +655,7 @@ #ifndef STATIC -void *gaim_prpl_init(struct prpl *prpl) +G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl) { napster_init(prpl); prpl->plug->desc.api_version = PLUGIN_API_VERSION; |
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv28946/src Modified Files: about.c aim.c browser.c buddy.c conversation.c core.c dialogs.c ft.c gaim.h gaimrc.c gtkimhtml.c gtkspell.c html.c list.c module.c multi.c perl.c prefs.c proxy.c proxy.h prpl.h sound.c util.c Added Files: win_aim.c Log Message: Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. --- NEW FILE: win_aim.c --- /* * win_aim.c * * Author: Herman Bloggs <her...@ya...> * Date: June, 2002 * Description: Entry point for win32 gaim, and various win32 dependant * routines. */ #include <windows.h> #include <stdlib.h> /* * GLOBALS */ __declspec(dllimport) HINSTANCE g_hInstance; /* * PROTOTYPES */ extern int gaim_main( int, char** ); #ifdef __GNUC__ # ifndef _stdcall # define _stdcall __attribute__((stdcall)) # endif #endif int _stdcall WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance, char *lpszCmdLine, int nCmdShow) { g_hInstance = hInstance; return gaim_main (__argc, __argv); } Index: about.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/about.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -d -r1.72 -r1.73 --- about.c 30 Aug 2002 03:13:59 -0000 1.72 +++ about.c 11 Oct 2002 03:13:57 -0000 1.73 @@ -81,7 +81,8 @@ GdkBitmap *bm; GtkWidget *hbox; GtkWidget *button; - GtkWidget *text; + GtkWidget *view; + GtkTextBuffer *buffer; GtkWidget *sw; char abouttitle[45]; @@ -131,20 +132,44 @@ gtk_box_pack_start(GTK_BOX(fbox), label, TRUE, TRUE, 0); gtk_widget_show(label); - text = gtk_text_new(NULL, NULL); + view = gtk_text_view_new (); - gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, - _("Active Developers\n====================\nRob Flynn (maintainer) [ ro...@ma... ]\nSean Egan (coder) [ bj...@bi... ]\n\nCrazy Patch Writers\n===================\nBenjamin Miller\nDecklin Foster\nNathan Walp\nMark Doliner\n\nRetired Developers\n===================\nJim Duchek\nEric Warmenhoven [ war...@ya... ]\nMark Spencer (original author) [ mar...@ma... ]"), 394); + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); + + gtk_text_buffer_set_text (buffer, + "Active Developers\n" + "=================\n" + "Rob Flynn (maintainer) [ ro...@ma... ]\n" + "Sean Egan (coder) [ bj...@bi... ]\n" + "\n" + "Crazy Patch Writers\n" + "===================\n" + "Benjamin Miller\n" + "Decklin Foster\n" + "Nathan Walp\n" + "Mark Doliner\n" + "\n" + "WIN32 Port\n" + "==========\n" + "Herman Bloggs [ her...@ya... ]\n" + "\n" + "Retired Developers\n" + "==================\n" + "Jim Duchek\n" + "Eric Warmenhoven [ war...@ya... ]\n" + "Mark Spencer (original author) [ mar...@ma... ]\n" + "\n", + -1); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - gtk_container_add(GTK_CONTAINER(sw), text); + gtk_container_add(GTK_CONTAINER(sw), view); gtk_widget_set_usize(GTK_WIDGET(sw), -1, 150); gtk_widget_show(sw); gtk_box_pack_start(GTK_BOX(fbox), sw, TRUE, TRUE, 0); - gtk_widget_show(text); + gtk_widget_show(view); /* Close Button */ Index: aim.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/aim.c,v retrieving revision 1.201 retrieving revision 1.202 diff -u -d -r1.201 -r1.202 --- aim.c 26 Sep 2002 07:37:51 -0000 1.201 +++ aim.c 11 Oct 2002 03:13:57 -0000 1.202 @@ -23,20 +23,26 @@ #include <config.h> #endif #ifdef GAIM_PLUGINS +#ifndef _WIN32 #include <dlfcn.h> +#endif #endif /* GAIM_PLUGINS */ #include <gtk/gtk.h> +#ifdef _WIN32 +#include <winsock.h> +#else #include <gdk/gdkx.h> -#include <gdk/gdk.h> #include <unistd.h> -#include <sys/types.h> #include <sys/socket.h> -#include <sys/stat.h> #include <netinet/in.h> #include <arpa/inet.h> -#include <errno.h> #include <sys/un.h> #include <sys/wait.h> +#endif /* _WIN32 */ +#include <gdk/gdk.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> #include <stdio.h> #include <string.h> #include <stdarg.h> @@ -51,6 +57,9 @@ #include "locale.h" #include "gtkspell.h" #include <getopt.h> +#ifdef _WIN32 +#include "win32dep.h" +#endif static gchar *aspell_cmd[] = { "aspell", "--sug-mode=fast","-a", NULL }; static gchar *ispell_cmd[] = { "ispell", "-a", NULL }; @@ -72,6 +81,9 @@ char *opt_away_arg = NULL; char *opt_rcfile_arg = NULL; int opt_debug = 0; +#ifdef _WIN32 +int opt_gdebug = 0; +#endif #if HAVE_SIGNAL_H /* @@ -243,6 +255,7 @@ } mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_wmclass(GTK_WINDOW(mainwindow), "login", "Gaim"); gtk_window_set_policy(GTK_WINDOW(mainwindow), FALSE, FALSE, TRUE); gtk_signal_connect(GTK_OBJECT(mainwindow), "delete_event", @@ -427,6 +440,7 @@ } #endif +#ifndef _WIN32 static gboolean socket_readable(GIOChannel *source, GIOCondition cond, gpointer ud) { guchar type; @@ -480,16 +494,16 @@ GdkPixbuf *icon = NULL; /* use the nice PNG icon for all the windows */ - icon = gdk_pixbuf_new_from_file(DATADIR "/pixmaps/gaim.png",NULL); + icon = gdk_pixbuf_new_from_file(DATADIR G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "gaim.png",NULL); if (icon) { icons = g_list_append(icons,icon); gtk_window_set_default_icon_list(icons); g_object_unref(G_OBJECT(icon)); } else { - debug_printf("Failed to load icon from %s/pixmaps/gaim.png\n",DATADIR); + debug_printf("Failed to load icon from %s" G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "gaim.png\n",DATADIR); } - g_snprintf(name, sizeof(name), "%s/gaim_%s.%d", g_get_tmp_dir(), g_get_user_name(), gaim_session); + g_snprintf(name, sizeof(name), "%s" G_DIR_SEPARATOR_S "gaim_%s.%d", g_get_tmp_dir(), g_get_user_name(), gaim_session); UI_fd = gaim_connect_to_session(0); if (UI_fd < 0) @@ -499,6 +513,7 @@ g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR, socket_readable, NULL); return 0; } +#endif /* _WIN32 */ static void set_first_user(char *name) { @@ -518,8 +533,35 @@ save_prefs(); } +#ifdef _WIN32 +/* WIN32 print and log handlers */ + +static void gaim_dummy_print( const gchar* string ) { + return; +} + +static void gaim_dummy_log_handler (const gchar *domain, + GLogLevelFlags flags, + const gchar *msg, + gpointer user_data) { + return; +} + +static void gaim_log_handler (const gchar *domain, + GLogLevelFlags flags, + const gchar *msg, + gpointer user_data) { + debug_printf("%s - %s\n", domain, msg); + g_log_default_handler(domain, flags, msg, user_data); +} +#endif + /* FUCKING GET ME A TOWEL! */ +#ifdef _WIN32 +int gaim_main(int argc, char *argv[]) +#else int main(int argc, char *argv[]) +#endif { int opt_acct = 0, opt_help = 0, opt_version = 0, opt_login = 0, opt_nologin = 0, do_login_ret = -1; char *opt_user_arg = NULL, *opt_login_arg = NULL; @@ -672,7 +714,13 @@ /* scan command-line options */ opterr = 1; - while ((opt = getopt_long(argc, argv, "adhu:f:vn", long_options, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, +#ifndef _WIN32 + "adhu:f:vn", +#else + "adghu:f:vn", +#endif + long_options, NULL)) != -1) { switch (opt) { case 'u': /* set user */ opt_user = 1; @@ -696,6 +744,11 @@ case 'n': /* don't autologin */ opt_nologin = 1; break; +#ifdef _WIN32 + case 'g': /* debug GTK and GLIB */ + opt_gdebug = 1; + break; +#endif case '?': default: show_usage(1, argv[0]); @@ -704,6 +757,42 @@ } } +#ifdef _WIN32 + /* We don't want a console window.. */ + /* + * Any calls to the glib logging functions, result in a call to AllocConsole(). + * ME and 98 will in such cases produce a console window (2000 not), despite + * being built as a windows app rather than a console app. So we should either + * ignore messages by setting dummy log handlers, or redirect messages. + * This requires setting handlers for all domains (any lib which uses g_logging). + */ + + g_log_set_handler ("Gdk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, + (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), + NULL); + g_log_set_handler ("Gtk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, + (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), + NULL); + g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, + (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), + NULL); + g_log_set_handler ("GModule", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, + (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), + NULL); + g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, + (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), + NULL); + g_log_set_handler ("GThread", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, + (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), + NULL); + + /* g_print also makes a call to AllocConsole(), therefore a handler needs to be + set here aswell */ + if(!opt_debug) + g_set_print_handler( gaim_dummy_print ); + +#endif + /* show help message */ if (opt_help) { show_usage(0, argv[0]); @@ -720,7 +809,9 @@ #endif load_prefs(); core_main(); +#ifndef _WIN32 ui_main(); +#endif /* set the default username */ if (opt_user_arg != NULL) { @@ -731,6 +822,7 @@ if (misc_options & OPT_MISC_DEBUG) show_debug(); +#ifndef _WIN32 /*If ispell fails to start, try using aspell in ispell compatibitity mode. Gabber does this the same way -- lor...@my...*/ if (convo_options & OPT_CONVO_CHECK_SPELLING){ @@ -744,7 +836,7 @@ debug_printf("gtkspell started with ispell\n"); } } - +#endif static_proto_init(); /* deal with --login */ @@ -763,11 +855,16 @@ account_editor(NULL, NULL); } else if ((do_login_ret == -1) && !connections) show_login(); +#ifdef _WIN32 + /* Various win32 initializations */ + wgaim_init(); +#endif gtk_main(); - +#ifndef _WIN32 if (convo_options & OPT_CONVO_CHECK_SPELLING) gtkspell_stop(); +#endif core_quit(); /* don't need ui_quit here because ui doesn't create anything */ Index: browser.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/browser.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- browser.c 26 Sep 2002 15:23:32 -0000 1.31 +++ browser.c 11 Oct 2002 03:13:57 -0000 1.32 @@ -30,9 +30,14 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif +#ifdef _WIN32 +#include <gdk/gdkwin32.h> +#else +#include <unistd.h> +#include <gdk/gdkx.h> +#endif #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <string.h> @@ -40,7 +45,6 @@ #include <gtk/gtk.h> #include <gdk/gdkprivate.h> -#include <gdk/gdkx.h> #include "gaim.h" #ifndef _WIN32 @@ -652,8 +656,9 @@ void add_bookmark(GtkWidget *w, char *url) { } -void open_url_nw(GtkWidget *w, char *url) +void open_url(GtkWidget *w, char *url) { + ShellExecute(NULL, NULL, url, NULL, ".\\", 0); } Index: buddy.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/buddy.c,v retrieving revision 1.340 retrieving revision 1.341 diff -u -d -r1.340 -r1.341 --- buddy.c 29 Sep 2002 04:48:40 -0000 1.340 +++ buddy.c 11 Oct 2002 03:13:57 -0000 1.341 @@ -23,7 +23,9 @@ #include <config.h> #endif #ifdef GAIM_PLUGINS +#ifndef _WIN32 #include <dlfcn.h> +#endif #endif /* GAIM_PLUGINS */ #include <string.h> #include <stdio.h> @@ -31,13 +33,24 @@ #include <ctype.h> #include <math.h> #include <time.h> -#include <unistd.h> #include <ctype.h> +#ifdef _WIN32 +#include <gdk/gdkwin32.h> +#else +#include <unistd.h> +#include <gdk/gdkx.h> +#endif + #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> #include "prpl.h" #include "gaim.h" + +#ifdef _WIN32 +#include "win32dep.h" +#endif + #include "pixmaps/login_icon.xpm" #include "pixmaps/logout_icon.xpm" #include "pixmaps/no_icon.xpm" @@ -1619,6 +1632,7 @@ } } if (b->options & OPT_POUNCE_COMMAND) { +#ifndef _WIN32 int pid = fork(); if (pid == 0) { @@ -1630,6 +1644,7 @@ execvp(args[0], args); _exit(0); } +#endif /*_WIN32*/ } if (b->options & OPT_POUNCE_SOUND) { if (strlen(b->sound)) @@ -2853,6 +2868,13 @@ gtk_container_add(GTK_CONTAINER(tbox), edittree); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tbox), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + +#ifdef _WIN32 + /* Set filter to enable win32 systray minimization */ + gdk_window_add_filter (GTK_WIDGET(blist)->window, + wgaim_window_filter, + NULL); +#endif } void show_buddy_list() Index: conversation.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/conversation.c,v retrieving revision 1.390 retrieving revision 1.391 diff -u -d -r1.390 -r1.391 --- conversation.c 11 Oct 2002 02:10:08 -0000 1.390 +++ conversation.c 11 Oct 2002 03:13:57 -0000 1.391 @@ -23,16 +23,22 @@ #include <config.h> #endif #include <string.h> +#ifndef _WIN32 #include <sys/time.h> +#include <unistd.h> +#include <gdk/gdkx.h> +#include <X11/Xlib.h> +#else +#ifdef small +#undef small +#endif +#endif /*_WIN32*/ #include <sys/types.h> #include <sys/stat.h> -#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <ctype.h> -#include <gdk/gdkx.h> -#include <X11/Xlib.h> #include <gtk/gtk.h> #include "gtkimhtml.h" #include <gdk/gdkkeysyms.h> @@ -40,6 +46,10 @@ #include "gtkspell.h" #include "prpl.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + #include "pixmaps/bold.xpm" #include "pixmaps/italic.xpm" #include "pixmaps/underline.xpm" @@ -440,7 +450,7 @@ { char buf[BUF_LONG]; GtkWidget *window = gtk_file_selection_new(_("Gaim - Save Conversation")); - g_snprintf(buf, sizeof(buf), "%s/%s.log", g_get_home_dir(), normalize(c->name)); + g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log", gaim_home_dir(), normalize(c->name)); gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c); gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), @@ -497,7 +507,7 @@ { char buf[BUF_LONG]; GtkWidget *window = gtk_file_selection_new(_("Gaim - Insert Image")); - g_snprintf(buf, sizeof(buf), "%s/", g_get_home_dir()); + g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c); gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), @@ -1058,9 +1068,11 @@ } else if (event->keyval == 'z') { key_is_typing = FALSE; gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); +#ifndef _WIN32 XIconifyWindow(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(c->window->window), ((_XPrivDisplay)GDK_DISPLAY())->default_screen); +#endif } @@ -1360,8 +1372,14 @@ if (err < 0) { if (err == -E2BIG) do_error_dialog(_("Unable to send message. The message is too large"), NULL, GAIM_ERROR); +#ifndef _WIN32 else if (err == -ENOTCONN) debug_printf("Not yet connected\n"); +#else + else if (err == SOCKET_ERROR) + if( WSAENOTCONN == WSAGetLastError() ) + debug_printf("Not yet connected\n"); +#endif else do_error_dialog(_("Unable to send message"), NULL, GAIM_ERROR); } else { @@ -3476,7 +3494,7 @@ c->save_icon = gtk_file_selection_new(_("Gaim - Save Icon")); gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(c->save_icon)); - g_snprintf(buf, BUF_LEN - 1, "%s/%s.icon", g_get_home_dir(), c->name); + g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S "%s.icon", gaim_home_dir(), c->name); gtk_file_selection_set_filename(GTK_FILE_SELECTION(c->save_icon), buf); gtk_signal_connect(GTK_OBJECT(c->save_icon), "delete_event", GTK_SIGNAL_FUNC(des_save_icon), c); @@ -3613,7 +3631,7 @@ /* this is such an evil hack, i don't know why i'm even considering it. * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ - g_snprintf(filename, sizeof(filename), "%s/gaimicon-%s.%d", g_get_tmp_dir(), c->name, getpid()); + g_snprintf(filename, sizeof(filename), "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", g_get_tmp_dir(), c->name, getpid()); file = fopen(filename, "w"); if (!file) return; Index: core.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/core.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- core.c 18 Sep 2002 00:11:45 -0000 1.22 +++ core.c 11 Oct 2002 03:13:58 -0000 1.23 @@ -27,10 +27,17 @@ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> + +#ifdef _WIN32 +#include <winsock.h> +#include <io.h> +#else #include <sys/socket.h> -#include <sys/stat.h> #include <sys/un.h> #include <unistd.h> +#endif + +#include <sys/stat.h> #include <errno.h> #include <signal.h> #include <getopt.h> @@ -40,6 +47,10 @@ #include "gaim.h" #include "gaim-socket.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + static gint UI_fd = -1; int gaim_session = 0; GSList *uis = NULL; @@ -132,6 +143,7 @@ g_free(data); } +#ifndef _WIN32 static void meta_handler(struct UI *ui, guchar subtype, guchar *data) { struct gaim_cui_packet *p; @@ -443,8 +455,9 @@ if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) { mode_t m = umask(0177); saddr.sun_family = AF_UNIX; - g_snprintf(saddr.sun_path, sizeof(saddr.sun_path), "%s/gaim_%s.%d", - g_get_tmp_dir(), g_get_user_name(), gaim_session); + + g_snprintf(saddr.sun_path, sizeof(saddr.sun_path), "%s" G_DIR_SEPARATOR_S "gaim_%s.%d", + g_get_tmp_dir(), g_get_user_name(), gaim_session); if (bind(fd, (struct sockaddr *)&saddr, sizeof(saddr)) != -1) listen(fd, 100); else { @@ -458,6 +471,7 @@ g_log(NULL, G_LOG_LEVEL_CRITICAL, "Unable to open socket: %s", strerror(errno)); return fd; } +#endif /*! _WIN32*/ int core_main() { @@ -465,6 +479,7 @@ GMainLoop *loop; */ +#ifndef _WIN32 GIOChannel *channel; UI_fd = open_socket(); @@ -474,6 +489,32 @@ channel = g_io_channel_unix_new(UI_fd); g_io_add_watch(channel, G_IO_IN, socket_readable, NULL); g_io_channel_unref(channel); +#endif + +#ifdef _WIN32 + WORD wVersionRequested; + WSADATA wsaData; + int err; + + wVersionRequested = MAKEWORD( 2, 2 ); + + err = WSAStartup( wVersionRequested, &wsaData ); + if ( err != 0 ) { + return 1; + } + + /* Confirm that the winsock DLL supports 2.2 */ + /* Note that if the DLL supports versions greater than + 2.2 in addition to 2.2, it will still return 2.2 in + wVersion since that is the version we requested. */ + + if ( LOBYTE( wsaData.wVersion ) != 2 || + HIBYTE( wsaData.wVersion ) != 2 ) { + debug_printf("Could not find a usable WinSock DLL. Oh well.\n"); + WSACleanup( ); + return 1; + } +#endif /* _WIN32 */ /* loop = g_main_new(TRUE); @@ -485,9 +526,13 @@ void core_quit() { +#ifndef _WIN32 char buf[1024]; close(UI_fd); - sprintf(buf, "%s/gaim_%s.%d", g_get_tmp_dir(), g_get_user_name(), gaim_session); + sprintf(buf, "%s" G_DIR_SEPARATOR_S "gaim_%s.%d", g_get_tmp_dir(), g_get_user_name(), gaim_session); unlink(buf); debug_printf("Removed core\n"); +#else + WSACleanup( ); +#endif } Index: dialogs.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/dialogs.c,v retrieving revision 1.344 retrieving revision 1.345 diff -u -d -r1.344 -r1.345 --- dialogs.c 30 Sep 2002 01:05:14 -0000 1.344 +++ dialogs.c 11 Oct 2002 03:13:58 -0000 1.345 @@ -25,17 +25,22 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> -#include <time.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <ctype.h> + +#ifdef _WIN32 +#include <winsock.h> +#else #include <sys/socket.h> +#include <time.h> #include <netdb.h> #include <netinet/in.h> #include <unistd.h> -#include <netinet/in.h> #include <arpa/inet.h> +#endif + #include <errno.h> #include <math.h> @@ -44,6 +49,10 @@ #include "gtkimhtml.h" #include "prpl.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + #include "pixmaps/gnome_preferences.xpm" #include "pixmaps/cancel.xpm" #include "pixmaps/save.xpm" @@ -2609,7 +2618,7 @@ gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(c->log_dialog)); - g_snprintf(buf, BUF_LEN - 1, "%s/%s.log", getenv("HOME"), normalize(c->name)); + g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S "%s.log", gaim_home_dir(), normalize(c->name)); gtk_object_set_user_data(GTK_OBJECT(c->log_dialog), "log dialog"); gtk_file_selection_set_filename(GTK_FILE_SELECTION(c->log_dialog), buf); gtk_signal_connect(GTK_OBJECT(c->log_dialog), "delete_event", @@ -3365,7 +3374,7 @@ gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(importdialog)); - g_snprintf(buf, BUF_LEN - 1, "%s/", getenv("HOME")); + g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); gtk_file_selection_set_filename(GTK_FILE_SELECTION(importdialog), buf); gtk_signal_connect(GTK_OBJECT(importdialog), "destroy", @@ -3885,9 +3894,8 @@ name = gtk_object_get_user_data(GTK_OBJECT(filesel)); tmp = gaim_user_dir(); - g_snprintf(filename, PATHSIZE, "%s/logs/%s%s", tmp, + g_snprintf(filename, PATHSIZE, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s%s", tmp, name ? normalize(name) : "system", name ? ".log" : ""); - g_free(tmp); file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); strncpy(path, file, PATHSIZE - 1); @@ -3924,7 +3932,7 @@ GtkWidget *filesel; gchar buf[BUF_LEN]; - g_snprintf(buf, BUF_LEN - 1, "%s/%s%s", getenv("HOME"), + g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S "%s%s", gaim_home_dir(), name ? normalize(name) : "system", name ? ".log" : ""); filesel = gtk_file_selection_new(_("Gaim - Save Log File")); @@ -3953,9 +3961,8 @@ char *tmp; tmp = gaim_user_dir(); - g_snprintf(filename, 256, "%s/logs/%s%s", tmp, + g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s%s", tmp, name ? normalize(name) : "system", name ? ".log" : ""); - g_free(tmp); if ((remove(filename)) == -1) { g_snprintf(buf, 256, _("Couldn't remove file %s." ), filename); @@ -4025,12 +4032,10 @@ if (view->name) { char *tmp = gaim_user_dir(); - g_snprintf(filename, 256, "%s/logs/%s.log", tmp, normalize(view->name)); - g_free(tmp); + g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s.log", tmp, normalize(view->name)); } else { char *tmp = gaim_user_dir(); - g_snprintf(filename, 256, "%s/logs/system", tmp); - g_free(tmp); + g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "system", tmp); } if ((fp = fopen(filename, "r")) == NULL) { g_snprintf(buf, BUF_LONG, "Couldn't open log file %s.", filename); @@ -4174,8 +4179,7 @@ if (name) { char *tmp = gaim_user_dir(); - g_snprintf(filename, 256, "%s/logs/%s.log", tmp, normalize(name)); - g_free(tmp); + g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s.log", tmp, normalize(name)); if ((fp = fopen(filename, "r")) == NULL) { g_snprintf(buf, BUF_LONG, "Couldn't open log file %s", filename); do_error_dialog(buf, strerror(errno), GAIM_ERROR); @@ -4557,7 +4561,6 @@ if (!perl_last_dir) { temp = gaim_user_dir(); buf = g_strconcat(temp, G_DIR_SEPARATOR_S, NULL); - g_free(temp); } else { buf = g_strconcat(perl_last_dir, G_DIR_SEPARATOR_S, NULL); } Index: ft.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/ft.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ft.c 10 Oct 2002 05:57:07 -0000 1.4 +++ ft.c 11 Oct 2002 03:13:58 -0000 1.5 @@ -461,8 +461,11 @@ /* Two functions, one recursive, just to make a directory. Yuck. */ static int ft_mkdir_help(char *dir) { int ret; - +#ifndef _WIN32 ret = mkdir(dir, 0775); +#else + ret = _mkdir(dir); +#endif if (ret) { char *index = strrchr(dir, G_DIR_SEPARATOR); if (!index) @@ -471,7 +474,11 @@ ret = ft_mkdir_help(dir); *index = G_DIR_SEPARATOR; if (!ret) +#ifndef _WIN32 ret = mkdir(dir, 0775); +#else + ret = _mkdir(dir); +#endif } return ret; Index: gaim.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/gaim.h,v retrieving revision 1.340 retrieving revision 1.341 diff -u -d -r1.340 -r1.341 --- gaim.h 6 Oct 2002 05:01:49 -0000 1.340 +++ gaim.h 11 Oct 2002 03:13:58 -0000 1.341 @@ -385,8 +385,15 @@ extern gint sort_awaymsg_list(gconstpointer, gconstpointer); /* Functions in html.c */ +struct g_url { + char address[255]; + int port; + char page[255]; +}; + extern void grab_url(char *, gboolean, void (*callback)(gpointer, char *), gpointer); extern gchar *strip_html(gchar *); +struct g_url *parse_url(char *url); /* Functions in idle.c */ extern gint check_idle(gpointer); @@ -447,6 +454,7 @@ extern char *stylize(gchar *, int); extern void show_usage (int, char *); extern int do_auto_login (char *); +extern char *gaim_home_dir(); extern char *gaim_user_dir(); extern void strncpy_nohtml(gchar *, const gchar *, size_t); extern void strncpy_withhtml(gchar *, const gchar *, size_t); Index: gaimrc.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gaimrc.c,v retrieving revision 1.108 retrieving revision 1.109 diff -u -d -r1.108 -r1.109 --- gaimrc.c 28 Sep 2002 08:08:14 -0000 1.108 +++ gaimrc.c 11 Oct 2002 03:13:58 -0000 1.109 @@ -23,18 +23,25 @@ #include <config.h> #endif #include <string.h> + +#ifndef _WIN32 #include <sys/time.h> +#include <unistd.h> +#endif #include <sys/types.h> #include <sys/stat.h> -#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include "gaim.h" #include "prpl.h" #include "proxy.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + /* for people like myself, who are too lazy to add an away msg :) */ #define BORING_DEFAULT_AWAY_MSG "sorry, i ran out for a while. bbl" #define MAX_VALUES 10 @@ -51,12 +58,15 @@ guint away_options; guint away_resend; -int report_idle, web_browser; +int report_idle; +int web_browser; struct save_pos blist_pos; struct window_size conv_size, buddy_chat_size; char web_command[2048]; char *sound_file[NUM_SOUNDS]; +#ifndef _WIN32 char sound_cmd[2048]; +#endif struct parse { char option[256]; @@ -831,7 +841,17 @@ if (misc_options & OPT_MISC_BUDDY_TICKER) { #ifdef GAIM_PLUGINS - load_plugin(LIBDIR "/ticker.so"); + gchar* buf; + + buf = g_strconcat(LIBDIR, G_DIR_SEPARATOR_S, +#ifndef _WIN32 + "ticker.so", +#else + "ticker.dll", +#endif + NULL); + load_plugin(buf); + g_free(buf); #endif misc_options &= ~OPT_MISC_BUDDY_TICKER; } @@ -881,8 +901,9 @@ for (i = 0; i < NUM_SOUNDS; i++) sound_file[i] = NULL; +#ifndef _WIN32 sound_cmd[0] = 0; - +#endif while (buf[0] != '}') { if (buf[0] == '#') continue; @@ -891,10 +912,12 @@ return; p = parse_line(buf, &parse_buffer); - +#ifndef _WIN32 if (!strcmp(p->option, "sound_cmd")) { g_snprintf(sound_cmd, sizeof(sound_cmd), "%s", p->value[0]); - } else if (!strncmp(p->option, "sound", strlen("sound"))) { + } else +#endif + if (!strncmp(p->option, "sound", strlen("sound"))) { i = p->option[strlen("sound")] - 'A'; if (p->value[0][0]) @@ -912,7 +935,9 @@ fprintf(f, "\tsound%c { %s }\n", i + 'A', sound_file[i]); else fprintf(f, "\tsound%c { }\n", i + 'A'); +#ifndef _WIN32 fprintf(f, "\tsound_cmd { %s }\n", sound_cmd); +#endif fprintf(f, "}\n"); } @@ -1192,11 +1217,16 @@ if (opt_rcfile_arg) g_snprintf(buf, sizeof(buf), "%s", opt_rcfile_arg); - else if (getenv("HOME")) - g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); + else if (gaim_home_dir()) + g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaimrc", gaim_home_dir()); else { +#ifndef _WIN32 set_defaults(); return; +#else + /* Pre Win 2000 there are no home dirs... */ + g_snprintf(buf, sizeof(buf), "C:" G_DIR_SEPARATOR_S ".gaimrc"); +#endif } if ((f = fopen(buf, "r"))) { @@ -1254,13 +1284,20 @@ FILE *f; char buf[BUF_LONG]; - if (opt_rcfile_arg) + if (opt_rcfile_arg) { g_snprintf(buf, sizeof(buf), "%s", opt_rcfile_arg); - else if (getenv("HOME")) - g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); - else + } + else if (gaim_home_dir()) { + g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaimrc", gaim_home_dir()); + } + else { +#ifndef _WIN32 return; - +#else + /* Pre Win 2000, there are no home dirs.. */ + g_snprintf(buf, sizeof(buf), "C:" G_DIR_SEPARATOR_S ".gaimrc"); +#endif + } if ((f = fopen(buf, "w"))) { fprintf(f, "# .gaimrc v%d\n", 4); gaimrc_write_users(f); @@ -1273,8 +1310,12 @@ #endif gaimrc_write_proxy(f); fclose(f); +#ifndef _WIN32 chmod(buf, S_IRUSR | S_IWUSR); +#endif } + else + debug_printf("Error opening .gaimrc\n"); } Index: gtkimhtml.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gtkimhtml.c,v retrieving revision 1.123 retrieving revision 1.124 diff -u -d -r1.123 -r1.124 --- gtkimhtml.c 9 Oct 2002 05:59:33 -0000 1.123 +++ gtkimhtml.c 11 Oct 2002 03:13:58 -0000 1.124 @@ -23,9 +23,15 @@ #include <config.h> #endif #include "gtkimhtml.h" + +#ifndef _WIN32 #include <X11/Xlib.h> -#include <stdlib.h> #include <gdk/gdkx.h> +#else +#include <gdk/gdkwin32.h> +#endif + +#include <stdlib.h> #include <gtk/gtk.h> #include <string.h> #include <ctype.h> @@ -36,6 +42,12 @@ #include <locale.h> #endif +#ifdef _WIN32 +/* GDK_SELECTION_PRIMARY is ignored win32 GTK */ +#undef GDK_SELECTION_PRIMARY +#define GDK_SELECTION_PRIMARY GDK_SELECTION_CLIPBOARD +#endif + #include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gdk-pixbuf-loader.h> @@ -1684,10 +1696,10 @@ const gchar *filename; FILE *f; filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(is->savedialog)); - g_print("Saving %s\n", filename); + debug_printf("Saving %s\n", filename); if (! (f=fopen(filename, "w"))) { /* There should be some sort of dialog */ - g_print("Could not open file for writing.\n"); + debug_printf("Could not open file for writing.\n"); gtk_widget_destroy(is->savedialog); g_free(is); return; @@ -2086,6 +2098,19 @@ static const gchar* gtk_imhtml_get_font_name (PangoFontDescription *font) { +#if 0 +#ifndef _WIN32 + return gdk_x11_font_get_name(font); +#else +#if 0 + /* win32 gdkfont.h says this is temporary - GTK 2.0.3 */ + return gdk_font_full_name_get(font); +#else + /* So i can build with GTK 2.0.6 */ + return "-unknown-arial-normal-r-normal---18--108-120-120-p-0-microsoft-vietnamese-unknown-arial-normal-r-normal---18--108-120-120-p-0-microsoft-vietnamese27"; +#endif +#endif +#endif return pango_font_description_get_family(font); } @@ -3328,7 +3353,7 @@ if (!gdk_pixbuf_loader_write(load, imagedata, img->len, &err)) - g_print("IM Image corrupt or unreadable.\n"); + debug_printf("IM Image corrupt or unreadable.\n"); else imagepb = gdk_pixbuf_loader_get_pixbuf(load); img->pb = imagepb; Index: gtkspell.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gtkspell.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- gtkspell.c 15 May 2002 02:28:01 -0000 1.17 +++ gtkspell.c 11 Oct 2002 03:13:58 -0000 1.18 @@ -19,9 +19,15 @@ #include <gtk/gtk.h> #include <sys/types.h> + +#ifndef _WIN32 #include <sys/wait.h> #include <sys/time.h> -#include <unistd.h> +#include <unistd.h> +#else +#include <io.h> +#endif + #include <stdio.h> #include <signal.h> #include <ctype.h> @@ -163,15 +169,18 @@ void gtkspell_stop() { +#ifndef _WIN32 if (gtkspell_running()) { kill(spell_pid, SIGHUP); spell_pid = 0; close(fd_read[0]); close(fd_write[1]); } +#endif } int gtkspell_start(char *path, char * args[]) { +#ifndef _WIN32 int fd_error[2]; if (gtkspell_running()) { @@ -268,6 +277,7 @@ /* put ispell into terse mode. * this makes it not respond on correctly spelled words. */ writetext("!\n"); +#endif /*!_WIN32*/ return 0; } Index: html.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/html.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- html.c 28 Mar 2002 18:22:48 -0000 1.25 +++ html.c 11 Oct 2002 03:13:59 -0000 1.26 @@ -25,23 +25,24 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> + +#ifndef _WIN32 #include <sys/time.h> #include <unistd.h> -#include "gaim.h" -#include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> +#else +#include <winsock.h> +#include <io.h> +#endif + +#include <sys/types.h> #include <fcntl.h> #include <errno.h> +#include "gaim.h" #include "proxy.h" -struct g_url { - char address[255]; - int port; - char page[255]; -}; - gchar *strip_html(gchar *text) { int i, j, k; @@ -74,7 +75,7 @@ return text2; } -static struct g_url *parse_url(char *url) +struct g_url *parse_url(char *url) { struct g_url *test = g_new0(struct g_url, 1); char scan_info[255]; @@ -143,22 +144,37 @@ if (!gunk->sentreq) { char buf[256]; +#ifdef _WIN32 + int imode=1; +#endif g_snprintf(buf, sizeof(buf), "GET %s%s HTTP/1.0\r\n\r\n", gunk->full ? "" : "/", gunk->full ? gunk->url : gunk->website->page); debug_printf("Request: %s\n", buf); +#ifdef _WIN32 + send(sock, buf, strlen(buf), 0); + ioctlsocket(sock, FIONBIO, (unsigned long *)&imode); +#else write(sock, buf, strlen(buf)); fcntl(sock, F_SETFL, O_NONBLOCK); +#endif gunk->sentreq = TRUE; gunk->inpa = gaim_input_add(sock, GAIM_INPUT_READ, grab_url_callback, dat); return; } +#ifdef _WIN32 + if (recv(sock, &data, 1, 0) > 0 || WSAEWOULDBLOCK == WSAGetLastError()) { + if (WSAEWOULDBLOCK == WSAGetLastError()) { + WSASetLastError(0); + return; + } +#else if (read(sock, &data, 1) > 0 || errno == EWOULDBLOCK) { if (errno == EWOULDBLOCK) { errno = 0; return; } - +#endif if (!gunk->startsaving) { if (data == '\r') return; @@ -175,15 +191,22 @@ gunk->webdata = g_realloc(gunk->webdata, gunk->len); gunk->webdata[gunk->len - 1] = data; } +#ifdef _WIN32 + } else if (WSAETIMEDOUT == WSAGetLastError()) { +#else } else if (errno != ETIMEDOUT) { - +#endif gunk->webdata = g_realloc(gunk->webdata, gunk->len + 1); gunk->webdata[gunk->len] = 0; debug_printf(_("Received: '%s'\n"), gunk->webdata); gaim_input_remove(gunk->inpa); +#ifdef _WIN32 + closesocket(sock); +#else close(sock); +#endif gunk->callback(gunk->data, gunk->webdata); if (gunk->webdata) g_free(gunk->webdata); @@ -192,7 +215,11 @@ g_free(gunk); } else { gaim_input_remove(gunk->inpa); +#ifdef _WIN32 + closesocket(sock); +#else close(sock); +#endif gunk->callback(gunk->data, NULL); if (gunk->webdata) g_free(gunk->webdata); Index: list.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/list.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- list.c 29 Aug 2002 01:47:14 -0000 1.16 +++ list.c 11 Oct 2002 03:13:59 -0000 1.17 @@ -25,7 +25,12 @@ #include <string.h> #include <sys/types.h> #include <sys/stat.h> +#ifndef _WIN32 #include <unistd.h> +#else +#include <direct.h> +#include <io.h> +#endif #include "gaim.h" #include "prpl.h" @@ -668,14 +673,14 @@ file = gaim_user_dir(); if (file != (char *)NULL) { - g_snprintf(path, sizeof path, "%s/%s.%d.blist", file, g_screenname, gc->protocol); + g_snprintf(path, sizeof path, "%s" G_DIR_SEPARATOR_S "%s.%d.blist", file, g_screenname, gc->protocol); if (!stat(path, &sbuf)) { debug_printf("%s exists.\n", path); ret = TRUE; } else { char path2[PATHSIZE]; debug_printf("%s does not exist.\n", path); - g_snprintf(path2, sizeof path2, "%s/%s.blist", file, g_screenname); + g_snprintf(path2, sizeof path2, "%s" G_DIR_SEPARATOR_S "%s.blist", file, g_screenname); if (!stat(path2, &sbuf)) { debug_printf("%s exists, moving to %s\n", path2, path); if (rename(path2, path)) @@ -684,7 +689,6 @@ ret = TRUE; } } - g_free(file); } g_free(g_screenname); return ret; @@ -706,8 +710,7 @@ char *file = gaim_user_dir(); if (file != (char *)NULL) { - sprintf(path, "%s/%s.%d.blist", file, g_screenname, gc->protocol); - g_free(file); + sprintf(path, "%s" G_DIR_SEPARATOR_S "%s.%d.blist", file, g_screenname, gc->protocol); g_free(g_screenname); } else { g_free(g_screenname); @@ -787,25 +790,32 @@ strcpy(buf, file); dir = fopen(buf, "r"); if (!dir) +#ifndef _WIN32 mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR); +#else + _mkdir(buf); +#endif else fclose(dir); g_screenname = get_screenname_filename(g->username); - sprintf(path, "%s/%s.%d.blist", file, g_screenname, g->protocol); + sprintf(path, "%s" G_DIR_SEPARATOR_S "%s.%d.blist", file, g_screenname, g->protocol); if ((f = fopen(path, "w"))) { debug_printf("writing %s\n", path); toc_build_config(g, buf, 8192 - 1, TRUE); fprintf(f, "%s\n", buf); fclose(f); +#ifdef _WIN32 + _chmod(buf, _S_IWRITE); +#else chmod(path, S_IRUSR | S_IWUSR); +#endif } else { debug_printf("unable to write %s\n", path); } g_free(g_screenname); - g_free(file); } static gboolean is_blocked(struct buddy *b) Index: module.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/module.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- module.c 30 Sep 2002 01:05:14 -0000 1.25 +++ module.c 11 Oct 2002 03:13:59 -0000 1.26 @@ -47,6 +47,10 @@ #include <stdio.h> #include <stdlib.h> +#ifdef _WIN32 +#include "win32dep.h" +#endif + /* ------------------ Global Variables ----------------------- */ GList *plugins = NULL; @@ -88,8 +92,7 @@ gchar *path; struct gaim_plugin_description *plugdes; struct gaim_plugin *plug; - char userspace[128]; - char *probedirs[] = {LIBDIR, &userspace, 0}; + char *probedirs[3]; int l; #if GAIM_PLUGINS char *(*gaim_plugin_init)(GModule *); @@ -100,14 +103,22 @@ GModule *handle; #endif - g_snprintf(userspace, sizeof(userspace), "%s" G_DIR_SEPARATOR_S ".gaim", g_get_home_dir()); + probedirs[0] = LIBDIR; + probedirs[1] = gaim_user_dir(); + probedirs[2] = 0; for (l=0; probedirs[l]; l++) { dir = g_dir_open(probedirs[l], 0, NULL); if (dir) { while ((file = g_dir_read_name(dir))) { #ifdef GAIM_PLUGINS - if (is_so_file(file, ".so") && g_module_supported()) { + if (is_so_file(file, +#ifndef _WIN32 + ".so" +#else + ".dll" +#endif + ) && g_module_supported()) { path = g_build_filename(probedirs[l], file, NULL); handle = g_module_open(path, 0); if (!handle) { Index: multi.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/multi.c,v retrieving revision 1.132 retrieving revision 1.133 diff -u -d -r1.132 -r1.133 --- multi.c 30 Sep 2002 01:05:14 -0000 1.132 +++ multi.c 11 Oct 2002 03:13:59 -0000 1.133 @@ -454,7 +454,7 @@ gtk_file_selection_set_filename(GTK_FILE_SELECTION(dlg), tmp); g_free(tmp); } else { - g_snprintf(buf, sizeof(buf), "%s/", g_get_home_dir()); + g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); gtk_file_selection_set_filename(GTK_FILE_SELECTION(dlg), buf); } Index: perl.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/perl.c,v retrieving revision 1.82 retrieving revision 1.83 diff -u -d -r1.82 -r1.83 --- perl.c 30 Sep 2002 01:29:08 -0000 1.82 +++ perl.c 11 Oct 2002 03:13:59 -0000 1.83 @@ -35,20 +35,32 @@ #ifdef USE_PERL #define group perl_group - +#ifdef _WIN32 +/* This took me an age to figure out.. without this __declspec(dllimport) + * will be ignored. + */ +#define HASATTRIBUTE +#endif #include <EXTERN.h> #ifndef _SEM_SEMUN_UNDEFINED #define HAS_UNION_SEMUN #endif #include <perl.h> #include <XSUB.h> +#ifndef _WIN32 #include <sys/mman.h> +#endif #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #undef PACKAGE #include <stdio.h> +#ifndef _WIN32 #include <dirent.h> +#else +/* We're using perl's win32 port of this */ +#define dirent direct +#endif #include <string.h> #undef group @@ -61,6 +73,9 @@ #ifdef DEBUG #undef DEBUG #endif +#ifdef _WIN32 +#undef pipe +#endif #include "gaim.h" #include "prpl.h" @@ -185,11 +200,11 @@ sv = GvSV(gv_fetchpv("@", TRUE, SVt_PV)); if (SvTRUE(sv)) { - snprintf(buf, 512, "Perl error: %s\n", SvPV(sv, count)); + g_snprintf(buf, 512, "Perl error: %s\n", SvPV(sv, count)); debug_printf(buf); POPs; } else if (count != 1) { - snprintf(buf, 512, "Perl error: expected 1 value from %s, " + g_snprintf(buf, 512, "Perl error: expected 1 value from %s, " "got: %d\n", function, count); debug_printf(buf); } else { Index: prefs.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/prefs.c,v retrieving revision 1.257 retrieving revision 1.258 diff -u -d -r1.257 -r1.258 --- prefs.c 29 Sep 2002 01:36:11 -0000 1.257 +++ prefs.c 11 Oct 2002 03:13:59 -0000 1.258 @@ -96,6 +96,11 @@ static int notebook_page = 0; static GtkTreeIter plugin_iter; +/* + * PROTOTYPES + */ +GtkTreeIter *prefs_notebook_add_page(char*, GdkPixbuf*, GtkWidget*, GtkTreeIter*, GtkTreeIter*, int); + void delete_prefs(GtkWidget *asdf, void *gdsa) { int v; @@ -211,7 +216,9 @@ proxytype = proxytype_new; default_away = default_away_new; fontsize = fontsize_new; +#ifndef _WIN32 g_snprintf(sound_cmd, sizeof(sound_cmd), "%s", sound_cmd_new); +#endif g_snprintf(web_command, sizeof(web_command), "%s", web_command_new); memcpy(&conv_size, &conv_size_new, sizeof(struct window_size)); memcpy(&conv_size, &conv_size_new, sizeof(struct window_size)); @@ -653,7 +660,8 @@ gtk_container_set_border_width (GTK_CONTAINER (ret), 12); sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - +#ifndef _WIN32 + /* Registered default browser is used by Windows */ vbox = make_frame (ret, _("Browser Selection")); label = gaim_dropdown(vbox, "_Browser", &web_browser_new, -1, "Netscape", BROWSER_NETSCAPE, @@ -682,10 +690,13 @@ gtk_entry_set_text(GTK_ENTRY(browser_entry), web_command_new); gtk_signal_connect(GTK_OBJECT(browser_entry), "changed", GTK_SIGNAL_FUNC(browser_print_option), NULL); - +#endif /* end !_WIN32 */ vbox = make_frame (ret, _("Browser Options")); - gaim_button(_("Open new _window by default"), &misc_options_new, OPT_MISC_BROWSER_POPUP, vbox); - + label = gaim_button(_("Open new _window by default"), &misc_options_new, OPT_MISC_BROWSER_POPUP, vbox); +#ifdef _WIN32 + /* Until I figure out how to implement this on windows */ + gtk_widget_set_sensitive(label, FALSE); +#endif gtk_widget_show_all(ret); return ret; } @@ -740,6 +751,7 @@ gaim_button(_("_No sounds when you log in"), &sound_options_new, OPT_SOUND_SILENT_SIGNON, vbox); gaim_button(_("_Sounds while away"), &sound_options_new, OPT_SOUND_WHEN_AWAY, vbox); +#ifndef _WIN32 vbox = make_frame (ret, _("Sound Method")); dd = gaim_dropdown(vbox, "_Method", &sound_options_new, OPT_SOUND_BEEP | OPT_SOUND_ESD | OPT_SOUND_ARTSC | OPT_SOUND_NAS | OPT_SOUND_NORMAL | @@ -779,7 +791,7 @@ gtk_widget_set_sensitive(sndcmd, (sound_options_new & OPT_SOUND_CMD)); gtk_box_pack_start(GTK_BOX(hbox), sndcmd, TRUE, TRUE, 5); gtk_signal_connect(GTK_OBJECT(sndcmd), "focus_out_event", GTK_SIGNAL_FUNC(sound_cmd_yeah), NULL); - +#endif /* _WIN32 */ gtk_widget_show_all(ret); return ret; } @@ -874,10 +886,18 @@ g_snprintf(buf, sizeof(buf), _("<span size=\"larger\">%s %s</span>\n\n" "%s"), plug->desc.name, plug->desc.version, plug->desc.description); gtk_label_set_markup(GTK_LABEL(plugin_description), buf); - g_snprintf(buf, sizeof(buf), _("<span size=\"larger\">%s %s</span>\n\n" - "<span weight=\"bold\">Written by:</span>\t%s\n" - "<span weight=\"bold\">URL:</span>\t%s\n" - "<span weight=\"bold\">File name:</span>\t %s"), + g_snprintf(buf, sizeof(buf), +#ifndef _WIN32 + _("<span size=\"larger\">%s %s</span>\n\n" + "<span weight=\"bold\">Written by:</span>\t%s\n" + "<span weight=\"bold\">URL:</span>\t%s\n" + "<span weight=\"bold\">File name:</span>\t%s"), +#else + _("<span size=\"larger\">%s %s</span>\n\n" + "<span weight=\"bold\">Written by:</span> %s\n" + "<span weight=\"bold\">URL:</span> %s\n" + "<span weight=\"bold\">File name:</span> %s"), +#endif plug->desc.name, plug->desc.version, plug->desc.authors, plug->desc.url, plug->path); gtk_label_set_markup(GTK_LABEL(plugin_details), buf); g_value_unset (&val); @@ -910,7 +930,7 @@ prefs_notebook_add_page(plug->desc.name, NULL, config(), plug->iter, &plugin_iter, notebook_page++); if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(prefstree), &plugin_iter) == 1) { /* Expand the tree for the first plugin added */ - GtkTreePath *path2 = gtk_tree_model_get_path(prefstree, &plugin_iter); + GtkTreePath *path2 = gtk_tree_model_get_path(GTK_TREE_MODEL(prefstree), &plugin_iter); gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_v), path2, TRUE); gtk_tree_path_free (path2); } @@ -1030,14 +1050,14 @@ plugin_description = gtk_label_new(NULL); vp = gtk_viewport_new(NULL, NULL); - gtk_viewport_set_shadow_type(vp, GTK_SHADOW_NONE); + gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); - gtk_container_add(vp, plugin_description); - gtk_container_add(sw, vp); + gtk_container_add(GTK_CONTAINER(vp), plugin_description); + gtk_container_add(GTK_CONTAINER(sw), vp); - gtk_label_set_selectable(plugin_description, TRUE); - gtk_label_set_line_wrap(plugin_description, TRUE); + gtk_label_set_selectable(GTK_LABEL(plugin_description), TRUE); + gtk_label_set_line_wrap(GTK_LABEL(plugin_description), TRUE); gtk_misc_set_alignment(GTK_MISC(plugin_description), 0, 0); gtk_misc_set_padding(GTK_MISC(plugin_description), 6, 6); gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Description"))); @@ -1048,14 +1068,14 @@ plugin_details = gtk_label_new(NULL); vp = gtk_viewport_new(NULL, NULL); - gtk_viewport_set_shadow_type(vp, GTK_SHADOW_NONE); + gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); - gtk_container_add(vp, plugin_details); - gtk_container_add(sw, vp); + gtk_container_add(GTK_CONTAINER(vp), plugin_details); + gtk_container_add(GTK_CONTAINER(sw), vp); - gtk_label_set_selectable(plugin_details, TRUE); - gtk_label_set_line_wrap(plugin_details, TRUE); + gtk_label_set_selectable(GTK_LABEL(plugin_details), TRUE); + gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); gtk_misc_set_alignment(GTK_MISC(plugin_details), 0, 0); gtk_misc_set_padding(GTK_MISC(plugin_details), 6, 6); gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Details"))); @@ -1171,7 +1191,7 @@ gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(sounddialog)); - g_snprintf(buf, BUF_LEN - 1, "%s/", last_sound_dir ? last_sound_dir : g_get_home_dir()); + g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S, last_sound_dir ? last_sound_dir : gaim_home_dir()); gtk_file_selection_set_filename(GTK_FILE_SELECTION(sounddialog), buf); @@ -1519,8 +1539,10 @@ fontsize_new = fontsize; web_browser_new = web_browser; proxytype_new = proxytype; +#ifndef _WIN32 g_snprintf(sound_cmd_new, sizeof(sound_cmd_new), "%s", sound_cmd); - g_snprintf(web_command_new, sizeof(web_command_new), "%s", +#endif + g_snprintf(web_command_new, sizeof(web_command_new), "%s", web_command ? web_command : "xterm -e lynx %%s"); g_snprintf(fontface_new, sizeof(fontface_new), fontface); memcpy(&conv_size_new, &conv_size, sizeof(struct window_size)); Index: proxy.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/proxy.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- proxy.c 5 Aug 2002 07:56:37 -0000 1.43 +++ proxy.c 11 Oct 2002 03:13:59 -0000 1.44 @@ -30,16 +30,26 @@ #include <stdlib.h> #include <string.h> #include <sys/types.h> + +#ifndef _WIN32 #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> +#else +#include <winsock.h> +#endif + #include <fcntl.h> #include <errno.h> #include "gaim.h" #include "proxy.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + #define GAIM_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) #define GAIM_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) @@ -123,11 +133,20 @@ { static struct sockaddr_in sin; +#ifndef _WIN32 if (!inet_aton(host, &sin.sin_addr)) { +#else + if ((sin.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) { +#endif struct hostent *hp; - if (!(hp = gethostbyname(host))) { + if(!(hp = gethostbyname(host))) { +#ifndef _WIN32 debug_printf("gaim_gethostbyname(\"%s\", %d) failed: %s", host, port, hstrerror(h_errno)); +#else + debug_printf("gaim_gethostbyname(\"%s\", %d) failed: Error %d", + host, port, WSAGetLastError()); +#endif return NULL; } memset(&sin, 0, sizeof(struct sockaddr_in)); @@ -144,8 +163,26 @@ { struct PHB *phb = data; unsigned int len; +#ifdef _WIN32 + int werror = WSAETIMEDOUT; + u_long imode; +#else int error = ETIMEDOUT; +#endif debug_printf("Connected\n"); +#ifdef _WIN32 + len = sizeof(werror); + if (getsockopt(source, SOL_SOCKET, SO_ERROR, (char*)&werror, &len) < 0) { + closesocket(source); + gaim_input_remove(phb->inpa); + phb->func(phb->data, -1, GAIM_INPUT_READ); + g_free(phb); + return; + } else + WSASetLastError(werror); + imode=0; + ioctlsocket(source, FIONBIO, &imode); +#else len = sizeof(error); if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(source); @@ -155,6 +192,7 @@ return; } fcntl(source, F_SETFL, 0); +#endif gaim_input_remove(phb->inpa); phb->func(phb->data, source, GAIM_INPUT_READ); g_free(phb); @@ -175,7 +213,10 @@ { struct sockaddr_in *sin; int fd = -1; - +#ifdef _WIN32 + u_long imode; + int w_errno; +#endif debug_printf("connecting to %s:%d with no proxy\n", host, port); if (!(sin = gaim_gethostbyname(host, port))) { @@ -189,19 +230,50 @@ g_free(phb); return -1; } - +#ifdef _WIN32 + imode=1; + ioctlsocket(fd, FIONBIO, &imode); +#else fcntl(fd, F_SETFL, O_NONBLOCK); +#endif if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) { +#ifdef _WIN32 + w_errno = WSAGetLastError(); + if ((w_errno == WSAEINPROGRESS) || (w_errno == WSAEINTR) || (w_errno == WSAEWOULDBLOCK)) { +#else if ((errno == EINPROGRESS) || (errno == EINTR)) { +#endif debug_printf("Connect would have blocked\n"); phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, no_one_calls, phb); } else { +#ifdef _WIN32 + debug_printf("connect failed (errno %d)\n", w_errno); + closesocket(fd); +#else debug_printf("connect failed (errno %d)\n", errno); close(fd); +#endif g_free(phb); return -1; } } else { +#ifdef _WIN32 + int werror = WSAETIMEDOUT; + unsigned int len; + u_long imode; + + debug_printf("Connect didn't block\n"); + len = sizeof(werror); + if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&werror, &len) < 0) { + debug_printf("getsockopt failed\n"); + closesocket(fd); + g_free(phb); + return -1; + } else + WSASetLastError(werror); + imode=0; + ioctlsocket(fd, FIONBIO, &imode); +#else unsigned int len; int error = ETIMEDOUT; debug_printf("Connect didn't block\n"); @@ -213,6 +285,7 @@ return -1; } fcntl(fd, F_SETFL, 0); +#endif phb->port = fd; /* bleh */ g_timeout_add(50, clean_connect, phb); /* we do this because we never want to call our callback @@ -234,7 +307,11 @@ gaim_input_remove(phb->inpa); +#ifdef _WIN32 + while ((nlc != 2) && (recv(source, &inputline[pos++], 1, 0) == 1)) { +#else while ((nlc != 2) && (read(source, &inputline[pos++], 1) == 1)) { +#endif if (inputline[pos - 1] == '\n') nlc++; else if (inputline[pos - 1] != '\r') @@ -252,7 +329,11 @@ return; } +#ifdef _WIN32 + closesocket(source); +#else close(source); +#endif phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); @@ -264,24 +345,44 @@ char cmd[384]; struct PHB *phb = data; unsigned int len; +#ifdef _WIN32 + int w_error = WSAETIMEDOUT; + u_long imode = 0; +#else int error = ETIMEDOUT; +#endif debug_printf("Connected\n"); if (phb->inpa > 0) gaim_input_remove(phb->inpa); +#ifdef _WIN32 + len = sizeof(w_error); + if (getsockopt(source, SOL_SOCKET, SO_ERROR, (char*)&w_error, &len) < 0) { + closesocket(source); +#else len = sizeof(error); if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(source); +#endif phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; +#ifdef _WIN32 + } else + WSASetLastError( w_error ); + ioctlsocket(source, FIONBIO, &imode); +#else } fcntl(source, F_SETFL, 0); - +#endif g_snprintf(cmd, sizeof(cmd), "CONNECT %s:%d HTTP/1.1\r\nHost: %s:%d\r\n", phb->host, phb->port, phb->host, phb->port); if (send(source, cmd, strlen(cmd), 0) < 0) { +#ifdef _WIN32 + closesocket(source); +#else close(source); +#endif phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); @@ -296,7 +397,11 @@ g_snprintf(cmd, sizeof(cmd), "Proxy-Authorization: Basic %s\r\n", t2); g_free(t2); if (send(source, cmd, strlen(cmd), 0) < 0) { +#ifdef _WIN32 + closesocket(source); +#else close(source); +#endif phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); @@ -306,7 +411,11 @@ g_snprintf(cmd, sizeof(cmd), "\r\n"); if (send(source, cmd, strlen(cmd), 0) < 0) { +#ifdef _WIN32 + closesocket(source); +#else close(source); +#endif phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); @@ -320,6 +429,9 @@ { struct sockaddr_in *sin; int fd = -1; +#ifdef _WIN32 + u_long imode; +#endif debug_printf("connecting to %s:%d via %s:%d using HTTP\n", host, port, proxyhost, proxyport); @@ -336,29 +448,61 @@ phb->host = g_strdup(host); phb->port = port; +#ifdef _WIN32 + imode = 1; + ioctlsocket(fd, FIONBIO, &imode); +#else fcntl(fd, F_SETFL, O_NONBLOCK); +#endif if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) { +#ifdef _WIN32 + int w_errno = WSAGetLastError(); + if ((w_errno == WSAEINPROGRESS) || (w_errno == WSAEINTR)) { +#else if ((errno == EINPROGRESS) || (errno == EINTR)) { +#endif debug_printf("Connect would have blocked\n"); phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, http_canwrite, phb); } else { +#ifdef _WIN32 + closesocket(fd); +#else close(fd); +#endif g_free(phb->host); g_free(phb); return -1; } } else { unsigned int len; +#ifdef _WIN32 + int werror = WSAETIMEDOUT; + u_long imode; +#else int error = ETIMEDOUT; +#endif debug_printf("Connect didn't block\n"); +#ifdef _WIN32 + len = sizeof(werror); + if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&werror, &len) < 0) { + closesocket(fd); +#else len = sizeof(error); if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(fd); +#endif g_free(phb->host); g_free(phb); return -1; +#ifdef _WIN32 + } else + WSASetLastError(werror); + imode=0; + ioctlsocket(fd, FIONBIO, &imode); +#else } fcntl(fd, F_SETFL, 0); +#endif http_canwrite(phb, fd, GAIM_INPUT_WRITE); } @@ -373,14 +517,22 @@ gaim_input_remove(phb->inpa); memset(packet, 0, sizeof(packet)); +#ifdef _WIN32 + if (recv(source, packet, 9, 0) >= 4 && packet[1] == 90) { +#else if (read(source, packet, 9) >= 4 && packet[1] == 90) { +#endif phb->func(phb->data, source, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; } +#ifdef _WIN32 + closesocket(source); +#else close(source); +#endif phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); @@ -392,23 +544,44 @@ struct hostent *hp; struct PHB *phb = data; unsigned int len; +#ifdef _WIN32 + int werror = WSAETIMEDOUT; + u_long imode; +#else int error = ETIMEDOUT; +#endif debug_printf("Connected\n"); if (phb->inpa > 0) gaim_input_remove(phb->inpa); +#ifdef _WIN32 + len = sizeof(werror); + if (getsockopt(source, SOL_SOCKET, SO_ERROR, (char*)&werror, &len) < 0) { + closesocket(source); +#else len = sizeof(error); if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(source); +#endif phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; +#ifdef _WIN32 + } else + WSASetLastError(werror); + imode=0; + ioctlsocket(source, FIONBIO, &imode); +#else } fcntl(source, F_SETFL, 0); - +#endif /* XXX does socks4 not support host name lookups by the proxy? */ if (!(hp = gethostbyname(phb->host))) { +#ifdef _WIN32 + closesocket(source); +#else close(source); +#endif phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); @@ -424,8 +597,13 @@ packet[6] = (unsigned char)(hp->h_addr_list[0])[2]; packet[7] = (unsigned char)(hp->h_addr_list[0])[3]; packet[8] = 0; +#ifdef _WIN32 + if (send(source, packet, 9, 0) != 9) { + closesocket(source); +#else if (write(source, packet, 9) != 9) { close(source); +#endif phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); @@ -439,6 +617,10 @@ { struct sockaddr_in *sin; int fd = -1; +#ifdef _WIN32 + int werrno; + u_long imode; +#endif debug_printf("connecting to %s:%d via %s:%d using SOCKS4\n", host, port, proxyhost, proxyport); @@ -455,29 +637,61 @@ phb->host = g_strdup(host); phb->port = port; +#ifdef _WIN32 + imode=1; + ioctlsocket(fd, FIONBIO, &imode); +#else fcntl(fd, F_SETFL, O_NONBLOCK); +#endif if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) { +#ifdef _WIN32 + werrno = WSAGetLastError(); + if ((werrno == WSAEINPROGRESS) || (werrno == WSAEINTR)) { +#else if ((errno == EINPROGRESS) || (errno == EINTR)) { +#endif debug_printf("Connect would have blocked\n"); phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, s4_canwrite, phb); } else { +#ifdef _WIN32 + closesocket(fd); +#else close(fd); +#endif g_free(phb->host); g_free(phb); return -1; } } else { unsigned int len; +#ifdef _WIN32 + int werror = WSAETIMEDOUT; + u_long imode; +#else int error = ETIMEDOUT; +#endif debug_printf("Connect didn't block\n"); +#ifdef _WIN32 + len = sizeof(werror); + if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&werror, &len) < 0) { + closesocket(fd); +#else len = sizeof(error); if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(fd); +#endif g_free(phb->host); g_free(phb); return -1; +#ifdef _WIN32 + } else + WSASetLastError(werror); + imode=0; + ioctlsocket(fd, FIONBIO, &imode); +#else } fcntl(fd, F_SETFL, 0); +#endif s4_canwrite(phb, fd, GAIM_INPUT_WRITE); } @@ -4... [truncated message content] |
From: Rob F. <rob...@us...> - 2002-10-11 03:14:03
|
Update of /cvsroot/gaim/gaim/src/protocols/jabber/win32 In directory usw-pr-cvs1:/tmp/cvs-serv28946/src/protocols/jabber/win32 Added Files: posix.uname.c utsname.h Log Message: Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. --- NEW FILE: posix.uname.c --- /* posix.uname.c - version 1.1 Copyright (C) 1999, 2000 Earnie Boyd and assigns Fills the utsname structure with the appropriate values. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICUALR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Send bug reports to Earnie Boyd <ear...@ya...> */ #include "utsname.h" #include <string.h> #include <stdio.h> /* ANONYMOUS unions and structs are used from the windows header definitions. These need to be defined for them to work correctly with gcc2.95.2-mingw. */ /*#define _ANONYMOUS_STRUCT*/ /*#define _ANONYMOUS_UNION*/ #include <windows.h> #include <_mingw.h> int uname( struct utsname *uts ) { DWORD sLength; OSVERSIONINFO OS_version; SYSTEM_INFO System_Info; /* XXX Should these be in the global runtime */ enum WinOS {Win95, Win98, WinNT, unknown}; int MingwOS; memset( uts, 0, sizeof ( *uts ) ); OS_version.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); GetVersionEx ( &OS_version ); GetSystemInfo ( &System_Info ); strcpy( uts->sysname, "MINGW_" ); switch( OS_version.dwPlatformId ) { case VER_PLATFORM_WIN32_NT: strcat( uts->sysname, "WinNT" ); MingwOS = WinNT; break; case VER_PLATFORM_WIN32_WINDOWS: switch ( OS_version.dwMinorVersion ) { case 0: strcat( uts->sysname, "Win95" ); MingwOS = Win95; break; case 10: strcat( uts->sysname, "Win98" ); MingwOS = Win98; break; default: strcat( uts->sysname, "Win??" ); MingwOS = unknown; break; } break; default: strcat( uts->sysname, "Win??" ); MingwOS = unknown; break; } sprintf( uts->version, "%i", __MINGW32_MAJOR_VERSION ); sprintf( uts->release, "%i", __MINGW32_MINOR_VERSION ); switch( System_Info.wProcessorArchitecture ) { case PROCESSOR_ARCHITECTURE_PPC: strcpy( uts->machine, "ppc" ); break; case PROCESSOR_ARCHITECTURE_ALPHA: strcpy( uts->machine, "alpha" ); break; case PROCESSOR_ARCHITECTURE_MIPS: strcpy( uts->machine, "mips" ); break; case PROCESSOR_ARCHITECTURE_INTEL: /* dwProcessorType is only valid in Win95 and Win98 wProcessorLevel is only valid in WinNT */ switch( MingwOS ) { case Win95: case Win98: switch( System_Info.dwProcessorType ) { case PROCESSOR_INTEL_386: case PROCESSOR_INTEL_486: case PROCESSOR_INTEL_PENTIUM: sprintf( uts->machine, "i%ld", System_Info.dwProcessorType ); break; default: strcpy( uts->machine, "i386" ); break; } break; case WinNT: sprintf( uts->machine, "i%d86", System_Info.wProcessorLevel ); break; default: strcpy( uts->machine, "unknown" ); break; } break; default: strcpy( uts->machine, "unknown" ); break; } sLength = sizeof ( uts->nodename ) - 1; GetComputerNameA( uts->nodename, &sLength ); return 1; } --- NEW FILE: utsname.h --- #ifndef _SYS_UTSNAME_H #define _SYS_UTSNAME_H #ifdef __cplusplus extern "C" { #endif struct utsname { char sysname[20]; char nodename[20]; char release[20]; char version[20]; char machine[20]; }; int uname (struct utsname *); #ifdef __cplusplus } #endif #endif |
From: Rob F. <rob...@us...> - 2002-10-11 03:14:03
|
Update of /cvsroot/gaim/gaim/src/protocols/msn In directory usw-pr-cvs1:/tmp/cvs-serv28946/src/protocols/msn Modified Files: msn.c Added Files: Makefile.mingw Log Message: Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. --- NEW FILE: Makefile.mingw --- # # Makefile.mingw # # Description: Makefile for win32 (mingw) version of libmsn # # # PATHS # INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. MSN_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir ## ## VARIABLE DEFINITIONS ## TARGET = libmsn VERSION := $(shell cat $(GAIM_TOP)/VERSION) # Compiler Options CC = gcc CFLAGS = -O2 -Werror -Wall -mno-cygwin -fnative-struct DEFINES = -DAIM_BUILDDATE=\"`date +%Y%m%d`\" \ -DAIM_BUILDTIME=\"`date +%H%M%S`\" \ -DVERSION=\"$(VERSION)\" \ -DHAVE_CONFIG_H # Static or Plugin... ifeq ($(TYPE),STATIC) DEFINES += -DSTATIC DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR) else ifeq ($(TYPE),PLUGIN) DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR)/plugins endif endif ## ## INCLUDE MAKEFILES ## ## ## INCLUDE PATHS ## INCLUDE_PATHS += -I$(MSN_ROOT) \ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/include/pango-1.0 \ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ -I$(GAIM_TOP)/src \ -I$(GAIM_TOP)/src/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(GAIM_TOP)/src ## ## SOURCES, OBJECTS ## C_SRC = msn.c OBJECTS = $(C_SRC:%.c=%.o) ## ## LIBRARIES ## LIBS = -lgtk-win32-2.0 -lglib-2.0 -lgdk-win32-2.0 -lgmodule-2.0 -lgobject-2.0 -lws2_32 -lintl -lgaim # -liberty ## ## RULES ## # How to make a C file %.o: %.c $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@ -c $< ## ## TARGET DEFINITIONS ## .PHONY: all clean all: $(TARGET).dll install: cp $(MSN_ROOT)/$(TARGET).dll $(DLL_INSTALL_DIR) ## ## BUILD Dependencies ## $(GAIM_TOP)/src/gaim.lib: $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib ## ## BUILD DLL ## $(TARGET).def: $(OBJECTS) dlltool --dllname $(TARGET).dll -z $(TARGET).def \ $(OBJECTS) $(TARGET).base: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib gcc -mdll -o junk.tmp -Wl,--base-file,$@ $(OBJECTS) $(LIB_PATHS) $(LIBS) rm -rf junk.tmp $(TARGET).exp: $(TARGET).def $(TARGET).base dlltool --dllname $(TARGET).dll --base-file $(TARGET).base \ --output-exp $(TARGET).exp --def $(TARGET).def rm -rf $(TARGET).base $(TARGET).dll: $(OBJECTS) $(TARGET).exp $(GAIM_TOP)/src/gaim.lib dlltool -D $(TARGET).dll -d $(TARGET).def -l $(TARGET).lib gcc -mdll -o $(TARGET).dll $(OBJECTS) -Wl,$(TARGET).exp $(LIB_PATHS) $(LIBS) rm -rf $(TARGET).exp ## ## CLEAN RULES ## clean: rm -rf *.o rm -rf $(TARGET).dll rm -rf $(TARGET).lib rm -rf $(TARGET).def Index: msn.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/msn/msn.c,v retrieving revision 1.99 retrieving revision 1.100 diff -u -d -r1.99 -r1.100 --- msn.c 6 Oct 2002 02:56:09 -0000 1.99 +++ msn.c 11 Oct 2002 03:14:00 -0000 1.100 @@ -1,16 +1,27 @@ #include "config.h" +#ifndef _WIN32 +#include <unistd.h> +#else +#include <winsock.h> +#include <io.h> +#endif + + #include <stdlib.h> #include <string.h> #include <errno.h> #include <stdio.h> -#include <unistd.h> #include <ctype.h> #include "gaim.h" #include "prpl.h" #include "proxy.h" #include "md5.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + #include "pixmaps/protocols/msn/msn_online.xpm" #include "pixmaps/protocols/msn/msn_away.xpm" #include "pixmaps/protocols/msn/msn_occ.xpm" @@ -64,6 +75,9 @@ #include "pixmaps/protocols/msn/msn_devil.xpm" #include "pixmaps/protocols/msn/msn_wink.xpm" +/* for win32 compatability */ +G_MODULE_IMPORT GSList *connections; + #define MSN_BUF_LEN 8192 #define MIME_HEADER "MIME-Version: 1.0\r\n" \ "Content-Type: text/plain; charset=UTF-8\r\n" \ @@ -168,7 +182,11 @@ static int msn_write(int fd, void *data, int len) { debug_printf("MSN C: %s", data); +#ifndef _WIN32 return write(fd, data, len); +#else + return send(fd, data, len, 0); +#endif } static char *url_decode(const char *msg) @@ -444,7 +462,11 @@ if (ms->inpa) gaim_input_remove(ms->inpa); +#ifndef _WIN32 close(ms->fd); +#else + closesocket(ms->fd); +#endif g_free(ms->rxqueue); if (ms->msg) g_free(ms->msguser); @@ -695,9 +717,11 @@ /* This is really stupid and I hate to put this here. */ if (ms->fd != source) ms->fd = source; - +#ifndef _WIN32 len = read(ms->fd, buf, sizeof(buf)); - +#else + len = recv(ms->fd, buf, sizeof(buf), 0); +#endif if (len <= 0) { msn_kill_switch(ms); return; @@ -773,7 +797,11 @@ char buf[MSN_BUF_LEN]; if (source == -1 || !g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif g_free(ms->sessid); g_free(ms->auth); g_free(ms); @@ -787,7 +815,11 @@ g_snprintf(buf, sizeof(buf), "ANS %d %s %s %s\r\n", ++ms->trId, gc->username, ms->auth, ms->sessid); if (msn_write(ms->fd, buf, strlen(buf)) < 0) { +#ifndef _WIN32 close(ms->fd); +#else + closesocket(ms->fd); +#endif g_free(ms->sessid); g_free(ms->auth); g_free(ms); @@ -805,7 +837,11 @@ char buf[MSN_BUF_LEN]; if (source == -1 || !g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif if (g_slist_find(connections, gc)) { msn_kill_switch(ms); do_error_dialog(_("Gaim was unable to send an MSN message"), @@ -1251,7 +1287,7 @@ GET_NEXT(tmp); passport = tmp; - snprintf(hippy, sizeof(hippy), "%s%lu%s", md->mspauth, time(NULL) - md->sl, gc->password); + g_snprintf(hippy, sizeof(hippy), "%s%lu%s", md->mspauth, time(NULL) - md->sl, gc->password); md5_init(&st); md5_append(&st, (const md5_byte_t *)hippy, strlen(hippy)); @@ -1268,32 +1304,35 @@ g_free(md->passport); } - fd = gaim_mkstemp(&(md->passport)); - fprintf(fd, "<html>\n"); - fprintf(fd, "<head>\n"); - fprintf(fd, "<noscript>\n"); - fprintf(fd, "<meta http-equiv=Refresh content=\"0; url=http://www.hotmail.com\">\n"); - fprintf(fd, "</noscript>\n"); - fprintf(fd, "</head>\n\n"); + if( (fd = gaim_mkstemp(&(md->passport))) == NULL ) { + debug_printf("Error opening temp file\n"); + } + else { + fprintf(fd, "<html>\n"); + fprintf(fd, "<head>\n"); + fprintf(fd, "<noscript>\n"); + fprintf(fd, "<meta http-equiv=Refresh content=\"0; url=http://www.hotmail.com\">\n"); + fprintf(fd, "</noscript>\n"); + fprintf(fd, "</head>\n\n"); - fprintf(fd, "<body onload=\"document.pform.submit(); \">\n"); - fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n", passport); - fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n"); - fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n", gc->username); - fprintf(fd, "<input type=\"hidden\" name=\"username\" value=\"%s\">\n", gc->username); - fprintf(fd, "<input type=\"hidden\" name=\"sid\" value=\"%s\">\n", md->sid); - fprintf(fd, "<input type=\"hidden\" name=\"kv\" value=\"%s\">\n", md->kv); - fprintf(fd, "<input type=\"hidden\" name=\"id\" value=\"2\">\n"); - fprintf(fd, "<input type=\"hidden\" name=\"sl\" value=\"%ld\">\n", time(NULL) - md->sl); - fprintf(fd, "<input type=\"hidden\" name=\"rru\" value=\"%s\">\n", rru); - fprintf(fd, "<input type=\"hidden\" name=\"auth\" value=\"%s\">\n", md->mspauth); - fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", sendbuf); // Digest me - fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n"); - fprintf(fd, "<input type=\"hidden\" name=\"js\" value=\"yes\">\n"); - fprintf(fd, "</form></body>\n"); - fprintf(fd, "</html>\n"); - fclose(fd); - + fprintf(fd, "<body onload=\"document.pform.submit(); \">\n"); + fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n", passport); + fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n"); + fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n", gc->username); + fprintf(fd, "<input type=\"hidden\" name=\"username\" value=\"%s\">\n", gc->username); + fprintf(fd, "<input type=\"hidden\" name=\"sid\" value=\"%s\">\n", md->sid); + fprintf(fd, "<input type=\"hidden\" name=\"kv\" value=\"%s\">\n", md->kv); + fprintf(fd, "<input type=\"hidden\" name=\"id\" value=\"2\">\n"); + fprintf(fd, "<input type=\"hidden\" name=\"sl\" value=\"%ld\">\n", time(NULL) - md->sl); + fprintf(fd, "<input type=\"hidden\" name=\"rru\" value=\"%s\">\n", rru); + fprintf(fd, "<input type=\"hidden\" name=\"auth\" value=\"%s\">\n", md->mspauth); + fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", sendbuf); // Digest me + fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n"); + fprintf(fd, "<input type=\"hidden\" name=\"js\" value=\"yes\">\n"); + fprintf(fd, "</form></body>\n"); + fprintf(fd, "</html>\n"); + fclose(fd); + } } else if (!g_strncasecmp(buf, "SYN", 3)) { } else if (!g_strncasecmp(buf, "USR", 3)) { } else if (!g_strncasecmp(buf, "XFR", 3)) { @@ -1341,7 +1380,11 @@ } ms->auth = g_strdup(tmp); } else { +#ifndef _WIN32 close(md->fd); +#else + closesocket(md->fd); +#endif gaim_input_remove(md->inpa); md->inpa = 0; md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); @@ -1431,8 +1474,11 @@ int cont = 1; int len; +#ifndef _WIN32 len = read(md->fd, buf, sizeof(buf)); - +#else + len = recv(md->fd, buf, sizeof(buf), 0); +#endif if (len <= 0) { hide_login_progress_error(gc, _("Error reading from server")); signoff(gc); @@ -1508,7 +1554,11 @@ char buf[MSN_BUF_LEN]; if (!g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif return; } @@ -1644,7 +1694,11 @@ } else port = 1863; +#ifndef _WIN32 close(md->fd); +#else + closesocket(md->fd); +#endif gaim_input_remove(md->inpa); md->inpa = 0; md->fd = 0; @@ -1675,8 +1729,11 @@ int cont = 1; int len; +#ifndef _WIN32 len = read(md->fd, buf, sizeof(buf)); - +#else + len = recv(md->fd, buf, sizeof(buf), 0); +#endif if (len <= 0) { hide_login_progress(gc, _("Error reading from server")); signoff(gc); @@ -1730,7 +1787,11 @@ char buf[1024]; if (!g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif return; } @@ -1777,7 +1838,11 @@ static void msn_close(struct gaim_connection *gc) { struct msn_data *md = gc->proto_data; +#ifndef _WIN32 close(md->fd); +#else + closesocket(md->fd); +#endif if (md->inpa) gaim_input_remove(md->inpa); g_free(md->rxqueue); @@ -2504,7 +2569,7 @@ static struct prpl *my_protocol = NULL; -void msn_init(struct prpl *ret) +G_MODULE_EXPORT void msn_init(struct prpl *ret) { struct proto_user_opt *puo; ret->protocol = PROTO_MSN; @@ -2554,25 +2619,25 @@ #ifndef STATIC -void *gaim_prpl_init(struct prpl *prpl) +G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl) { msn_init(prpl); prpl->plug->desc.api_version = PLUGIN_API_VERSION; } -void gaim_plugin_remove() +G_MODULE_EXPORT void gaim_plugin_remove() { struct prpl *p = find_prpl(PROTO_MSN); if (p == my_protocol) unload_protocol(p); } -char *name() +G_MODULE_EXPORT char *name() { return "MSN"; } -char *description() +G_MODULE_EXPORT char *description() { return PRPL_DESC("MSN"); } |