Mercurial > pidgin
diff src/protocols/zephyr/zephyr.c @ 10867:5727afad0fb8
[gaim-migrate @ 12553]
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
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 25 Apr 2005 01:53:01 +0000 |
parents | bf5e48215158 |
children | 50224ac8184d |
line wrap: on
line diff
--- a/src/protocols/zephyr/zephyr.c Mon Apr 25 00:31:24 2005 +0000 +++ b/src/protocols/zephyr/zephyr.c Mon Apr 25 01:53:01 2005 +0000 @@ -143,6 +143,9 @@ 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 @@ /* 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 @@ } 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 @@ 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 @@ 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 @@ return TRUE; } +#endif /* WIN32 */ + static char *get_exposure_level() { /* XXX add real error reporting */ @@ -1297,14 +1342,14 @@ 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 @@ 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 @@ 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 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 @@ 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>",