Hi,<div><br></div><div>In case the text-art didn't show properly, attached are the same in the picture format.</div><div><br></div><div>Regards,</div><div>Sulabh Mahajan<br><br><div class="gmail_quote">On Tue, Oct 2, 2012 at 4:08 PM, Sulabh Mahajan <span dir="ltr"><<a href="mailto:sulabh.dev@gmail.com" target="_blank">sulabh.dev@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div><br></div><div>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.</div>
<div><br></div><div>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.</div>

<div>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.</div>

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

<div><br></div><div>purplebuddylist</div><div>|</div><div>|------> root</div><div>|            |</div><div>|            |------> group1------->group2------>.....----->groupN</div><div>|                                            |</div>

<div>|                                            |</div><div>|         -----------------------------------------------------------------------------------------------------------</div><div>|         |              |     ....        |               |                |      ....     |           |        ....    </div>

<div>|    Setting1   Setting2     Contact1   Contact2   Person1      Chat1    Chat2</div><div>|                                         |</div><div>|                                         |</div><div>|         ------------------------------------------------------------------</div>

<div>|         |               |    .....     |             |        .....  |</div><div>|    Setting1   Setting2   Buddy1   Buddy2      BuddyN</div><div>|                                       |</div><div>|                                       |</div>

<div>|                                  Setting</div><div>|</div><div>|</div><div>|--------> buddies (hashtable): data "buddy", key "_purple_buddy"</div><div><br></div><div><br></div><div>We also maintain a hashtable, "buddies_cache" to be able to get quick access to per account buddies.</div>

<div><br></div><div>buddies_cache (hashtable): data "account_buddies", key "buddy->account"</div><div>account_buddies (hashtable): data "buddy", key "_purple_hbuddy"</div><div><br>

</div><div>                                     buddies_cache</div><div>                                               |</div><div>                                               |</div><div>          --------------------------------------------------------------------- </div>

<div>          |                      |               ...........                   |</div><div>     account1         account2                               accountN</div><div>                                 |</div><div>

            -------------------------------------------------</div><div>            |                  |         ...........         |</div><div>       buddy1        buddy2                    buddyN</div><div> </div><div>

<br></div><div><br></div><div>blist is stored on disk in ~/.purple/blist.xml in the same format as is for purplebuddylist->root</div><div>For instance:</div><div><br></div><div><purple version="1.0"></div>

<div>     <blist></div><div>          <group name="groupN"></div><div>               <setting name="collapsed" type="bool">0</setting></div><div>               <chat proto="xxxxx" account="xxxxx@xxxx.xxxx/"></div>

<div>                           <component name="server"><a href="http://abcd.xyz.com" target="_blank">abcd.xyz.com</a></component></div><div>                           <setting name="gtk-persistent" type="bool">1</setting></div>

<div>               </chat></div><div>               <contact></div><div>                           <buddy account="accxxx/" proto="xyz"></div><div>                                     <name><a href="mailto:abcd@xyz.com" target="_blank">abcd@xyz.com</a></name></div>

<div>                                     <setting name="last_seen" type="int">1349128209</setting></div><div>                           </buddy></div><div>               </contact></div>

<div>               .</div><div>               .</div><div>          </group></div><div>          .</div><div>          .</div><div>     </blist></div><div>     <privacy></div><div>            <account proto="xyz" name="<a href="mailto:xxxxxx@xxx.com" target="_blank">xxxxxx@xxx.com</a>" mode="1"/></div>

<div>            <account proto="abcd" name="<a href="http://xyzxyz@xyzxyz.com/" target="_blank">xyzxyz@xyzxyz.com/</a>" mode="1"></div><div>                   <block><a href="mailto:xyabcd@xyabcd.com" target="_blank">xyabcd@xyabcd.com</a></block></div>

<div>            </account></div><div>            .</div><div>            .</div><div>     </privacy></div><div></purple></div><div><br></div><div><br></div><div><br></div><div>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.</div>

<div><br></div><div><br></div><div>My proposal for the new, lets call it, purplepeoplelist is as follows:</div><div><br></div><div>purplepeoplelist</div><div><div>|</div><div>|------> root</div><div>|            |</div>

<div>|            |------> account1------->account2------>.....----->accountN</div><div>|                                                 |</div><div>|                                                 |</div><div>

|         -------------------------------------------------------------------------------------------------------------------</div><div>|         |              |     ....                |                               |                 |                   |      ....</div>

<div>|    Setting1   Setting2     AccountPrivacySetting      <span style="background-color:rgb(255,255,0)">Individual1</span>  Individual2       Chat1       </div><div>|                                                                                 |                                     |</div>

<div>|                                                                                 |                                     |</div><div>|            -----------------------------------------------------------------------------                      --------------------</div>

<div>|            |                 |               |    .....       |                  |    ...                      |                   |</div><div>|      <span style="background-color:rgb(255,255,0)">IsBuddy? </span>    Setting1   Setting2    Presence   Subscription                Setting        <span style="background-color:rgb(255,255,0)">"Group2"</span></div>

<div>|            |</div><div>|            | (yes)</div><div>|            |                            </div><div>|   <span style="background-color:rgb(255,255,0)">"Group2/Contact1"</span></div><div>|</div><div>

|</div><div>|--------> people (hashtable): data "individual", key "_purple_individual"</div></div><div><br></div><div><br></div><div>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.</div>

<div>This will be to store group and contact settings, and to have a quick way for the UI to present the blist.</div><div><br></div><div>                                        purplebuddyblist</div><div>                                                   |</div>

<div>                        --------------------------------------------------                         </div><div>                        |                  |        .............         |</div><div><div>                    group1         group2                    groupN</div>

<div>                                            |</div><div>                                            |</div><div>         --------------------------------------------------------------------------------</div><div>         |                  |        ....        |               |                  |    ....    </div>

<div>    Setting1      Setting2         Contact1   Contact2        <span style="background-color:rgb(255,255,0)">Chat1 </span></div><div>                                                 |</div><div>                                                 |</div>

<div>               -----------------------------------------------------------------------</div><div>               |               |    .....                  |                         |  ...</div><div>          Setting1   Setting2        <span style="background-color:rgb(255,255,0)">Buddy1(Individual1)</span>      BuddyN </div>

<div>                                       </div></div><div><br></div><div>To store the above information on the disk, we will store it in say people.xml in the following form:</div><div><br></div><div><div><purple version="2.0"></div>

<div>     <peoplelist></div><div>          <account="accxxx/" proto="xyz"></div><div>               <setting name="privacy-mode" type="int">1</setting></div>

<div>               <setting name="blahblah" type="bool">1</setting></div><div>               <span style="background-color:rgb(255,255,0)"><chat proto="xxxxx/"></span></div>

<div>                           <span style="background-color:rgb(255,255,0)"><group="CoWorkers"></group></span></div><div>                           <component name="server"><a href="http://abcd.xyz.com" target="_blank">abcd.xyz.com</a></component></div>

<div>                           <setting name="gtk-persistent" type="bool">1</setting></div><div>               </chat></div><div><div>               <Individual></div><div>                           <name="mybestfriend"</name></div>

<div>                           <span style="background-color:rgb(255,255,0)"><setting name="is-buddy" type="bool">1</setting></span></div><div>                                      <span style="background-color:rgb(255,255,0)"><group="CoWorkers"></span></div>

<div>                                                <span style="background-color:rgb(255,255,0)"><Contact>"ProjectX"</Contact></span></div><div>                                                <span style="background-color:rgb(255,255,0)"><Contact>"ProjectZ"</Contact></span></div>

<div>                                      <span style="background-color:rgb(255,255,0)"></group></span></div><div><div>                                      <span style="background-color:rgb(255,255,0)"><group="FootballBuddies"></group></span></div>

</div><div>                           <alias>abcd efgh</alias></div><div>                           <setting name="presence" type="int">0</setting></div><div>                           <setting name="subscription" type="int">1</setting></div>

<div>                           .</div><div>                           .</div><div>               </individual></div></div><div>               <Individual></div><div>                           <name="blocked_guy"</name></div>

<div>                           <span style="background-color:rgb(255,255,0)"><setting name="is-buddy" type="bool">0</setting></span></div><div>                           <alias>theboringguy</alias></div>

<div>                           <setting name="presence" type="int">3</setting></div><div>                           <setting name="subscription" type="int">2</setting></div>

<div>                           <span style="background-color:rgb(255,255,0)"><setting name="blocked" type="int">5</setting></span></div><div>                           .</div><div>                           .</div>

<div>               </individual></div><div>               .</div><div>               .</div><div>          </account></div><div>          .</div><div>          .</div><div>     </peoplelist></div><div>
     <group_contact_list></div>
<div>          .</div><div>          .</div><div><div>          <span style="background-color:rgb(255,255,0)"><group name="CoWorkers"></span></div><div>               <setting name="collapsed" type="bool">0</setting></div>

<div>               <setting name="xyz" type="int">2</setting></div><div>               <span style="background-color:rgb(255,255,0)"><contact name="ProjectX"></span></div>
<div>
                           <span style="background-color:rgb(255,255,0)"><setting name="abcdefgh" type="bool">0</setting></span></div><div>                           <span style="background-color:rgb(255,255,0)"><setting name="qwerty" type="int">2</setting></span></div>

<div>               <span style="background-color:rgb(255,255,0)"></contact></span></div><div><div>               <contact name="ProjectZ"></div><div>                           <setting name="abcdefgh" type="bool">1</setting></div>

<div>               </contact></div></div><div>               .</div><div>               .</div><div>          </group></div></div><div>            .</div><div>            .</div><div>     </group_contact_list></div>

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

<div><br></div><div>Thanks and Regards,</div><div>Sulabh Mahajan</div>
</blockquote></div><br></div>