Mercurial > hg
comparison mcabber/src/jabglue.c @ 159:ba51d1737086
[/trunk] Changeset 171 by mikael
* Use glib2 in jabglue.
* Switch status to offline when disconnecting.
author | mikael |
---|---|
date | Mon, 02 May 2005 09:33:32 +0000 |
parents | 8630b7cae87b |
children | faf534be8ff0 |
comparison
equal
deleted
inserted
replaced
158:bcf52f41ba37 | 159:ba51d1737086 |
---|---|
440 | 440 |
441 switch(state) { | 441 switch(state) { |
442 case JCONN_STATE_OFF: | 442 case JCONN_STATE_OFF: |
443 | 443 |
444 online = FALSE; | 444 online = FALSE; |
445 mystatus = offline; | |
445 | 446 |
446 if (previous_state != JCONN_STATE_OFF) { | 447 if (previous_state != JCONN_STATE_OFF) { |
447 scr_LogPrint("+ JCONN_STATE_OFF"); | 448 scr_LogPrint("+ JCONN_STATE_OFF"); |
448 /* | 449 /* |
449 jhook.roster.clear(); | 450 jhook.roster.clear(); |
499 x = xmlnode_get_tag(packet->x, "body"); | 500 x = xmlnode_get_tag(packet->x, "body"); |
500 p = xmlnode_get_data(x); if (p) body = p; | 501 p = xmlnode_get_data(x); if (p) body = p; |
501 | 502 |
502 if ((x = xmlnode_get_tag(packet->x, "subject")) != NULL) | 503 if ((x = xmlnode_get_tag(packet->x, "subject")) != NULL) |
503 if ((p = xmlnode_get_data(x)) != NULL) { | 504 if ((p = xmlnode_get_data(x)) != NULL) { |
504 tmp = malloc(strlen(body)+strlen(p)+3); | 505 tmp = g_new(char, strlen(body)+strlen(p)+3); |
505 *tmp = '['; | 506 *tmp = '['; |
506 strcpy(tmp+1, p); | 507 strcpy(tmp+1, p); |
507 strcat(tmp, "]\n"); | 508 strcat(tmp, "]\n"); |
508 strcat(tmp, body); | 509 strcat(tmp, body); |
509 body = tmp; | 510 body = tmp; |
523 } | 524 } |
524 | 525 |
525 if (body) | 526 if (body) |
526 gotmessage(type, from, body, enc); | 527 gotmessage(type, from, body, enc); |
527 if (tmp) | 528 if (tmp) |
528 free(tmp); | 529 g_free(tmp); |
529 } | 530 } |
530 break; | 531 break; |
531 | 532 |
532 case JPACKET_IQ: | 533 case JPACKET_IQ: |
533 if (!strcmp(type, "result")) { | 534 if (!strcmp(type, "result")) { |
708 } | 709 } |
709 | 710 |
710 r = jidtodisp(from); | 711 r = jidtodisp(from); |
711 if (ust != roster_getstatus(r)) | 712 if (ust != roster_getstatus(r)) |
712 hk_statuschange(r, 0, ust); | 713 hk_statuschange(r, 0, ust); |
713 free(r); | 714 g_free(r); |
714 /* | 715 /* |
715 if (x = xmlnode_get_tag(packet->x, "status")) | 716 if (x = xmlnode_get_tag(packet->x, "status")) |
716 if (p = xmlnode_get_data(x)) | 717 if (p = xmlnode_get_data(x)) |
717 scr_LogPrint("Away msg: %s", p); | 718 scr_LogPrint("Away msg: %s", p); |
718 */ | 719 */ |
724 | 725 |
725 if (!strcmp(type, "subscribe")) { | 726 if (!strcmp(type, "subscribe")) { |
726 int isagent; | 727 int isagent; |
727 r = jidtodisp(from); | 728 r = jidtodisp(from); |
728 isagent = (roster_gettype(r) & ROSTER_TYPE_AGENT) != 0; | 729 isagent = (roster_gettype(r) & ROSTER_TYPE_AGENT) != 0; |
729 free(r); | 730 g_free(r); |
730 scr_LogPrint("isagent=%d", isagent); // XXX DBG | 731 scr_LogPrint("isagent=%d", isagent); // XXX DBG |
731 if (!isagent) { | 732 if (!isagent) { |
732 scr_LogPrint("<%s> wants to subscribe " | 733 scr_LogPrint("<%s> wants to subscribe " |
733 "to your network presence updates", from); | 734 "to your network presence updates", from); |
734 // FIXME we accept everybody... | 735 // FIXME we accept everybody... |