From: Mark D. <the...@us...> - 2005-04-25 01:53:12
|
Update of /cvsroot/gaim/gaim/src/protocols/zephyr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32041 Modified Files: ZAsyncLocate.c ZGetSender.c ZGetWGPort.c ZInit.c ZLocations.c ZMkAuth.c ZOpenPort.c ZSendPkt.c ZVariables.c ZWait4Not.c ZhmStat.c Zinternal.c internal.h sysdep.h zephyr.c zephyr.h Added Files: Makefile.mingw Log Message: sf patch #991208, from Arun A Tharuvai "Here's a patch, against current CVS, to build and compile zephyr on Windows, with, or without Kerberos 4 Authentication. In order to be built (and run) with Kerberos 4 authentication, the Kerberos for Windows SDK (version 2.6.3 is the current version) (licensed under the MIT license) and runtimes, both available from http://web.mit.edu/kerberos/www/dist/index.html#KFW2.6.3 Also, USE_KRB4 should be set to true in the attached Makefile.mingw As on the UNIX side, an external 'zhm' binary needs to run for zephyr to work. Source and a win32 executable (using code from gaim's libzephyr, and also MIT's zephyr distribution), can be found at http://web.mit.edu/aatharuv/www/zhm-windows.html" I decided not to make zephyr compiled by default in Windows. If you want to compile it, I think you you can modify the root Makefile.mingw or cd to the src/protocols/zephyr/ directory and run "make -f Makefile.mingw" using make from mingw --- NEW FILE: Makefile.mingw --- # # Makefile.mingw # # Description: Makefile for win32 (mingw) version of libzephyr # # # PATHS # INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. ZEPHYR_ROOT := . KRB4_TOP := ../../../../win32-dev/kfw-2.6.3-final.fixed GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir USE_KRB4 := false ## ## VARIABLE DEFINITIONS ## TARGET = libzephyr # Compiler Options CFLAGS = DEFINES = # 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 DEFINES += -DWIN32 -DKRB5_SYSTYPES__ ifeq ($(USE_KRB4),true) DEFINES += -DZEPHYR_USES_KERBEROS endif ## ## INCLUDE MAKEFILES ## include $(GAIM_TOP)/src/win32/global.mak ## ## INCLUDE PATHS ## INCLUDE_PATHS += -I$(ZEPHYR_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) ifeq ($(USE_KRB4), true) INCLUDE_PATHS += -I$(KRB4_TOP)/inc/krb4 endif LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(GAIM_TOP)/src ifeq ($(USE_KRB4), true) LIB_PATHS+=-L$(KRB4_TOP)/lib/i386 endif ## ## SOURCES, OBJECTS ## C_SRC = ZAsyncLocate.c \ ZCkAuth.c \ ZCkIfNot.c \ ZClosePort.c \ ZCmpUID.c \ ZCmpUIDP.c \ ZFlsLocs.c \ ZFlsSubs.c \ ZFmtAuth.c \ ZFmtList.c \ ZFmtNotice.c \ ZFmtRaw.c \ ZFmtRawLst.c \ ZFmtSmRLst.c \ ZFmtSmRaw.c \ ZFreeNot.c \ ZGetLocs.c \ ZGetSender.c \ ZGetSubs.c \ ZGetWGPort.c \ ZIfNotice.c \ ZInit.c \ ZLocations.c \ ZMakeAscii.c \ ZMkAuth.c \ ZNewLocU.c \ ZOpenPort.c \ ZParseNot.c \ ZPeekIfNot.c \ ZPeekNot.c \ ZPeekPkt.c \ ZPending.c \ ZReadAscii.c \ ZRecvNot.c \ ZRecvPkt.c \ ZRetSubs.c \ ZSendList.c \ ZSendNot.c \ ZSendPkt.c \ ZSendRLst.c \ ZSendRaw.c \ ZSetDest.c \ ZSetFD.c \ ZSetSrv.c \ ZSubs.c \ ZVariables.c \ ZWait4Not.c \ ZhmStat.c \ Zinternal.c \ error_message.c \ et_name.c \ init_et.c \ zephyr_err.c \ zephyr.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 ifeq ($(USE_KRB4),true) LIBS+= -lkrbv4w32 endif ## ## 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 $(ZEPHYR_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).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--enable-stdcall-fixup -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll ## ## CLEAN RULES ## clean: rm -rf *.o rm -rf $(TARGET).dll rm -rf $(TARGET).lib Index: ZAsyncLocate.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZAsyncLocate.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -p -r1.4 -r1.5 --- ZAsyncLocate.c 24 Apr 2004 09:00:35 -0000 1.4 +++ ZAsyncLocate.c 25 Apr 2005 01:53:00 -0000 1.5 @@ -20,7 +20,7 @@ static const char rcsid_ZAsyncLocate_c[] Code_t ZRequestLocations(user, zald, kind, auth) const char *user; - register ZAsyncLocateData_t *zald; + ZAsyncLocateData_t *zald; ZNotice_Kind_t kind; /* UNSAFE, UNACKED, or ACKED */ Z_AuthProc auth; { @@ -60,8 +60,8 @@ Code_t ZRequestLocations(user, zald, kin } Code_t ZParseLocations(notice,zald,nlocs,user) - register ZNotice_t *notice; - register ZAsyncLocateData_t *zald; + ZNotice_t *notice; + ZAsyncLocateData_t *zald; int *nlocs; char **user; { @@ -160,7 +160,7 @@ int ZCompareALDPred(notice, zald) } void ZFreeALD(zald) - register ZAsyncLocateData_t *zald; + ZAsyncLocateData_t *zald; { if (!zald) return; Index: ZGetSender.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZGetSender.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- ZGetSender.c 18 Sep 2004 22:25:11 -0000 1.3 +++ ZGetSender.c 25 Apr 2005 01:53:00 -0000 1.4 @@ -19,7 +19,9 @@ static const char rcsid_ZGetSender_c[] = "$Id$"; #endif +#ifndef WIN32 #include <pwd.h> +#endif char *ZGetSender() { @@ -27,10 +29,15 @@ char *ZGetSender() #ifdef ZEPHYR_USES_KERBEROS char pname[ANAME_SZ], pinst[INST_SZ], prealm[REALM_SZ]; static char sender[ANAME_SZ+INST_SZ+REALM_SZ+3] = ""; + long int kerror; #else static char sender[128] = ""; #endif +#ifdef WIN32 + unsigned long sender_size = 127; +#endif + /* Return it if already cached */ /* if (*sender) @@ -38,19 +45,26 @@ char *ZGetSender() */ #ifdef ZEPHYR_USES_KERBEROS - if (krb_get_tf_fullname((char *)TKT_FILE, pname, pinst, prealm) == KSUCCESS) + if ((kerror = krb_get_tf_fullname((char *)TKT_FILE, pname, pinst, prealm)) == KSUCCESS) { (void) sprintf(sender, "%s%s%s@%s", pname, (pinst[0]?".":""), pinst, prealm); return (sender); + } else { + sprintf(sender,"%s@%s",(username?username:"unknown"),__Zephyr_realm); + return (sender); } #endif /* XXX a uid_t is a u_short (now), but getpwuid * wants an int. AARGH! */ +#ifdef WIN32 + GetUserName(sender, &sender_size); +#else pw = getpwuid((int) getuid()); if (!pw) return ("unknown"); (void) sprintf(sender, "%s@%s", pw->pw_name, __Zephyr_realm); +#endif return (sender); } Index: ZGetWGPort.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZGetWGPort.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -p -r1.4 -r1.5 --- ZGetWGPort.c 12 Feb 2005 01:28:04 -0000 1.4 +++ ZGetWGPort.c 25 Apr 2005 01:53:00 -0000 1.5 @@ -23,10 +23,18 @@ int ZGetWGPort() char *envptr, name[128]; FILE *fp; int wgport; - +#ifdef WIN32 + long int buffsize= 128; + char tempdir[buffsize]; +#endif envptr = getenv("WGFILE"); if (!envptr) { +#ifdef WIN32 + GetTempPath(buffsize,tempdir); + GetTempFileName(tempdir,"wg.",0,name); +#else (void) sprintf(name, "/tmp/wg.%d", getuid()); +#endif envptr = name; } if (!(fp = fopen(envptr, "r"))) Index: ZInit.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZInit.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- ZInit.c 24 Apr 2004 09:02:28 -0000 1.3 +++ ZInit.c 25 Apr 2005 01:53:00 -0000 1.4 @@ -17,13 +17,23 @@ static char rcsid_ZInitialize_c[] = "$Zephyr: /afs/athena.mit.edu/astaff/project/zephyr/src/lib/RCS/ZInitialize.c,v 1.17 89/05/30 18:11:25 jtkohl Exp $"; #endif +#ifdef ZEPHYR_USES_KERBEROS +#ifdef WIN32 + +#else +#include <krb_err.h> +#endif +#endif + #include "internal.h" +#ifdef WIN32 +#include <winsock2.h> +#else #include <sys/socket.h> -#ifdef ZEPHYR_USES_KERBEROS -#include <krb_err.h> #endif + #ifndef INADDR_NONE #define INADDR_NONE 0xffffffff #endif @@ -43,7 +53,7 @@ Code_t ZInitialize() int krbval; char d1[ANAME_SZ], d2[INST_SZ]; - initialize_krb_error_table(); + /* initialize_krb_error_table(); */ #endif initialize_zeph_error_table(); Index: ZLocations.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZLocations.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -p -r1.6 -r1.7 --- ZLocations.c 8 Dec 2004 00:24:37 -0000 1.6 +++ ZLocations.c 25 Apr 2005 01:53:01 -0000 1.7 @@ -20,7 +20,9 @@ static char rcsid_ZLocations_c[] = #include "internal.h" +#ifndef WIN32 #include <pwd.h> +#endif extern char *getenv(); extern int errno; @@ -55,11 +57,14 @@ Code_t Z_SendLocation(class, opcode, aut int retval; time_t ourtime; ZNotice_t notice, retnotice; - char *bptr[3], *p; + char *bptr[3]; #ifndef X_DISPLAY_MISSING char *display; #endif +#ifndef WIN32 char *ttyp; + char *p; +#endif struct hostent *hent; short wg_port = ZGetWGPort(); @@ -95,6 +100,9 @@ Code_t Z_SendLocation(class, opcode, aut mytty[sizeof(mytty)-1] = '\0'; } else { #endif +#ifdef WIN32 + strcpy(mytty,"WinGaim"); +#else ttyp = ttyname(0); if (ttyp && *ttyp) { p = strchr(ttyp + 1, '/'); @@ -102,6 +110,7 @@ Code_t Z_SendLocation(class, opcode, aut } else { strcpy(mytty, "unknown"); } +#endif #ifndef X_DISPLAY_MISSING } #endif Index: ZMkAuth.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZMkAuth.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -p -r1.4 -r1.5 --- ZMkAuth.c 24 Apr 2004 09:02:28 -0000 1.4 +++ ZMkAuth.c 25 Apr 2005 01:53:01 -0000 1.5 @@ -18,8 +18,16 @@ static const char rcsid_ZMakeAuthentication_c[] = "$Id$"; #endif +#ifndef ERROR_TABLE_BASE_krb +#define ERROR_TABLE_BASE_krb (39525376L) +#endif + #ifdef ZEPHYR_USES_KERBEROS +#ifdef WIN32 + +#else #include <krb_err.h> +#endif static long last_authent_time = 0L; static KTEXT_ST last_authent; #endif Index: ZOpenPort.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZOpenPort.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- ZOpenPort.c 24 Apr 2004 09:02:28 -0000 1.3 +++ ZOpenPort.c 25 Apr 2005 01:53:01 -0000 1.4 @@ -17,7 +17,11 @@ static char rcsid_ZOpenPort_c[] = "$Head #endif #include "internal.h" +#ifdef WIN32 +#include <winsock2.h> +#else #include <sys/socket.h> +#endif Code_t ZOpenPort(port) unsigned short *port; Index: ZSendPkt.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZSendPkt.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -p -r1.4 -r1.5 --- ZSendPkt.c 24 Apr 2004 09:02:28 -0000 1.4 +++ ZSendPkt.c 25 Apr 2005 01:53:01 -0000 1.5 @@ -18,8 +18,11 @@ static char rcsid_ZSendPacket_c[] = #endif #include "internal.h" +#ifdef WIN32 +#include <winsock.h> +#else #include <sys/socket.h> - +#endif static int wait_for_hmack(); Code_t ZSendPacket(packet, len, waitforack) Index: ZVariables.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZVariables.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -p -r1.10 -r1.11 --- ZVariables.c 2 Apr 2005 16:07:20 -0000 1.10 +++ ZVariables.c 25 Apr 2005 01:53:01 -0000 1.11 @@ -21,7 +21,9 @@ static char rcsid_ZVariables_c[] = "$Hea #include "util.h" #include <ctype.h> +#ifndef WIN32 #include <pwd.h> +#endif static int get_localvarfile __P((char *bfr)); static char *get_varval __P((char *fn, char *val)); @@ -38,7 +40,11 @@ char *ZGetVariable(var) if ((ret = get_varval(varfile, var)) != ZERR_NONE) return (ret); +#ifdef WIN32 + sprintf(varfile, "C:\\zephyr\\zephyr.var"); +#else sprintf(varfile, "%s/zephyr.vars", CONFDIR); +#endif return (get_varval(varfile, var)); } @@ -116,17 +122,26 @@ static int get_localvarfile(bfr) char *bfr; { const char *envptr; +#ifndef WIN32 struct passwd *pwd; - envptr = gaim_home_dir(); +#else + envptr = getenv("HOME"); + if (!envptr) + envptr = getenv("HOMEPATH"); + if (!envptr) + envptr = "C:\\"; +#endif if (envptr) (void) strcpy(bfr, envptr); else { +#ifndef WIN32 if (!(pwd = getpwuid((int) getuid()))) { fprintf(stderr, "Zephyr internal failure: Can't find your entry in /etc/passwd\n"); return (1); } (void) strcpy(bfr, pwd->pw_dir); +#endif } (void) strcat(bfr, "/"); @@ -174,7 +189,9 @@ static int varline(bfr, var) while (*cp && !isspace(*cp) && (*cp != '=')) cp++; +#ifndef WIN32 #define max(a,b) ((a > b) ? (a) : (b)) +#endif if (strncasecmp(bfr, var, max(strlen(var),cp - bfr))) return(0); /* var is not the var in Index: ZWait4Not.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZWait4Not.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- ZWait4Not.c 24 Apr 2004 09:02:28 -0000 1.2 +++ ZWait4Not.c 25 Apr 2005 01:53:01 -0000 1.3 @@ -19,7 +19,27 @@ static char rcsid_ZWaitForNotice_c[] = " #endif #include "internal.h" + +#ifdef WIN32 +#include <winsock2.h> + +#ifndef ZEPHYR_USES_KERBEROS +static int gettimeofday(struct timeval* tv, struct timezone* tz){ + union { + long long ns100; /*time since 1 Jan 1601 in 100ns units */ + FILETIME ft; + } _now; + + GetSystemTimeAsFileTime( &(_now.ft) ); + tv->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL ); + tv->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL); + return 0; + } +#endif + +#else #include <sys/socket.h> +#endif Code_t Z_WaitForNotice (notice, pred, arg, timeout) ZNotice_t *notice; @@ -43,7 +63,7 @@ Code_t Z_WaitForNotice (notice, pred, ar FD_ZERO (&fdmask); tv.tv_sec = timeout; tv.tv_usec = 0; - gettimeofday (&t0, (struct timezone *) 0); + gettimeofday (&t0, (struct timezone *)NULL); t0.tv_sec += timeout; while (1) { FD_SET (fd, &fdmask); @@ -58,7 +78,7 @@ Code_t Z_WaitForNotice (notice, pred, ar if (retval != ZERR_NONOTICE) /* includes ZERR_NONE */ return retval; } - gettimeofday (&tv, (struct timezone *) 0); + gettimeofday (&tv, (struct timezone *) NULL); tv.tv_usec = t0.tv_usec - tv.tv_usec; if (tv.tv_usec < 0) { tv.tv_usec += 1000000; Index: ZhmStat.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/ZhmStat.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- ZhmStat.c 24 Apr 2004 09:02:28 -0000 1.2 +++ ZhmStat.c 25 Apr 2005 01:53:01 -0000 1.3 @@ -11,7 +11,12 @@ */ #include "internal.h" + +#ifdef WIN32 +#include <winsock2.h> +#else #include <sys/socket.h> +#endif #ifndef INADDR_LOOPBACK #define INADDR_LOOPBACK 0x7f000001 Index: Zinternal.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/Zinternal.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -p -r1.5 -r1.6 --- Zinternal.c 24 Apr 2004 09:02:28 -0000 1.5 +++ Zinternal.c 25 Apr 2005 01:53:01 -0000 1.6 @@ -14,9 +14,28 @@ /* $Header$ */ #include "internal.h" +#ifdef WIN32 +#include <winsock2.h> + +#ifndef ZEPHYR_USES_KERBEROS + int gettimeofday(struct timeval* p, struct timezone* tz ){ + union { + long long ns100; /*time since 1 Jan 1601 in 100ns units */ + FILETIME ft; + } _now; + + GetSystemTimeAsFileTime( &(_now.ft) ); + p->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL ); + p->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL); + return 0; + } +#endif + +#else #include <arpa/inet.h> #include <sys/socket.h> #include <utmp.h> +#endif #ifndef lint static const char rcsid_Zinternal_c[] = Index: internal.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/internal.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- internal.h 3 Oct 2001 19:38:28 -0000 1.2 +++ internal.h 25 Apr 2005 01:53:01 -0000 1.3 @@ -1,10 +1,31 @@ #ifndef __INTERNAL_H__ #define __INTERNAL_H__ +#if 0 +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; +#endif #include <sysdep.h> -#include <zephyr/zephyr.h> + +#include <zephyr.h> +#ifndef WIN32 #include <netdb.h> +#endif + + + +#ifdef WIN32 + +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 512 +#endif + +#define ETIMEDOUT WSAETIMEDOUT +#define EADDRINUSE WSAEADDRINUSE +#endif #ifdef ZEPHYR_USES_HESIOD #include <hesiod.h> Index: sysdep.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/sysdep.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- sysdep.h 31 Jul 2001 01:00:39 -0000 1.1 +++ sysdep.h 25 Apr 2005 01:53:01 -0000 1.2 @@ -21,7 +21,10 @@ #include <ctype.h> #include <time.h> #include <signal.h> +#ifndef WIN32 #include <syslog.h> +#endif + #include <sys/types.h> #include <sys/stat.h> #include <sys/param.h> @@ -163,15 +166,21 @@ ZEPHYR_INT32 gethostid(); /* Kerberos compatibility. */ #ifdef ZEPHYR_USES_KERBEROS # include <krb.h> +#ifdef WIN32 + +#else # include <krb_err.h> +#endif /* WIN32 */ # include <des.h> +#ifndef WIN32 # ifndef HAVE_KRB_GET_ERR_TEXT # define krb_get_err_text(n) krb_err_txt[n] # endif +#endif /* WIN32 */ # ifndef HAVE_KRB_LOG # define krb_log log # endif -#endif +#endif /* ZEPHYR_USES_KERBEROS */ #ifdef HAVE_SYS_UIO_H # include <sys/uio.h> Index: zephyr.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/zephyr.c,v retrieving revision 1.138 retrieving revision 1.139 diff -u -d -p -r1.138 -r1.139 --- zephyr.c 27 Mar 2005 17:50:35 -0000 1.138 +++ zephyr.c 25 Apr 2005 01:53:01 -0000 1.139 @@ -143,6 +143,9 @@ struct _zephyr_triple { return;\ } +#ifdef WIN32 +extern const char *username; +#endif Code_t zephyr_subscribe_to(zephyr_account* zephyr, char* class, char *instance, char *recipient, char* galaxy) { @@ -203,16 +206,16 @@ char *zephyr_strip_local_realm(zephyr_ac /* just for debugging */ static void handle_unknown(ZNotice_t notice) { - gaim_debug(GAIM_DEBUG_MISC, "zephyr","z_packet: %s\n", notice.z_packet); - gaim_debug(GAIM_DEBUG_MISC, "zephyr","z_version: %s\n", notice.z_version); - gaim_debug(GAIM_DEBUG_MISC, "zephyr","z_kind: %d\n", (int)(notice.z_kind)); - gaim_debug(GAIM_DEBUG_MISC, "zephyr","z_class: %s\n", notice.z_class); - gaim_debug(GAIM_DEBUG_MISC, "zephyr","z_class_inst: %s\n", notice.z_class_inst); - gaim_debug(GAIM_DEBUG_MISC, "zephyr","z_opcode: %s\n", notice.z_opcode); - gaim_debug(GAIM_DEBUG_MISC, "zephyr","z_sender: %s\n", notice.z_sender); - gaim_debug(GAIM_DEBUG_MISC, "zephyr","z_recipient: %s\n", notice.z_recipient); - gaim_debug(GAIM_DEBUG_MISC, "zephyr","z_message: %s\n", notice.z_message); - gaim_debug(GAIM_DEBUG_MISC, "zephyr","z_message_len: %d\n", notice.z_message_len); + gaim_debug_error("zephyr","z_packet: %s\n", notice.z_packet); + gaim_debug_error("zephyr","z_version: %s\n", notice.z_version); + gaim_debug_error("zephyr","z_kind: %d\n", (int)(notice.z_kind)); + gaim_debug_error("zephyr","z_class: %s\n", notice.z_class); + gaim_debug_error("zephyr","z_class_inst: %s\n", notice.z_class_inst); + gaim_debug_error("zephyr","z_opcode: %s\n", notice.z_opcode); + gaim_debug_error("zephyr","z_sender: %s\n", notice.z_sender); + gaim_debug_error("zephyr","z_recipient: %s\n", notice.z_recipient); + gaim_debug_error("zephyr","z_message: %s\n", notice.z_message); + gaim_debug_error("zephyr","z_message_len: %d\n", notice.z_message_len); } @@ -325,7 +328,7 @@ static gchar *zephyr_recv_convert(GaimCo } else { utf8 = g_convert(string, len, "UTF-8", zephyr->encoding, NULL, NULL, &err); if (err) { - gaim_debug(GAIM_DEBUG_ERROR, "zephyr", "recv conversion error: %s\n", err->message); + gaim_debug_error("zephyr", "recv conversion error: %s\n", err->message); utf8 = g_strdup(_("(There was an error converting this message. Check the 'Encoding' option in the Account Editor)")); g_error_free(err); } @@ -846,7 +849,7 @@ static void handle_message(GaimConnectio send_inst = g_strdup_printf("%s %s",sendertmp,notice.z_class_inst); send_inst_utf8 = zephyr_recv_convert(gc,send_inst, strlen(send_inst)); if (!send_inst_utf8) { - gaim_debug(GAIM_DEBUG_ERROR, "zephyr","send_inst %s became null\n", send_inst); + gaim_debug_error("zephyr","send_inst %s became null\n", send_inst); send_inst_utf8 = "malformed instance"; } @@ -1196,6 +1199,46 @@ static gint check_notify_zeph02(gpointer return TRUE; } +#ifdef WIN32 + +static gint check_loc(gpointer_data) +{ + GaimBlistNode *gnode, *cnode, *bnode; + ZLocations_t locations; + int numlocs; + int one = 1; + + for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { + if (!GAIM_BLIST_NODE_IS_GROUP(gnode)) + continue; + for (cnode = gnode->child; cnode; cnode = cnode->next) { + if (!GAIM_BLIST_NODE_IS_CONTACT(cnode)) + continue; + for (bnode = cnode->child; bnode; bnode = bnode->next) { + GaimBuddy *b = (GaimBuddy *) bnode; + + if (!GAIM_BLIST_NODE_IS_BUDDY(bnode)) + continue; + if (b->account->gc == zgc) { + char *chk; + chk = local_zephyr_normalize(b->name); + ZLocateUser(chk,&numlocs, ZAUTH); + if (numlocs) { + int i; + for(i=0;i<numlocs;i++) { + ZGetLocations(&locations,&one); + serv_got_update(zgc,b->name,1,0,0,0,0); + } + } + } + } + } + } + return TRUE; +} + +#else + static gint check_loc(gpointer data) { GaimBlistNode *gnode, *cnode, *bnode; @@ -1261,6 +1304,8 @@ static gint check_loc(gpointer data) return TRUE; } +#endif /* WIN32 */ + static char *get_exposure_level() { /* XXX add real error reporting */ @@ -1297,14 +1342,14 @@ static void zephyr_inithosts(zephyr_acco struct hostent *hent; if (gethostname(zephyr->ourhost, sizeof(zephyr->ourhost)) == -1) { - gaim_debug(GAIM_DEBUG_ERROR, "zephyr", "unable to retrieve hostname, %%host%% and %%canon%% will be wrong in subscriptions and have been set to unknown\n"); + gaim_debug_error("zephyr", "unable to retrieve hostname, %%host%% and %%canon%% will be wrong in subscriptions and have been set to unknown\n"); g_strlcpy(zephyr->ourhost, "unknown", sizeof(zephyr->ourhost)); g_strlcpy(zephyr->ourhostcanon, "unknown", sizeof(zephyr->ourhostcanon)); return; } if (!(hent = gethostbyname(zephyr->ourhost))) { - gaim_debug(GAIM_DEBUG_ERROR,"zephyr", "unable to resolve hostname, %%canon%% will be wrong in subscriptions.and has been set to the value of %%host%%, %s\n",zephyr->ourhost); + gaim_debug_error("zephyr", "unable to resolve hostname, %%canon%% will be wrong in subscriptions.and has been set to the value of %%host%%, %s\n",zephyr->ourhost); g_strlcpy(zephyr->ourhostcanon, zephyr->ourhost, sizeof(zephyr->ourhostcanon)); return; } @@ -1395,7 +1440,7 @@ static void process_zsubs(zephyr_account if (zephyr_subscribe_to(zephyr,z_class, z_instance, recip,z_galaxy) != ZERR_NONE) { - gaim_debug(GAIM_DEBUG_ERROR, "zephyr", "Couldn't subscribe to %s, %s, %s\n", z_class,z_instance,recip); + gaim_debug_error("zephyr", "Couldn't subscribe to %s, %s, %s\n", z_class,z_instance,recip); } zephyr->subscrips = g_slist_append(zephyr->subscrips, new_triple(zephyr,z_class,z_instance,recip)); @@ -1474,6 +1519,9 @@ static void zephyr_login(GaimAccount * a read_zsubs = gaim_account_get_bool(gc->account,"read_zsubs",TRUE); exposure = (gchar *)gaim_account_get_string(gc->account, "exposure_level", EXPOSE_REALMVIS); +#ifdef WIN32 + username = gaim_account_get_username(account); +#endif gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_NO_BGCOLOR | GAIM_CONNECTION_NO_URLDESC; gc->proto_data = zephyr=g_new0(zephyr_account,1); @@ -2105,7 +2153,7 @@ static int zephyr_send_message(zephyr_ac static const char *zephyr_normalize(const GaimAccount * account, const char *orig) { /* returns the string you gave it. Maybe this function shouldn't be here */ - char * buf = g_malloc0(80); + static char buf[80]; /* gaim_debug_error("zephyr","entering zephyr_normalize\n"); */ if (!g_ascii_strcasecmp(orig, "")) { @@ -2691,19 +2739,19 @@ static void zephyr_action_get_subs_from_ title = g_strdup_printf("Server subscriptions for %s", zephyr->username); if (zephyr->port == 0) { - gaim_debug(GAIM_DEBUG_ERROR,"zephyr", "error while retrieving port"); + gaim_debug_error("zephyr", "error while retrieving port"); return; } if ((retval = ZRetrieveSubscriptions(zephyr->port,&nsubs)) != ZERR_NONE) { /* XXX better error handling */ - gaim_debug(GAIM_DEBUG_ERROR,"zephyr", "error while retrieving subscriptions from server"); + gaim_debug_error("zephyr", "error while retrieving subscriptions from server"); return; } for(i=0;i<nsubs;i++) { one = 1; if ((retval = ZGetSubscriptions(&subs,&one)) != ZERR_NONE) { /* XXX better error handling */ - gaim_debug(GAIM_DEBUG_ERROR,"zephyr", "error while retrieving individual subscription"); + gaim_debug_error("zephyr", "error while retrieving individual subscription"); return; } g_string_append_printf(subout, "Class %s Instance %s Recipient %s<br>", Index: zephyr.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/zephyr/zephyr.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -p -r1.5 -r1.6 --- zephyr.h 11 Nov 2003 07:08:13 -0000 1.5 +++ zephyr.h 25 Apr 2005 01:53:01 -0000 1.6 @@ -20,11 +20,13 @@ #include <sys/types.h> #include <sys/time.h> -#include <zephyr/zephyr_err.h> +#include <zephyr_err.h> #ifndef IPPROTO_MAX /* Make sure not already included */ +#ifndef WIN32 #include <netinet/in.h> #endif +#endif /* Use __STDC__ to guess whether we can use stdarg, prototypes, and const. * This is a public header file, so autoconf can't help us here. */ @@ -37,6 +39,16 @@ # define ZCONST #endif +#ifdef WIN32 +/* this really should be uint32_t */ +/*typedef unsigned int in_addr_t; +struct in_addr +{ + in_addr_t s_addr; +}; */ +#include <winsock2.h> +#endif + /* Service names */ #define HM_SVCNAME "zephyr-hm" #define HM_SRV_SVCNAME "zephyr-hm-srv" @@ -243,7 +255,7 @@ void ZSetDebug ZP((void (*)(ZCONST char #define ZERR_NONE 0 /* Hostmanager wait time (in secs) */ -#define HM_TIMEOUT 10 +#define HM_TIMEOUT 1 /* Server wait time (in secs) */ #define SRV_TIMEOUT 30 |