Proposal: Blist structure modification

Sulabh Mahajan sulabh.dev at gmail.com
Tue Oct 2 06:38:16 EDT 2012


Hi,

Earlier I was working on the privacy rewrite project, in order to continue
with it I need modifications to the way blist is organized and stored on
the disk.

As per the discussions that happened during the project time frame, it was
agreed upon that the best way to store "people" (buddies + chats + privacy
contacts) is to have a single list for all of them, and annotate required
information as tags to them.
Rather than organizing the buddies based on groups, we can have "people"
based on accounts. The groups the "people" belong to, settings, privacy
information, presence, subscriptions, etc would be annotations to these
people.

Let me first describe the current model of blist organization:
(Let me know if the following "text art" doesn't show up correctly, I will
put them in jpeg and attach along)

purplebuddylist
|
|------> root
|            |
|            |------> group1------->group2------>.....----->groupN
|                                            |
|                                            |
|
-----------------------------------------------------------------------------------------------------------
|         |              |     ....        |               |
 |      ....     |           |        ....
|    Setting1   Setting2     Contact1   Contact2   Person1      Chat1
 Chat2
|                                         |
|                                         |
|         ------------------------------------------------------------------
|         |               |    .....     |             |        .....  |
|    Setting1   Setting2   Buddy1   Buddy2      BuddyN
|                                       |
|                                       |
|                                  Setting
|
|
|--------> buddies (hashtable): data "buddy", key "_purple_buddy"


We also maintain a hashtable, "buddies_cache" to be able to get quick
access to per account buddies.

buddies_cache (hashtable): data "account_buddies", key "buddy->account"
account_buddies (hashtable): data "buddy", key "_purple_hbuddy"

                                     buddies_cache
                                               |
                                               |

---------------------------------------------------------------------
          |                      |               ...........
    |
     account1         account2                               accountN
                                 |
            -------------------------------------------------
            |                  |         ...........         |
       buddy1        buddy2                    buddyN



blist is stored on disk in ~/.purple/blist.xml in the same format as is for
purplebuddylist->root
For instance:

<purple version="1.0">
     <blist>
          <group name="groupN">
               <setting name="collapsed" type="bool">0</setting>
               <chat proto="xxxxx" account="xxxxx at xxxx.xxxx/">
                           <component name="server">abcd.xyz.com</component>
                           <setting name="gtk-persistent"
type="bool">1</setting>
               </chat>
               <contact>
                           <buddy account="accxxx/" proto="xyz">
                                     <name>abcd at xyz.com</name>
                                     <setting name="last_seen"
type="int">1349128209</setting>
                           </buddy>
               </contact>
               .
               .
          </group>
          .
          .
     </blist>
     <privacy>
            <account proto="xyz" name="xxxxxx at xxx.com" mode="1"/>
            <account proto="abcd" name="xyzxyz at xyzxyz.com/" mode="1">
                   <block>xyabcd at xyabcd.com</block>
            </account>
            .
            .
     </privacy>
</purple>



Since we require per account buddies information, and maintain buddy_cache,
a structure that contains per account buddies. I want to have a similar
structure for our main blist. Besides that we can have a cached structure
to maintain the list organized in "group->contact->buddy" format.


My proposal for the new, lets call it, purplepeoplelist is as follows:

purplepeoplelist
|
|------> root
|            |
|            |------> account1------->account2------>.....----->accountN
|                                                 |
|                                                 |
|
-------------------------------------------------------------------------------------------------------------------
|         |              |     ....                |
        |                 |                   |      ....
|    Setting1   Setting2     AccountPrivacySetting      Individual1
Individual2       Chat1
|
      |                                     |
|
      |                                     |
|
 -----------------------------------------------------------------------------
                     --------------------
|            |                 |               |    .....       |
       |    ...                      |                   |
|      IsBuddy?     Setting1   Setting2    Presence   Subscription
       Setting        "Group2"
|            |
|            | (yes)
|            |
|   "Group2/Contact1"
|
|
|--------> people (hashtable): data "individual", key "_purple_individual"


Have a structure called, blist which will be cache of only buddies, along
with group and contact settings/information organized in the
"groups->contacts->buddies" format.
This will be to store group and contact settings, and to have a quick way
for the UI to present the blist.

                                        purplebuddyblist
                                                   |
                        --------------------------------------------------

                        |                  |        .............         |
                    group1         group2                    groupN
                                            |
                                            |

 --------------------------------------------------------------------------------
         |                  |        ....        |               |
         |    ....
    Setting1      Setting2         Contact1   Contact2        Chat1
                                                 |
                                                 |

 -----------------------------------------------------------------------
               |               |    .....                  |
          |  ...
          Setting1   Setting2        Buddy1(Individual1)      BuddyN


To store the above information on the disk, we will store it in say
people.xml in the following form:

<purple version="2.0">
     <peoplelist>
          <account="accxxx/" proto="xyz">
               <setting name="privacy-mode" type="int">1</setting>
               <setting name="blahblah" type="bool">1</setting>
               <chat proto="xxxxx/">
                           <group="CoWorkers"></group>
                           <component name="server">abcd.xyz.com</component>
                           <setting name="gtk-persistent"
type="bool">1</setting>
               </chat>
               <Individual>
                           <name="mybestfriend"</name>
                           <setting name="is-buddy" type="bool">1</setting>
                                      <group="CoWorkers">

<Contact>"ProjectX"</Contact>

<Contact>"ProjectZ"</Contact>
                                      </group>
                                      <group="FootballBuddies"></group>
                           <alias>abcd efgh</alias>
                           <setting name="presence" type="int">0</setting>
                           <setting name="subscription"
type="int">1</setting>
                           .
                           .
               </individual>
               <Individual>
                           <name="blocked_guy"</name>
                           <setting name="is-buddy" type="bool">0</setting>
                           <alias>theboringguy</alias>
                           <setting name="presence" type="int">3</setting>
                           <setting name="subscription"
type="int">2</setting>
                           <setting name="blocked" type="int">5</setting>
                           .
                           .
               </individual>
               .
               .
          </account>
          .
          .
     </peoplelist>
     <group_contact_list>
          .
          .
          <group name="CoWorkers">
               <setting name="collapsed" type="bool">0</setting>
               <setting name="xyz" type="int">2</setting>
               <contact name="ProjectX">
                           <setting name="abcdefgh" type="bool">0</setting>
                           <setting name="qwerty" type="int">2</setting>
               </contact>
               <contact name="ProjectZ">
                           <setting name="abcdefgh" type="bool">1</setting>
               </contact>
               .
               .
          </group>
            .
            .
     </group_contact_list>
</purple>


Eagerly waiting for your comments. Please suggest any improvements that you
can think of.
This is just a first draft that I quickly came up with, let me know if I
missed taking into account some critical information.

Thanks and Regards,
Sulabh Mahajan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.im/pipermail/devel/attachments/20121002/bfcc0646/attachment-0002.html>


More information about the Devel mailing list