Module Skype :: Class ContactSearch

Class ContactSearch

source code

     object --+        
              |        
skypekit.Cached --+    
                  |    
    skypekit.Object --+
                      |
                     ContactSearch

This class encapsulates functionality for looking up contacts on the Skype network. Contacts can be searched by portion of their name, e-mail address, language preferences, etc.

Contact search is asynchronous. ContactSearch::Submit is a non-blocking function that initiates the search. Upon finding a matching contact, ContactSearch::OnNewResult event gets fired, that gives you the reference to the discovered contact. You can get up to 100 matching contacts per search. Note that you will need to keep a live reference of the ContactSearch object while the search is doing its work.

So, to perform a contact search:

Instance Methods
 
_sk_init_(self, object_id, transport)
actual constructor
source code
 
__str__(self)
str(x)
source code
 
OnPropertyChange(self, property_name)
notifies from a property change
source code
 
AddMinAgeTerm(self, min_age_in_years, add_to_subs=False)
construct CONTACT_BIRTHDAY term based on current time
source code
 
AddMaxAgeTerm(self, max_age_in_years, add_to_subs=False)
construct CONTACT_BIRTHDAY term based on current time
source code
 
AddEmailTerm(self, email, add_to_subs=False)
Adds a search term against Contact::P_EMAILS property and pre-validates the value given in the email argument.
source code
 
AddLanguageTerm(self, language, add_to_subs=False)
No description available.
source code
 
AddStrTerm(self, prop, cond, value, add_to_subs=False)
Adds a string search term to a custom contact search object.
source code
 
AddIntTerm(self, prop, cond, value, add_to_subs=False)
Adds a search term to a custom contact search object.
source code
 
AddOr(self)
used to group terms (AddTerm(1), AddTerm(2), Or(), AddTerm(3), AddTerm(4), etc)
source code
 
IsValid(self)
checks that terms list is non-empty and does not contain unsupported keys
source code
 
Submit(self)
launch search
source code
 
Extend(self)
extend if search is EXTENDABLE
source code
 
Release(self)
releases results that are not referenced from elsewhere
source code
 
GetResults(self, from_=0, count=4294967295)
result list is dynamically updated
source code
 
OnNewResult(self, contact, rank_value)
This callback is fired when a new matching contact has been found during the search.
source code

Inherited from skypekit.Object: multiget

Inherited from skypekit.Cached: __copy__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Static Methods
 
propid(propname)
convert a property name to the enum of the property
source code

Inherited from skypekit.Cached: __new__, sk_exists

Class Variables
  event_handlers = {1: '_sk_on_new_result'}
  propid2label = {200: 'contact_search_status'}
  module_id = 1
  STATUS = {1: 'CONSTRUCTION', 2: 'PENDING', 3: 'EXTENDABLE', 4:...
Possible values for the ContactSearch.P_STATUS property.
  CONDITION = {0: 'EQ', 1: 'GT', 2: 'GE', 3: 'LT', 4: 'LE', 5: '...
List of available matching conditions that can be used in AddTerm methods.
  P_CONTACT_SEARCH_STATUS = 200

Inherited from skypekit.Object: rwlock

Instance Variables

Inherited from skypekit.Object: properties

Properties
  contact_search_status

Inherited from object: __class__

Method Details

_sk_init_(self, object_id, transport)

source code 

actual constructor

Overrides: skypekit.Object._sk_init_

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

AddMinAgeTerm(self, min_age_in_years, add_to_subs=False)

source code 

construct CONTACT_BIRTHDAY term based on current time

Arguments:

  • min_age_in_years
  • add_to_subs

Return values:

  • valid

AddMaxAgeTerm(self, max_age_in_years, add_to_subs=False)

source code 

construct CONTACT_BIRTHDAY term based on current time

Arguments:

  • max_age_in_years
  • add_to_subs

Return values:

  • valid

AddEmailTerm(self, email, add_to_subs=False)

source code 

Adds a search term against Contact::P_EMAILS property and pre-validates the value given in the email argument.

Arguments:

  • email - e-mail addres to search for.
  • add_to_subs - This argument enables you to group conditions. See ContactSearch class details for more information.

Return values:

  • valid - Returns false if the value in email property did not look like a valid email address.

AddLanguageTerm(self, language, add_to_subs=False)

source code 

No description available.

Arguments:

  • language
  • add_to_subs

Return values:

  • valid

AddStrTerm(self, prop, cond, value, add_to_subs=False)

source code 

Adds a string search term to a custom contact search object.

Arguments:

  • prop - Following Contact class string propkeys can be used for Contact search:
  • Contact::P_SKYPENAME
  • Contact::P_FULLNAME
  • Contact::P_LANGUAGES
  • Contact::P_COUNTRY
  • Contact::P_PROVINCE
  • Contact::P_CITY
  • Contact::P_PHONE_HOME
  • Contact::P_PHONE_OFFICE
  • Contact::P_PHONE_MOBILE
  • Contact::P_EMAILS
  • Contact::P_HOMEPAGE
  • Contact::P_ABOUT Note that while Contact::P_EMAILS is technically a string and can be used in this method, it is recommended that you use ContactSearch.AddEmailTerm method instead.
    • cond - Search condition (ContactSearch::CONDITION)
    • value - Value to match against.
    • add_to_subs - This argument enables you to group conditions. See ContactSearch class details for more information.

    Return values:

    • valid - Returns true if the ContactSearch term-set remains valid after adding this term.

AddIntTerm(self, prop, cond, value, add_to_subs=False)

source code 

Adds a search term to a custom contact search object. For now, there are only two searchable Contact properties that are integers, so this can oly be used for Contact::P_BIRTHDAY and Contact::P_GENDER.

Arguments:

  • prop - Propkey to search for. Either Contact::P_BIRTHDAY or Contact::P_GENDER
  • cond - Search condition (ContactSearch::CONDITION)
  • value - Value to match against.
  • add_to_subs - This argument enables you to group conditions. See ContactSearch class details for more information.

Return values:

  • valid - Returns true if the ContactSearch term-set remains valid after adding this term.

IsValid(self)

source code 

checks that terms list is non-empty and does not contain unsupported keys

Return values:

  • result

GetResults(self, from_=0, count=4294967295)

source code 

result list is dynamically updated

Arguments:

  • from_
  • count

Return values:

  • contacts

OnNewResult(self, contact, rank_value)

source code 

This callback is fired when a new matching contact has been found during the search.

Return values:

  • contact
  • rank_value

Class Variable Details

STATUS

Possible values for the ContactSearch.P_STATUS property.

  • CONSTRUCTION - Transient state, obtained after submission and actually initiating the search on the network.
  • PENDING - Waiting for results to show up. This is a transient state.
  • EXTENDABLE - Enough matches are found. No more OnNewResult events will fire. The feature of extending long search results is about to be deprecated. It is still possible for search objects to occasionally reach that state, so it should be handled in the UI (as FINISHED), but the extending feature itself should not be implemented in your UI.
  • FINISHED - The search is finished. No more matches are expected. This is a terminal state.
  • FAILED - ContactSearch failed. Better check if the search terms made any sense, with ContactSearch::IsValid. This is a terminal state.
Value:
{1: 'CONSTRUCTION',
 2: 'PENDING',
 3: 'EXTENDABLE',
 4: 'FINISHED',
 5: 'FAILED',
 'CONSTRUCTION': 1,
 'EXTENDABLE': 3,
 'FAILED': 5,
...

CONDITION

List of available matching conditions that can be used in AddTerm methods.

  • EQ - Equals
  • GT - Is greater than
  • GE - Is greater or equal.
  • LT - Is less than
  • LE - Less or equal
  • PREFIX_EQ - Start of a word macthes exactly (string properties only).
  • PREFIX_GE - Start of a word is greater or equal (string properties only).
  • PREFIX_LE - Start of a word is less or equal (string properties only).
  • CONTAINS_WORDS - Contains the word (string properties only).
  • CONTAINS_WORD_PREFIXES - One of the words starts with searched value (string properties only).
Value:
{0: 'EQ',
 1: 'GT',
 2: 'GE',
 3: 'LT',
 4: 'LE',
 5: 'PREFIX_EQ',
 6: 'PREFIX_GE',
 7: 'PREFIX_LE',
...

Property Details

contact_search_status

Get Method:
_sk_get_contact_search_status(self)