diff src/protocols/zephyr/zephyr.c @ 9426:dfee44a581a4

[gaim-migrate @ 10244] " This patch causes gaim to write out a file containing an ascii representation of the big-endian version of the port number which gaim listens in on for incoming zephyrs, of the form "gaimwgXXXXXX". It will be useful for debugging occasional problems with zephyr loss of subscriptions (chats). I've made some changes in util.c to allow the creation of temporary files with arbitrary templates: I've renamed gaim_mkstemp to gaim_mkstemp_template, modifying it to take a second argument, template, and use that instead of gaim_mkstemp_templ. A new gaim_mkstemp which is a wrapper around gaim_mkstemp_template has been put in place for compatibility with all the existing code using this function." --Arun A Tharuvai "The patch I submitted causes the wgfile to always be written out, because it would be useful for endusers too, and also to try to keep it consistent with the standard zephyr distribution." --Arun A Tharuvai committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 29 Jun 2004 17:23:08 +0000
parents 33e6b2b92cfe
children 66b3f54527e6
line wrap: on
line diff
--- a/src/protocols/zephyr/zephyr.c	Tue Jun 29 13:33:44 2004 +0000
+++ b/src/protocols/zephyr/zephyr.c	Tue Jun 29 17:23:08 2004 +0000
@@ -894,7 +894,9 @@
 static void zephyr_login(GaimAccount * account)
 {
 	ZSubscription_t sub;
-
+	unsigned short port = 0;
+	FILE* wgfile;
+	char* wgfilename;
 	if (zgc) {
 		gaim_notify_error(account->gc, NULL,
 						  _("Already logged in with Zephyr"), _("Because Zephyr uses your system username, you " "are unable to have multiple accounts on it " "when logged in as the same user."));
@@ -906,19 +908,24 @@
 	gaim_connection_update_progress(zgc, _("Connecting"), 0, 2);
 
 	z_call_s(ZInitialize(), "Couldn't initialize zephyr");
-	z_call_s(ZOpenPort(NULL), "Couldn't open port");
+	z_call_s(ZOpenPort(&port), "Couldn't open port");
 	z_call_s(ZSetLocation((char *)
 						  gaim_account_get_string(zgc->account, "exposure_level", EXPOSE_REALMVIS)), "Couldn't set location");
 
 	sub.zsub_class = "MESSAGE";
 	sub.zsub_classinst = "PERSONAL";
 	sub.zsub_recipient = (char *)gaim_zephyr_get_sender();
-
+	
 	/* we don't care if this fails. i'm lying right now. */
 	if (ZSubscribeTo(&sub, 1, 0) != ZERR_NONE) {
 		gaim_debug(GAIM_DEBUG_ERROR, "zephyr", "Couldn't subscribe to messages!\n");
 	}
 
+	wgfile = gaim_mkstemp_template(&wgfilename,"gaimwgXXXXXX");
+	if (wgfile) {
+		fprintf(wgfile,"%d\n",port);
+		fclose(wgfile);
+	}
 	gaim_connection_set_state(zgc, GAIM_CONNECTED);
 	serv_finish_login(zgc);