Dev:aMSN API

From AMSN
Jump to: navigation, search

Contents

aMSN API

Address Book (abook.tcl)

Currently we're working to move everything related to user information and contact lists managing into the ===::abook=== namespace. These are the main procedures:

proc clearData { }

Restarts and clears all internal user data. Should be called at the beginning, or whenever we want to forget all user information and contact lists.

proc setContactData { user_login field data }

Sets some data to a user. All user data is stored so every user can have any number of data fields, like for example "user_login", "user_nick", "user_custom_nick", "user_picture",... This procedure is used to set a data field

Parameters:

user_login: the user you want to set data to field: the field you want to set data: the data that will be contained in the given field

proc setVolatileData { user_login field data }

Sets some volatile data to a user. This works exactly like setContactData, but this data won't be saved to disk. It's used for storing user state, or user msnobj, for example.

proc getContactData { user_login field }

This function is used to retrieve a previously stored user data. It returns the data stored in the given field of the given user. If the user does not exist in the address book, or that user doesn't have the given field set to anything, the function will return an empty string.

Parameters:

user_login: the user you want to retrieve data from field: the field you want to get

proc getVolatileData { user_login }

This function is used to retrieve a previously stored volatile user data. It returns the data stored in the given field of the given user.

proc getAllContacts {}

Returns a list with all contact IDs

proc saveToDisk {}

Saves the address book info to disk, if it's in Consistent state (see set/unsetConsistent)

proc loadFromDisk {}

Loads the address book info from disk

proc setConsistent {}

Set the consistent state to the address book. It means that the address book is in a safe state, with consistent information, and it can be saved to disk safely with no problems.

proc unsetConsistent {}

Unsets the "consistent" state to the address book, meaning that it's now empty or being modified in such a way that saving it to disk would produce some data lost.

proc getUserNickname { user_login }

This function returns the nickname the remote user has set to itself, ignoring any Custom Nick the local user has set.

proc getUserDisplayName { user_login }

This function returns the email, original nickname, or custom nickname of the given user, depending on the configuration. Right now (by the time I write this) custom nicknames are not implemented, so this will return the email or the nickname depending on the showemailsincontactlist configuration.

proc getGroups {user_login}

Returns a list with the IDs of the groups the user belongs to. To get a group name use ~np~::groups::GetName~/np~.

proc addContactToGroup { user_login grId }

Adds a user to the given group ID. This updates the group field of the given user.

proc removeContactFromGroup { user_login grId }

Removes the user from the given group ID. This updates the group field of the given user.

proc getLists {user_login}

Returns a list with the lists the user belongs to (AL, BL, FL, RL).

proc addContactToList{ user_login listId }

Adds a user to the given List (AL, BL, FL or RL).

proc removeContactFromList { user_login listId }

Removes the user from the List (AL, BL, FL or RL).

GUI

amsn namespace contains all GUI related functions and procedures. Anything relating to the GUI should be included here. However, we shouldn't include here any protocol dependent thing...

Functions description

proc installTLS { }

Runs the TLS Installation wizard, that helps you download the TLS module from our web site. The TLS module is needed for the new MSNP8 authentication system, using SSL.

Protocol

MSN namespace contains all protocol related functions and procedures

Personal tools