[Tkabber-dev] r1921 - in trunk/tkabber: . plugins/roster

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Feb 14 02:16:34 MSK 2010


Author: sergei
Date: 2010-02-14 02:16:34 +0300 (Sun, 14 Feb 2010)
New Revision: 1921

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/roster/backup.tcl
Log:
	* plugins/roster/backup.tcl: Send imported roster items to the user's
	  XMPP server sequentially to match RFC-3921 requirement where
	  jabber:iq:roster set query must not include more than one item.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2010-02-13 17:30:07 UTC (rev 1920)
+++ trunk/tkabber/ChangeLog	2010-02-13 23:16:34 UTC (rev 1921)
@@ -2,6 +2,10 @@
 
 	* ifacetk/muc.tcl: Fixed adding MUC menu to a disco node.
 
+	* plugins/roster/backup.tcl: Send imported roster items to the user's
+	  XMPP server sequentially to match RFC-3921 requirement where
+	  jabber:iq:roster set query must not include more than one item.
+
 2010-02-08  Sergei Golovan  <sgolovan at nes.ru>
 
 	* muc.tcl, plugins/chat/muc_commands.tcl: Fixed typos.

Modified: trunk/tkabber/plugins/roster/backup.tcl
===================================================================
--- trunk/tkabber/plugins/roster/backup.tcl	2010-02-13 17:30:07 UTC (rev 1920)
+++ trunk/tkabber/plugins/roster/backup.tcl	2010-02-13 23:16:34 UTC (rev 1921)
@@ -257,19 +257,28 @@
 proc rosterbackup::send_contacts {xlib contacts continuation} {
     global NS
 
+    set contact [lindex $contacts 0]
     ::xmpp::sendIQ $xlib set \
 	-query [::xmpp::xml::create query \
 			    -xmlns jabber:iq:roster \
-			    -subelements $contacts] \
-	-command [namespace code [list process_send_result $continuation]]
+			    -subelement $contact] \
+	-command [namespace code [list process_send_result $xlib \
+						[lrange $contacts 1 end] \
+						[get_item_jid $contact] \
+						$continuation]]
 }
 
 ###############################################################################
 
-proc rosterbackup::process_send_result {continuation result xmldata} {
+proc rosterbackup::process_send_result {xlib contacts jid
+					continuation result xmldata} {
     switch -- $result {
 	ok {
-	    eval $continuation
+	    if {[llength $contacts] > 0} {
+		send_contacts $xlib $contacts $continuation
+	    } else {
+		eval $continuation
+	    }
 	}
 	default {
 	    # TODO check whether do we need to handle TIMEOUT specially
@@ -277,8 +286,8 @@
 		-aspect 50000 \
 		-icon error \
 		-title [::msgcat::mc "Error"] \
-		-message [::msgcat::mc "Error importing roster contacts: %s" \
-		    [error_to_string $xmldata]]
+		-message [::msgcat::mc "Error importing roster contact %s: %s" \
+				       $jid [error_to_string $xmldata]]
 	}
     }
 }



More information about the Tkabber-dev mailing list