comparison mcabber/mcabber/xmpp_iqrequest.c @ 1976:e6beab22099b

Do not add items to roster with commands /move and /rename (Hermitifier) Do not add items to roster with commands /move and /rename. For MUC, store relevant information in the bookmark.
author Mikael Berthe <mikael@lilotux.net>
date Thu, 24 Mar 2011 20:53:08 +0100
parents decf94827efe
children 6febc7d1f760
comparison
equal deleted inserted replaced
1975:a23799244335 1976:e6beab22099b
559 } 559 }
560 560
561 static void storage_bookmarks_parse_conference(LmMessageNode *node) 561 static void storage_bookmarks_parse_conference(LmMessageNode *node)
562 { 562 {
563 const char *fjid, *name, *autojoin; 563 const char *fjid, *name, *autojoin;
564 const char *pstatus, *awhois; 564 const char *pstatus, *awhois, *group;
565 char *bjid; 565 char *bjid;
566 GSList *room_elt; 566 GSList *room_elt;
567 567
568 fjid = lm_message_node_get_attribute(node, "jid"); 568 fjid = lm_message_node_get_attribute(node, "jid");
569 if (!fjid) 569 if (!fjid)
570 return; 570 return;
571 name = lm_message_node_get_attribute(node, "name"); 571 name = lm_message_node_get_attribute(node, "name");
572 autojoin = lm_message_node_get_attribute(node, "autojoin"); 572 autojoin = lm_message_node_get_attribute(node, "autojoin");
573 awhois = lm_message_node_get_attribute(node, "autowhois"); 573 awhois = lm_message_node_get_attribute(node, "autowhois");
574 pstatus = lm_message_node_get_child_value(node, "print_status"); 574 pstatus = lm_message_node_get_child_value(node, "print_status");
575 group = lm_message_node_get_child_value(node, "group");
575 576
576 bjid = jidtodisp(fjid); // Bare jid 577 bjid = jidtodisp(fjid); // Bare jid
577 578
578 // Make sure this is a room (it can be a conversion user->room) 579 // Make sure this is a room (it can be a conversion user->room)
579 room_elt = roster_find(bjid, jidsearch, 0); 580 room_elt = roster_find(bjid, jidsearch, 0);
580 if (!room_elt) { 581 if (!room_elt) {
581 room_elt = roster_add_user(bjid, name, NULL, ROSTER_TYPE_ROOM, 582 room_elt = roster_add_user(bjid, name, group, ROSTER_TYPE_ROOM,
582 sub_none, -1); 583 sub_none, -1);
583 } else { 584 } else {
584 buddy_settype(room_elt->data, ROSTER_TYPE_ROOM); 585 buddy_settype(room_elt->data, ROSTER_TYPE_ROOM);
585 /* 586 /*
586 // If the name is available, should we use it? 587 // If the name is available, should we use it?
587 // I don't think so, it would be confusing because this item is already 588 // I don't think so, it would be confusing because this item is already
588 // in the roster. 589 // in the roster.
589 if (name) 590 if (name)
590 buddy_setname(room_elt->data, name); 591 buddy_setname(room_elt->data, name);
592
593 // The same question for roster group.
594 if (group)
595 buddy_setgroup(room_elt->data, group);
591 */ 596 */
592 } 597 }
593 598
594 // Set the print_status and auto_whois values 599 // Set the print_status and auto_whois values
595 if (pstatus) { 600 if (pstatus) {
600 if (i <= status_all) 605 if (i <= status_all)
601 buddy_setprintstatus(room_elt->data, i); 606 buddy_setprintstatus(room_elt->data, i);
602 } 607 }
603 if (awhois) { 608 if (awhois) {
604 enum room_autowhois i = autowhois_default; 609 enum room_autowhois i = autowhois_default;
605 if (!strcmp(awhois, "1")) 610 if (!strcmp(awhois, "1") || !(strcmp(awhois, "true")))
606 i = autowhois_on; 611 i = autowhois_on;
607 else if (!strcmp(awhois, "0")) 612 else if (!strcmp(awhois, "0") || !(strcmp(awhois, "false")))
608 i = autowhois_off; 613 i = autowhois_off;
609 if (i != autowhois_default) 614 if (i != autowhois_default)
610 buddy_setautowhois(room_elt->data, i); 615 buddy_setautowhois(room_elt->data, i);
611 } 616 }
612 617