Mercurial > pidgin
comparison libpurple/protocols/jabber/message.c @ 29267:58e1e1463b6e
Manual merge
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Thu, 01 Jan 2009 21:16:19 +0000 |
parents | 008f35e7d538 |
children | 9ea6842536ba |
comparison
equal
deleted
inserted
replaced
29266:008f35e7d538 | 29267:58e1e1463b6e |
---|---|
570 jm->to = g_strdup(xmlnode_get_attrib(packet, "to")); | 570 jm->to = g_strdup(xmlnode_get_attrib(packet, "to")); |
571 jm->id = g_strdup(xmlnode_get_attrib(packet, "id")); | 571 jm->id = g_strdup(xmlnode_get_attrib(packet, "id")); |
572 | 572 |
573 for(child = packet->child; child; child = child->next) { | 573 for(child = packet->child; child; child = child->next) { |
574 const char *xmlns = xmlnode_get_namespace(child); | 574 const char *xmlns = xmlnode_get_namespace(child); |
575 if(!xmlns) | |
576 xmlns = ""; | |
577 if(child->type != XMLNODE_TYPE_TAG) | 575 if(child->type != XMLNODE_TYPE_TAG) |
578 continue; | 576 continue; |
579 | 577 |
580 if(!strcmp(child->name, "subject") && !strcmp(xmlns,"jabber:client")) { | 578 if(!strcmp(child->name, "error")) { |
579 const char *code = xmlnode_get_attrib(child, "code"); | |
580 char *code_txt = NULL; | |
581 char *text = xmlnode_get_data(child); | |
582 if (!text) { | |
583 xmlnode *enclosed_text_node; | |
584 | |
585 if ((enclosed_text_node = xmlnode_get_child(child, "text"))) | |
586 text = xmlnode_get_data(enclosed_text_node); | |
587 } | |
588 | |
589 if(code) | |
590 code_txt = g_strdup_printf(_("(Code %s)"), code); | |
591 | |
592 if(!jm->error) | |
593 jm->error = g_strdup_printf("%s%s%s", | |
594 text ? text : "", | |
595 text && code_txt ? " " : "", | |
596 code_txt ? code_txt : ""); | |
597 | |
598 g_free(code_txt); | |
599 g_free(text); | |
600 } else if (xmlns == NULL) { | |
601 /* QuLogic: Not certain this is correct, but it would have happened | |
602 with the previous code. */ | |
603 if(!strcmp(child->name, "x")) | |
604 jm->etc = g_list_append(jm->etc, child); | |
605 /* The following tests expect xmlns != NULL */ | |
606 continue; | |
607 } else if(!strcmp(child->name, "subject") && !strcmp(xmlns,"jabber:client")) { | |
581 if(!jm->subject) | 608 if(!jm->subject) |
582 jm->subject = xmlnode_get_data(child); | 609 jm->subject = xmlnode_get_data(child); |
583 } else if(!strcmp(child->name, "thread") && !strcmp(xmlns,"jabber:client")) { | 610 } else if(!strcmp(child->name, "thread") && !strcmp(xmlns,"jabber:client")) { |
584 if(!jm->thread_id) | 611 if(!jm->thread_id) |
585 jm->thread_id = xmlnode_get_data(child); | 612 jm->thread_id = xmlnode_get_data(child); |
705 jm->type = JABBER_MESSAGE_EVENT; | 732 jm->type = JABBER_MESSAGE_EVENT; |
706 for(items = xmlnode_get_child(child,"items"); items; items = items->next) | 733 for(items = xmlnode_get_child(child,"items"); items; items = items->next) |
707 jm->eventitems = g_list_append(jm->eventitems, items); | 734 jm->eventitems = g_list_append(jm->eventitems, items); |
708 } else if(!strcmp(child->name, "attention") && !strcmp(xmlns, XEP_0224_NAMESPACE)) { | 735 } else if(!strcmp(child->name, "attention") && !strcmp(xmlns, XEP_0224_NAMESPACE)) { |
709 jm->hasBuzz = TRUE; | 736 jm->hasBuzz = TRUE; |
710 } else if(!strcmp(child->name, "error")) { | 737 } else if(!strcmp(child->name, "delay") && !strcmp(xmlns,"urn:xmpp:delay")) { |
711 const char *code = xmlnode_get_attrib(child, "code"); | |
712 char *code_txt = NULL; | |
713 char *text = xmlnode_get_data(child); | |
714 if (!text) { | |
715 xmlnode *enclosed_text_node; | |
716 | |
717 if ((enclosed_text_node = xmlnode_get_child(child, "text"))) | |
718 text = xmlnode_get_data(enclosed_text_node); | |
719 } | |
720 | |
721 if(code) | |
722 code_txt = g_strdup_printf(_("(Code %s)"), code); | |
723 | |
724 if(!jm->error) | |
725 jm->error = g_strdup_printf("%s%s%s", | |
726 text ? text : "", | |
727 text && code_txt ? " " : "", | |
728 code_txt ? code_txt : ""); | |
729 | |
730 g_free(code_txt); | |
731 g_free(text); | |
732 } else if(!strcmp(child->name, "delay") && xmlns && !strcmp(xmlns,"urn:xmpp:delay")) { | |
733 const char *timestamp = xmlnode_get_attrib(child, "stamp"); | 738 const char *timestamp = xmlnode_get_attrib(child, "stamp"); |
734 jm->delayed = TRUE; | 739 jm->delayed = TRUE; |
735 if(timestamp) | 740 if(timestamp) |
736 jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL); | 741 jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL); |
737 } else if(!strcmp(child->name, "x")) { | 742 } else if(!strcmp(child->name, "x")) { |
738 if(xmlns && !strcmp(xmlns, "jabber:x:event")) { | 743 if(!strcmp(xmlns, "jabber:x:event")) { |
739 if(xmlnode_get_child(child, "composing")) { | 744 if(xmlnode_get_child(child, "composing")) { |
740 if(jm->chat_state == JM_STATE_ACTIVE) | 745 if(jm->chat_state == JM_STATE_ACTIVE) |
741 jm->chat_state = JM_STATE_COMPOSING; | 746 jm->chat_state = JM_STATE_COMPOSING; |
742 jm->typing_style |= JM_TS_JEP_0022; | 747 jm->typing_style |= JM_TS_JEP_0022; |
743 } | 748 } |
744 } else if(xmlns && !strcmp(xmlns, "jabber:x:delay")) { | 749 } else if(!strcmp(xmlns, "jabber:x:delay")) { |
745 const char *timestamp = xmlnode_get_attrib(child, "stamp"); | 750 const char *timestamp = xmlnode_get_attrib(child, "stamp"); |
746 jm->delayed = TRUE; | 751 jm->delayed = TRUE; |
747 if(timestamp) | 752 if(timestamp) |
748 jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL); | 753 jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL); |
749 } else if(xmlns && !strcmp(xmlns, "jabber:x:conference") && | 754 } else if(!strcmp(xmlns, "jabber:x:conference") && |
750 jm->type != JABBER_MESSAGE_GROUPCHAT_INVITE && | 755 jm->type != JABBER_MESSAGE_GROUPCHAT_INVITE && |
751 jm->type != JABBER_MESSAGE_ERROR) { | 756 jm->type != JABBER_MESSAGE_ERROR) { |
752 const char *jid = xmlnode_get_attrib(child, "jid"); | 757 const char *jid = xmlnode_get_attrib(child, "jid"); |
753 if(jid) { | 758 if(jid) { |
754 jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE; | 759 jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE; |
755 g_free(jm->to); | 760 g_free(jm->to); |
756 jm->to = g_strdup(jid); | 761 jm->to = g_strdup(jid); |
757 } | 762 } |
758 } else if(xmlns && !strcmp(xmlns, | 763 } else if(!strcmp(xmlns, "http://jabber.org/protocol/muc#user") && |
759 "http://jabber.org/protocol/muc#user") && | |
760 jm->type != JABBER_MESSAGE_ERROR) { | 764 jm->type != JABBER_MESSAGE_ERROR) { |
761 xmlnode *invite = xmlnode_get_child(child, "invite"); | 765 xmlnode *invite = xmlnode_get_child(child, "invite"); |
762 if(invite) { | 766 if(invite) { |
763 xmlnode *reason, *password; | 767 xmlnode *reason, *password; |
764 const char *jid = xmlnode_get_attrib(invite, "from"); | 768 const char *jid = xmlnode_get_attrib(invite, "from"); |