Editing User:Jaffa/Hermes plugins

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 12: Line 12:
* Change the "Accounts" dialogue to be like the sharing plugins: a list of icon-containing services which are enabled, with an "Add" button, a "Remove" button, "Move Up/Down" buttons and an "Edit" button which is enabled when an item is selected and further preferences are available.
* Change the "Accounts" dialogue to be like the sharing plugins: a list of icon-containing services which are enabled, with an "Add" button, a "Remove" button, "Move Up/Down" buttons and an "Edit" button which is enabled when an item is selected and further preferences are available.
* Each service needs to provide an interface for opening the preferences for it, if any. For Facebook this'd be "Create birthday-only contacts", an "Authorise"/"Deauthorise" button.
* Each service needs to provide an interface for opening the preferences for it, if any. For Facebook this'd be "Create birthday-only contacts", an "Authorise"/"Deauthorise" button.
-
* The existing "Fetching friends' info" would be changed to a progress-bar: "Initialising services" with information on each service being initialised.
 
== Code design ==
== Code design ==
''See early discussion on [https://bugs.maemo.org/show_bug.cgi?id=6990#c3 #6990].''
''See early discussion on [https://bugs.maemo.org/show_bug.cgi?id=6990#c3 #6990].''
-
 
-
The existing code in <code>contacts.py</code> would be migrated into a <code>Contact</code> class. This would, in addition to providing access to the various fields of concern, cache the name variants and provide a method for checking matches:
 
-
 
-
<syntaxhighlight lang=python>
 
-
  def matches_identifier(id):
 
-
    """Returns true if the Unicode-normalised, lower-case, non-alphabetic
 
-
      stripped characters of 'id' matches a name variant of this contact.
 
-
      Fields included in the name variants are:
 
-
        * First name
 
-
        * Last name
 
-
        * Nickname
 
-
        * Email address (with post-@ dot-suffices removed."""
 
-
</syntaxhighlight>
 
A <code>Friend</code> class would be introduced to give better defined access to name, service and picture. This is used in manual mapping, and for communication between the controller and the service. It would also store the contacts to which it was mapped, if any.
A <code>Friend</code> class would be introduced to give better defined access to name, service and picture. This is used in manual mapping, and for communication between the controller and the service. It would also store the contacts to which it was mapped, if any.
Line 64: Line 50:
   all_contacts = get_contacts_as_set()
   all_contacts = get_contacts_as_set()
-
  contacts = set()
 
   updated_contacts = set()
   updated_contacts = set()
-
   for econtact in addressbook.get_all_contacts():
+
   for contact in all_contacts:
-
    contact = Contact(addressbook, econtact)
+
-
    contacts.add(contact)
+
     for service in something.get_services_by_prioritisation():
     for service in something.get_services_by_prioritisation():
       if service.process_contact(contact):
       if service.process_contact(contact):
         updated_contacts.add(contact)
         updated_contacts.add(contact)
-
 
+
        save_contact(contact)
-
  for service in something.get_services_by_prioritisation():
+
-
    service.finalise(updated_contacts)
+
-
 
+
-
  for contact in updated_contacts:
+
-
    contact.save()
+
</syntaxhighlight>
</syntaxhighlight>
Line 84: Line 62:
=== Unanswered questions ===
=== Unanswered questions ===
* Should some <code>X-HERMES-...</code> fields be used to indicate what Hermes can overwrite<ref>[https://bugs.maemo.org/show_bug.cgi?id=5452 #5452] - Don't overwrite pre-existing contact info</ref>; if so, what if the user ''does'' want to overwrite some info? For matching, URLs should be sufficient for most services.
* Should some <code>X-HERMES-...</code> fields be used to indicate what Hermes can overwrite<ref>[https://bugs.maemo.org/show_bug.cgi?id=5452 #5452] - Don't overwrite pre-existing contact info</ref>; if so, what if the user ''does'' want to overwrite some info? For matching, URLs should be sufficient for most services.
-
* Should <code>process_contact</code> return a dict of updated fields? Then the engine can decide what to update based on prioritisation etc.
 
-
* Do we need a collection of UI building blocks to help plugin developers create their dialogs in a consistent way? (Ralph)
 
-
*:Such as 'browser-based authentication notification', username/password etc? Certainly wouldn't do any harm :-) --[[User:jaffa|Jaffa]] 11:56, 3 January 2010 (UTC)
 
-
 
-
=== Notional implementations ===
 
-
Services such as Facebook, Twitter, Hyves and LinkedIn would contact upstream during construction (similar to the existing model).
 
-
 
-
Services such as Gravatar would contact upstream during finalisation, once the set of contacts with email addresses (and without photos if ''overwrite'' is false) has been identified.
 
-
== References ==
 
<references/>
<references/>

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)