Mercurial > pidgin.yaz
comparison src/protocols/zephyr/zephyr.c @ 2804:1648c703ddc2
[gaim-migrate @ 2817]
Arun A Tharuvai's Zephyr patch
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 27 Nov 2001 21:26:51 +0000 |
parents | 8f6365332a05 |
children | b1e300a85678 |
comparison
equal
deleted
inserted
replaced
2803:e967c0d93930 | 2804:1648c703ddc2 |
---|---|
356 | 356 |
357 free(user); | 357 free(user); |
358 } | 358 } |
359 } else { | 359 } else { |
360 char *buf, *buf2; | 360 char *buf, *buf2; |
361 char *send_inst; | |
361 char *ptr = notice.z_message + strlen(notice.z_message) + 1; | 362 char *ptr = notice.z_message + strlen(notice.z_message) + 1; |
362 int len = notice.z_message_len - (ptr - notice.z_message); | 363 int len = notice.z_message_len - (ptr - notice.z_message); |
363 int away; | 364 int away; |
364 if (len > 0) { | 365 if (len > 0) { |
365 buf = g_malloc(len + 1); | 366 buf = g_malloc(len + 1); |
384 } else { | 385 } else { |
385 if (!zt2->open) { | 386 if (!zt2->open) { |
386 zt2->open = TRUE; | 387 zt2->open = TRUE; |
387 serv_got_joined_chat(zgc, zt2->id, zt2->name); | 388 serv_got_joined_chat(zgc, zt2->id, zt2->name); |
388 } | 389 } |
389 serv_got_chat_in(zgc, zt2->id, notice.z_sender, FALSE, | 390 send_inst = g_strdup_printf("%s %s", notice.z_sender, |
390 buf2, time((time_t)NULL)); | 391 notice.z_class_inst); |
392 serv_got_chat_in(zgc, zt2->id, send_inst, FALSE, | |
393 buf2, time(NULL)); | |
394 g_free(send_inst); | |
391 } | 395 } |
392 free_triple(zt1); | 396 free_triple(zt1); |
393 } | 397 } |
394 g_free(buf2); | 398 g_free(buf2); |
395 } | 399 } |
493 while (fgets(buff, BUFSIZ, f)) { | 497 while (fgets(buff, BUFSIZ, f)) { |
494 strip_comments(buff); | 498 strip_comments(buff); |
495 if (buff[0]) { | 499 if (buff[0]) { |
496 triple = g_strsplit(buff, ",", 3); | 500 triple = g_strsplit(buff, ",", 3); |
497 if (triple[0] && triple[1] && triple[2]) { | 501 if (triple[0] && triple[1] && triple[2]) { |
502 char *tmp = g_strdup_printf("%s@%s", g_getenv("USER"), | |
503 ZGetRealm()); | |
504 char *atptr; | |
498 sub.zsub_class = triple[0]; | 505 sub.zsub_class = triple[0]; |
499 sub.zsub_classinst = triple[1]; | 506 sub.zsub_classinst = triple[1]; |
500 if (!g_strcasecmp(triple[2], "%me%")) { | 507 if (!g_strcasecmp(triple[2], "%me%")) { |
501 recip = g_strdup_printf("%s@%s", g_getenv("USER"), | 508 recip = g_strdup_printf("%s@%s", g_getenv("USER"), |
502 ZGetRealm()); | 509 ZGetRealm()); |
503 } else if (!g_strcasecmp(triple[2], "*")) { | 510 } else if (!g_strcasecmp(triple[2], "*")) { |
504 /* wildcard */ | 511 /* wildcard |
505 recip = g_strdup_printf("@%s", ZGetRealm()); | 512 * form of class,instance,* */ |
513 recip = g_malloc0(1); | |
514 } else if (!g_strcasecmp(triple[2], tmp)) { | |
515 /* form of class,instance,aatharuv@ATHENA.MIT.EDU */ | |
516 recip = g_strdup(triple[2]); | |
517 } else if ((atptr = strchr(triple[2], '@')) != NULL) { | |
518 /* form of class,instance,*@ANDREW.CMU.EDU | |
519 * class,instance,@ANDREW.CMU.EDU | |
520 * If realm is local realm, blank recipient, else | |
521 * @REALM-NAME | |
522 */ | |
523 char *realmat = g_strdup_printf("@%s", ZGetRealm()); | |
524 if (!g_strcasecmp(atptr, realmat)) | |
525 recip = g_malloc0(1); | |
526 else | |
527 recip = g_strdup(atptr); | |
528 g_free(realmat); | |
506 } else { | 529 } else { |
507 recip = g_strdup(triple[2]); | 530 recip = g_strdup(triple[2]); |
508 } | 531 } |
532 g_free(tmp); | |
509 sub.zsub_recipient = recip; | 533 sub.zsub_recipient = recip; |
510 if (ZSubscribeTo(&sub, 1, 0) != ZERR_NONE) { | 534 if (ZSubscribeTo(&sub, 1, 0) != ZERR_NONE) { |
511 debug_printf("Zephyr: Couldn't subscribe to %s, %s, " | 535 debug_printf("Zephyr: Couldn't subscribe to %s, %s, " |
512 "%s\n", | 536 "%s\n", |
513 sub.zsub_class, | 537 sub.zsub_class, |
572 do_import(zgc, NULL); | 596 do_import(zgc, NULL); |
573 process_anyone(); | 597 process_anyone(); |
574 process_zsubs(); | 598 process_zsubs(); |
575 | 599 |
576 nottimer = g_timeout_add(100, check_notify, NULL); | 600 nottimer = g_timeout_add(100, check_notify, NULL); |
577 loctimer = g_timeout_add(2000, check_loc, NULL); | 601 loctimer = g_timeout_add(20000, check_loc, NULL); |
578 } | 602 } |
579 | 603 |
580 static void write_zsubs() | 604 static void write_zsubs() |
581 { | 605 { |
582 GSList *s = subscrips; | 606 GSList *s = subscrips; |