Class Index | File Index

Classes


Class com.gContactSync.Import


Defined in: Import.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
This class is used to import contacts using OAuth.
Field Summary
Field Attributes Field Name and Description
<static>  
com.gContactSync.Import.mMap
Maps Portable Contacts attributes to TB nsIAbCard attributes
<static>  
com.gContactSync.Import.mMapfacebook
Map for Facebook only
<static>  
com.gContactSync.Import.mMapmyspace
Map for MySpace only
<static>  
com.gContactSync.Import.mMapplaxo
Map for Plaxo only
<static>  
com.gContactSync.Import.mMaptwitter
Maps Twitter attributes to TB
<static>  
com.gContactSync.Import.mOAuth
Stores encoded OAuth variables, such as the oauth_token, oauth_token_secret, and oauth_verifier
<static>  
com.gContactSync.Import.mSource
The 'source' from which contacts are imported (Plaxo, Google, etc.
<static>  
com.gContactSync.Import.mStarted
This is used internally to track whether an import is in progress
<static>  
com.gContactSync.Import.mWindow
A reference to the window TODO remove
Method Summary
Method Attributes Method Name and Description
<static>  
com.gContactSync.Import.beginImport(aFeed)
Begins the actual import given a JSON feed of contacts.
<static>  
com.gContactSync.Import.decode(aString)
Decodes text returned in a JSON feed.
<static>  
com.gContactSync.Import.finish(httpReq)
Gets the response from step 4 and calls beginImport to parse the JSON feed of contacts.
<static>  
com.gContactSync.Import.httpReqWrapper(aURL, aCallback)
A wrapper for HttpRequest for use when importing contacts.
<static>  
com.gContactSync.Import.logStep2b()
Step 2b: The second of two substeps where the user is prompted for his or her credentials on the third-party website.
<static>  
com.gContactSync.Import.mOfflineFunction(httpReq)
Commands to execute when offline during an HTTP Request
<static>  
com.gContactSync.Import.mozillaLabsContactsImporter()
Attempts to import from the Mozilla Labs Contacts add-on.
<static>  
com.gContactSync.Import.openBrowserWindow(aUrl, aBeforeUnload)
Opens a window at the given URL and optionally sets an onbeforeunload listener.
<static>  
com.gContactSync.Import.step1(aSource)
Step 1: Get an initial, unauthorized oauth_token and oauth_token_secret.
<static>  
com.gContactSync.Import.step2a(httpReq)
Step 2a: The first of two substeps where the user is prompted for his or her credentials on the third-party website.
<static>  
com.gContactSync.Import.step2b(httpReq)
Step 2b: The second of two substeps where the user is prompted for his or her credentials on the third-party website.
<static>  
com.gContactSync.Import.step3()
Step 3: Gets the new oauth_token then activates the token.
<static>  
com.gContactSync.Import.step4(httpReq)
Step 4: Use the token to fetch the user's contacts.
<static>  
com.gContactSync.Import.storeResponse(aResponse)
Parses and stores a URL-encoded response in the following format: param1=value1&param2=value2&param3=value3.
Class Detail
com.gContactSync.Import()
This class is used to import contacts using OAuth. This requires some interaction with a remote website (pirules.org) for authentication. pirules.org stores the following information for each source - oauth_consumer_key - oauth_consumer_secret - base API URL - @me/@self URL - @me/@all or @me/@friends URL etc. It also reorganizes and signs the parameters. TODO List: - Attempt to get more contact info from MySpace
Field Detail
<static> com.gContactSync.Import.mMap
Maps Portable Contacts attributes to TB nsIAbCard attributes

<static> com.gContactSync.Import.mMapfacebook
Map for Facebook only

<static> com.gContactSync.Import.mMapmyspace
Map for MySpace only

<static> com.gContactSync.Import.mMapplaxo
Map for Plaxo only

<static> com.gContactSync.Import.mMaptwitter
Maps Twitter attributes to TB

<static> com.gContactSync.Import.mOAuth
Stores encoded OAuth variables, such as the oauth_token, oauth_token_secret, and oauth_verifier

<static> com.gContactSync.Import.mSource
The 'source' from which contacts are imported (Plaxo, Google, etc.)

<static> com.gContactSync.Import.mStarted
This is used internally to track whether an import is in progress

<static> com.gContactSync.Import.mWindow
A reference to the window TODO remove
Method Detail
<static> com.gContactSync.Import.beginImport(aFeed)
Begins the actual import given a JSON feed of contacts. It promps the user for a name for the destination AB (can be new or old).
Parameters:
aFeed
{string} The JSON feed of contacts to parse.

<static> {string} com.gContactSync.Import.decode(aString)
Decodes text returned in a JSON feed.
Parameters:
aString
{string} The text to decode.
Returns:
{string} The decoded text.

<static> com.gContactSync.Import.finish(httpReq)
Gets the response from step 4 and calls beginImport to parse the JSON feed of contacts.
Parameters:
httpReq

<static> com.gContactSync.Import.httpReqWrapper(aURL, aCallback)
A wrapper for HttpRequest for use when importing contacts.
Parameters:
aURL
{string} The URL to send the GET request to.
aCallback
{function} The callback function if the request succeeds.

<static> com.gContactSync.Import.logStep2b()
Step 2b: The second of two substeps where the user is prompted for his or her credentials on the third-party website. This just logs that step 2b has finished (the login page was opened)

<static> com.gContactSync.Import.mOfflineFunction(httpReq)
Commands to execute when offline during an HTTP Request
Parameters:
httpReq

<static> com.gContactSync.Import.mozillaLabsContactsImporter()
Attempts to import from the Mozilla Labs Contacts add-on. https://wiki.mozilla.org/Labs/Contacts/ContentAPI

<static> com.gContactSync.Import.openBrowserWindow(aUrl, aBeforeUnload)
Opens a window at the given URL and optionally sets an onbeforeunload listener.
Parameters:
aUrl
{string} The URL to open.
aBeforeUnload
{function} The function to run before the window is unloaded.

<static> com.gContactSync.Import.step1(aSource)
Step 1: Get an initial, unauthorized oauth_token and oauth_token_secret. This is done mostly on pirules.org which contains the consumer token and secret for various sources and signs the parameters. pirules.org returns the response from the source, usually of the form: oauth_token=1234&oauth_token_secret=5678
Parameters:
aSource
{string} The source from which the contacts are obtained, in lowercase, as supported by pirules.org.

<static> com.gContactSync.Import.step2a(httpReq)
Step 2a: The first of two substeps where the user is prompted for his or her credentials on the third-party website. In this substep, gContactSync gets the login URL from pirules.org with all it's parameters and the oauth_signature. This is done in step 1 for OAuth 2.0 (Facebook only at the moment).
Parameters:
httpReq

<static> com.gContactSync.Import.step2b(httpReq)
Step 2b: The second of two substeps where the user is prompted for his or her credentials on the third-party website. In this substep, gContactSync opens a browser to the login page for the particular source.
Parameters:
httpReq

<static> com.gContactSync.Import.step3()
Step 3: Gets the new oauth_token then activates the token. This step must be initiated by the user (for now). TODO - find a way to automatically start step3 when possible.

<static> com.gContactSync.Import.step4(httpReq)
Step 4: Use the token to fetch the user's contacts. This sends a request and the token/token secret to pirules.org which signs and sends the request to the source's @me/@friend URL.
Parameters:
httpReq

<static> com.gContactSync.Import.storeResponse(aResponse)
Parses and stores a URL-encoded response in the following format: param1=value1&param2=value2&param3=value3... The parsed parameters and values are stored (still encoded) in com.gContactSync.Import.mOAuth[param] = value;
Parameters:
aResponse
{string} The encoded response to parse.

Documentation generated by JsDoc Toolkit 2.1.0 on Fri May 06 2011 09:24:18 GMT-0400 (EDT)