Dev:UsefulFunctionsForPlugins

From AMSN
Jump to: navigation, search

This page is an effort to document all the interesting functions that a plugin might need to interact with aMSN. This document lists the functions from the core of aMSN and will explain how to use them. Note that all functions from aMSN's core are accessible by plugins, not only the ones listed here, but this document tries to document only those of interest for plugin developers who want to call aMSN's internal functions to interact with it more closely.

Contents

Procs from abook.tcl

Function name Parameters Description Comments
setPersonal field value Allows you to modify your data. Possible FIELDs are:

"mfn" = unparsed nickname
"nick" = parsed nick (as a list with nick coloring and formatting)
"psm" = personal message (status message under the nickname)
"currentmedia" = song listening to
"customnick" = custom nickname
"customfnick" = friendly name (the nickname that can be show in the conversation window)

::abook::setPersonal nick "This is my new nick!"
getPersonal field Allows you to get your data. Possible FIELDs are:

"mfn" = unparsed nickname
"nick" = parsed nick (as a list with nick coloring and formatting)
"psm" = personal message (status message under the nickname)
"currentmedia" = song listening to
"customnick" = custom nickname

set nick [::abook::getPersonal nick]
puts $nick
getLocalIP Gets the local IP.
set ip [::abook::getLocalIP]
puts $ip
setContactData user_login field data Allows you to modify some user's data. (Visible only for you) Possible FIELDs are:

"mfn" = unparsed nickname
"nick" = parsed nick (as a list with nick coloring and formatting)
"psm" = personal message (status message under the nickname)
"currentmedia" = song listening to
"customnick" = custom nickname

::abook::setContactData abcde@hotmail.com nick "This is my contact's new nick!"
getContactData user_login field Allows you to get some user's data. Possible FIELDs are:

"mfn" = unparsed nickname
"nick" = parsed nick (as a list with nick coloring and formatting)
"psm" = personal message (status message under the nickname)
"currentmedia" = song listening to
"customnick" = custom nickname

set nick [::abook::getContactData abcde@hotmail.com nick]
puts $nick
getpsmmedia user_login Allows you to get your/some user's PSM and CurrentMedia. If no "user_login" is specified, proc will return the your PSM and CurrentMedia.
set psmmedia [::abook::getpsmmedia abcde@hotmail.com ]
puts $psmmedia
getNick user_login use_styled_nick Allows you to get your/some user's Nick. The use_styled_nick parameter is a boolean that defines whether you want the nickname to be returned with styles/colors/etc.

If the use_styled_nick parameters is not set, it will default to 0.

set nick [::abook::getNick abcde@hotmail.com ]
puts $nick

Procs from amsncore.tcl

Function name Parameters Description Comments
OnMac Allows you to check if the OS is MAC. Returns 1 if the OS is MAC or 0 if it isn't.
if { [OnMac] } {
    puts "The OS is MAC"
} else {
    puts "The OS isn't MAC"
}
OnDarwin Allows you to check if the OS is Darwin. Returns 1 if the OS is Darwin or 0 if it isn't.
if { [OnDarwin] } {
    puts "The OS is Darwin"
} else {
    puts "The OS isn't Darwin"
}
OnWin Allows you to check if the OS is Windows. Returns 1 if the OS is Windows or 0 if it isn't.
if { [OnWin] } {
    puts "The OS is Windows"
} else {
    puts "The OS isn't Windows"
}
OnWinVista Allows you to check if the OS is Windows Vista. Returns 1 if the OS is Windows Vista or 0 if it isn't.
if { [OnWinVista] } {
    puts "The OS is Windows Vista"
} else {
    puts "The OS isn't Windows Vista"
}
OnBSD Allows you to check if the OS is BSD. Returns 1 if the OS is BSD or 0 if it isn't.
if { [OnBSD] } {
    puts "The OS is BSD"
} else {
    puts "The OS isn't BSD"
}
OnLinux Allows you to check if the OS is Linux. Returns 1 if the OS is Linux or 0 if it isn't.
if { [OnLinux] } {
    puts "The OS is Linux"
} else {
    puts "The OS isn't Linux"
}
OnUnix Allows you to check if the OS is Unix. Returns 1 if the OS is Unix or 0 if it isn't.
if { [OnUnix] } {
    puts "The OS is Unix"
} else {
    puts "The OS isn't Unix"
}
OnX11 Allows you to check if there is X11. Returns 1 if X11 is present or 0 if it isn't.
if { [OnX11] } {
    puts "There is X11"
} else {
    puts "There isn't X11"
}
OnMaemo Allows you to check if the platform is Maemo. Returns 1 if is Maemo or 0 if it isn't.
if { [OnMaemo] } {
    puts "The platform is Maemo"
} else {
    puts "The platform isn't Maemo"
}
play_sound sound_path (absolute_path) (force_play) Allows you to play a sound. It will play a sound. The first parameter is the sound path, relative or absolute depending on the next parameters.
The second parameter is a boolean value (1 or 0). If 1, the sound_path should be an absolute path, else, the sound will be searched in the skin path. Default is 0.

The third parameter is a boolean value (1 or 0). If 1, will force the sound to play (No Sound state will be ignored), else won't play. Default is 0.

play_sound "/home/user-name/Music/music_file01.mp3" 1 0
play_loop sound_path (id) Allows you to play a sound in a loop (repeate). It will play a sound in a loop until the loop is canceled. The first parameter is the sound path, and it must be an absolute path.
The second parameter is an id for the loop (not mandatory). If no id is specified, one will be generated automaticaly. You should set an id, otherwise you won't be able to cancel the loop and some user will get mad =P
play_loop "/home/user-name/Music/music_file01.mp3" 17
cancel_loop id (retry) Allows you to cancel a sound loop. It will cancel a sound loop previously created. The first parameter is the id of the loop.

The second parameter is a boolean value (1 or 0). If 1, will retry.

cancel_loop 17 1

Procs from hotmail.tcl

Function name Parameters Description Comments
viewProfile user_login Allows you to view someone's MSN profile. It will open the default browser and go to the user's msn profile. The first parameter is the user's hotmail account.
::hotmail::viewProfile abcde@hotmail.com
composeMail user_address Allows you to write an email to an user. It will open the default browser and go to our msn account and will open the "Write new email" tab.
::hotmail::composeMail abcde@hotmail.com

Procs from loging.tcl

Function name Parameters Description Comments
OpenLogWin email Allows you to view the log file for some user. It will open the log viewer, and then it'll open the log for the user pased as first parameter.
::log::OpenLogWin abcde@hotmail.com

Procs from plugins.tcl

Function name Parameters Description Comments
plugins_log plugin msg Write a message to the log. It's almost the same that status_log but you know which plugin has called it.
plugins_log myplugin "Debug 000"

Requests

There are a lot of more functions, and really don't know whitch one put here, so, if someone would like to ask me if there is a proc that does X thing, just email me, PM me on the forums, or search me in IRC.

Personal tools