comparison 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
comparison
equal deleted inserted replaced
9425:42afbd004e6a 9426:dfee44a581a4
892 } 892 }
893 893
894 static void zephyr_login(GaimAccount * account) 894 static void zephyr_login(GaimAccount * account)
895 { 895 {
896 ZSubscription_t sub; 896 ZSubscription_t sub;
897 897 unsigned short port = 0;
898 FILE* wgfile;
899 char* wgfilename;
898 if (zgc) { 900 if (zgc) {
899 gaim_notify_error(account->gc, NULL, 901 gaim_notify_error(account->gc, NULL,
900 _("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.")); 902 _("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."));
901 return; 903 return;
902 } 904 }
904 zgc = gaim_account_get_connection(account); 906 zgc = gaim_account_get_connection(account);
905 zgc->flags |= GAIM_CONNECTION_HTML; 907 zgc->flags |= GAIM_CONNECTION_HTML;
906 gaim_connection_update_progress(zgc, _("Connecting"), 0, 2); 908 gaim_connection_update_progress(zgc, _("Connecting"), 0, 2);
907 909
908 z_call_s(ZInitialize(), "Couldn't initialize zephyr"); 910 z_call_s(ZInitialize(), "Couldn't initialize zephyr");
909 z_call_s(ZOpenPort(NULL), "Couldn't open port"); 911 z_call_s(ZOpenPort(&port), "Couldn't open port");
910 z_call_s(ZSetLocation((char *) 912 z_call_s(ZSetLocation((char *)
911 gaim_account_get_string(zgc->account, "exposure_level", EXPOSE_REALMVIS)), "Couldn't set location"); 913 gaim_account_get_string(zgc->account, "exposure_level", EXPOSE_REALMVIS)), "Couldn't set location");
912 914
913 sub.zsub_class = "MESSAGE"; 915 sub.zsub_class = "MESSAGE";
914 sub.zsub_classinst = "PERSONAL"; 916 sub.zsub_classinst = "PERSONAL";
915 sub.zsub_recipient = (char *)gaim_zephyr_get_sender(); 917 sub.zsub_recipient = (char *)gaim_zephyr_get_sender();
916 918
917 /* we don't care if this fails. i'm lying right now. */ 919 /* we don't care if this fails. i'm lying right now. */
918 if (ZSubscribeTo(&sub, 1, 0) != ZERR_NONE) { 920 if (ZSubscribeTo(&sub, 1, 0) != ZERR_NONE) {
919 gaim_debug(GAIM_DEBUG_ERROR, "zephyr", "Couldn't subscribe to messages!\n"); 921 gaim_debug(GAIM_DEBUG_ERROR, "zephyr", "Couldn't subscribe to messages!\n");
920 } 922 }
921 923
924 wgfile = gaim_mkstemp_template(&wgfilename,"gaimwgXXXXXX");
925 if (wgfile) {
926 fprintf(wgfile,"%d\n",port);
927 fclose(wgfile);
928 }
922 gaim_connection_set_state(zgc, GAIM_CONNECTED); 929 gaim_connection_set_state(zgc, GAIM_CONNECTED);
923 serv_finish_login(zgc); 930 serv_finish_login(zgc);
924 931
925 process_anyone(); 932 process_anyone();
926 process_zsubs(); 933 process_zsubs();