[Pidgin] #13241: DBus API: need a way to refresh the buddy list

Pidgin trac at pidgin.im
Thu Jan 20 23:40:51 EST 2011


#13241: DBus API: need a way to refresh the buddy list
----------------------+-----------------------------------------------------
Reporter:  ebullient  |        Type:  enhancement
  Status:  new        |   Component:  libpurple  
 Version:  2.7.9      |    Keywords:  dbus       
----------------------+-----------------------------------------------------
 Took this to the channel, and didn't come up with any better answers.

 I have a dbus script that changes the privacy setting for an account (to
 change who can see me based on time of day):

     bus = dbus.SessionBus()
     obj = bus.get_object("im.pidgin.purple.PurpleService",
 "/im/pidgin/purple/PurpleObject")
     purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")

     for acctID in purple.PurpleAccountsGetAllActive():
         protocolName = purple.PurpleAccountGetProtocolName(acctID)

         if protocolName == "Sametime":
             purple.PurpleAccountSetPrivacyType(acctID, access)
             status = purple.PurpleAccountGetPrivacyType(acctID)
             print status


 This works just fine: The value printed by status changes appropriately
 (implying the value was set correctly). If I use the dbus command to queue
 the blist to save:

             purple.PurpleBlistScheduleSave()

 The new value shows up correctly in the file.

 So. The side effect of changing your privacy settings is the
 presence/absence of visual indicators telling you which buddies can see
 you and which can't. When using dbus to change the privacy setting, the
 buddy icons aren't updated to show the new blocked/unblocked status,
 UNLESS I go clicking through to the privacy dialog in the UI. As soon as I
 touch that UI, the buddy list is refreshed, and the icons show the right
 blocked/unblocked status.

 People in IRC pointed out that the privacy dialog is forcing a refresh of
 the buddy list on the way out: there is no way for me to "refresh" the
 buddy list from DBus (as a bulk operation). Enabling/Disabling the account
 causes the buddy list to refresh, but it's slow, and has other
 ramifications to deal with (like your server getting mad at you while
 you're testing). Changing list preferences (like showing on/offline
 buddies) had no impact at all whatsoever when done via dbus. Toggling
 buddy list visibility worked, but had no effect on the blocked/unblocked
 icons.

 What does work: iterating through all of the buddies in my list and
 updating their icons:
             blist = purple.PurpleBlistGetBuddies()
             for buddy in blist :
                 purple.PurpleBlistUpdateBuddyIcon(buddy)

 Not graceful, and a significant waste of resource doing this through
 Dbus...

 Need a way to refresh the buddy list...

-- 
Ticket URL: <http://developer.pidgin.im/ticket/13241>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list