src/protocols/zephyr/zephyr.c

changeset 7261
4be05820d441
parent 7126
fc9c1b53de71
child 7262
f04a37a4e529
equal deleted inserted replaced
7260:c5e414a66c3f 7261:4be05820d441
69 #define z_call_s(func, err) if (func != ZERR_NONE) {\ 69 #define z_call_s(func, err) if (func != ZERR_NONE) {\
70 gaim_connection_error(zgc, err);\ 70 gaim_connection_error(zgc, err);\
71 return;\ 71 return;\
72 } 72 }
73 73
74 static char *zephyr_normalize(const char *); 74 static const char *zephyr_normalize(const GaimAccount *, const char *);
75 75
76 /* this is so bad, and if Zephyr weren't so fucked up to begin with I 76 /* this is so bad, and if Zephyr weren't so fucked up to begin with I
77 * wouldn't do this. but it is so i will. */ 77 * wouldn't do this. but it is so i will. */
78 static guint32 nottimer = 0; 78 static guint32 nottimer = 0;
79 static guint32 loctimer = 0; 79 static guint32 loctimer = 0;
305 305
306 static gboolean pending_zloc(char *who) 306 static gboolean pending_zloc(char *who)
307 { 307 {
308 GList *curr; 308 GList *curr;
309 for (curr = pending_zloc_names; curr != NULL; curr = curr->next) { 309 for (curr = pending_zloc_names; curr != NULL; curr = curr->next) {
310 if (!g_ascii_strcasecmp(zephyr_normalize(who), (char*)curr->data)) { 310 if (!g_ascii_strcasecmp(zephyr_normalize(NULL, who), (char*)curr->data)) {
311 g_free((char*)curr->data); 311 g_free((char*)curr->data);
312 pending_zloc_names = g_list_remove(pending_zloc_names, curr->data); 312 pending_zloc_names = g_list_remove(pending_zloc_names, curr->data);
313 return TRUE; 313 return TRUE;
314 } 314 }
315 } 315 }
463 for(bnode = cnode->child; bnode; bnode = bnode->next) { 463 for(bnode = cnode->child; bnode; bnode = bnode->next) {
464 GaimBuddy *b = (GaimBuddy *)bnode; 464 GaimBuddy *b = (GaimBuddy *)bnode;
465 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) 465 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
466 continue; 466 continue;
467 if(b->account->gc == zgc) { 467 if(b->account->gc == zgc) {
468 char *chk; 468 const char *chk;
469 chk = zephyr_normalize(b->name); 469 chk = zephyr_normalize(b->account, b->name);
470 /* doesn't matter if this fails or not; we'll just move on to the next one */ 470 /* doesn't matter if this fails or not; we'll just move on to the next one */
471 ZRequestLocations(chk, &ald, UNACKED, ZAUTH); 471 ZRequestLocations(chk, &ald, UNACKED, ZAUTH);
472 free(ald.user); 472 free(ald.user);
473 free(ald.version); 473 free(ald.version);
474 } 474 }
781 notice.z_port = 0; 781 notice.z_port = 0;
782 notice.z_opcode = ""; 782 notice.z_opcode = "";
783 notice.z_class = zt->class; 783 notice.z_class = zt->class;
784 notice.z_class_inst = zt->instance; 784 notice.z_class_inst = zt->instance;
785 if (!g_ascii_strcasecmp(zt->recipient, "*")) 785 if (!g_ascii_strcasecmp(zt->recipient, "*"))
786 notice.z_recipient = zephyr_normalize(""); 786 notice.z_recipient = zephyr_normalize(NULL, "");
787 else 787 else
788 notice.z_recipient = zephyr_normalize(zt->recipient); 788 notice.z_recipient = zephyr_normalize(NULL, zt->recipient);
789 notice.z_sender = 0; 789 notice.z_sender = 0;
790 notice.z_default_format = 790 notice.z_default_format =
791 "Class $class, Instance $instance:\n" 791 "Class $class, Instance $instance:\n"
792 "To: @bold($recipient) at $time $date\n" 792 "To: @bold($recipient) at $time $date\n"
793 "From: @bold($1) <$sender>\n\n$2"; 793 "From: @bold($1) <$sender>\n\n$2";
830 ZSendNotice(&notice, ZAUTH); 830 ZSendNotice(&notice, ZAUTH);
831 g_free(buf); 831 g_free(buf);
832 return 1; 832 return 1;
833 } 833 }
834 834
835 static char *zephyr_normalize(const char *orig) 835 static const char *zephyr_normalize(const GaimAccount *account, const char *orig)
836 { 836 {
837 static char buf[80]; 837 static char buf[80];
838 if (!g_ascii_strcasecmp(orig, "")) { 838 if (!g_ascii_strcasecmp(orig, "")) {
839 buf[0] = '\0'; 839 buf[0] = '\0';
840 return buf; 840 return buf;
848 } 848 }
849 849
850 static void zephyr_zloc(GaimConnection *gc, const char *who) 850 static void zephyr_zloc(GaimConnection *gc, const char *who)
851 { 851 {
852 ZAsyncLocateData_t ald; 852 ZAsyncLocateData_t ald;
853 853
854 if (ZRequestLocations(zephyr_normalize(who), &ald, UNACKED, ZAUTH) 854 if (ZRequestLocations(zephyr_normalize(gc->account, who), &ald, UNACKED, ZAUTH)
855 != ZERR_NONE) { 855 != ZERR_NONE) {
856 return; 856 return;
857 } 857 }
858 pending_zloc_names = g_list_append(pending_zloc_names, 858 pending_zloc_names = g_list_append(pending_zloc_names,
859 g_strdup(zephyr_normalize(who))); 859 g_strdup(zephyr_normalize(gc->account, who)));
860 } 860 }
861 861
862 static GList *zephyr_buddy_menu(GaimConnection *gc, const char *who) 862 static GList *zephyr_buddy_menu(GaimConnection *gc, const char *who)
863 { 863 {
864 GList *m = NULL; 864 GList *m = NULL;

mercurial