Modding Ekiga's Presence Buttons
The Ekiga soft phone (ekiga.org) is supplied as part of the Gnome desktop. The default sip provider is, not surprisingly, ekiga.net. The provider currently has limited presence support via a script that you can embed in a web page.
Their script will serve up one of two status buttons depending if you are online or not: either a 'call-me button' or an 'offline one.' It does not appear to support a 'do-not disturb' status or anything else at this time.
Their buttons themselves are fine, but are easily replaced with your own status buttons with some simple javascript, if you are so inclined. Really, all you have to do is an image swap.
I wrote a bare-bones script to do just that. Calling the function swapEkigaPresenceImage( ) after the page has loaded (for example in the body tag add the attribute onload="swapEkigaPresenceImage( )" )will swap Ekiga's default buttons with your own. The script probably won't work after Ekiga 3.x is released. All bets are off if ekiga.net changes anything to their current presence support, which could happen at anytime.
I think the following is fairly clear. The function is a simple loop that reads all of the images's src attribute on a page. If it finds an image that's served up from ekiga, it replaces that image with yours. If you don't understand the script, probably better off not mucking around with such things anyways.
You'll have to design your own buttons, that's the point after all.
You can add the script to the head section of your web page, your script library, or wherever it makes sense for your site. Remember to call the function after the page has loaded or it won't work. If you would like to share the script, link back to here rather than reposting somewhere else as those damn php-nukers do.
What would be nice, is if ekiga.net provided an option in their script for those of us that like to customize things. Perhaps add a second variable to their script that a user could set to either 'default' or 'custom.' The 'custom' setting could simply return a text node inside of div tags with an id attribute, for example, the user's sip-address. The text could simply be 'online,' or 'offline.' Then it would be easy to write a script to determine the current status, and grab/replace the node with whatever markup desired.
And that's it!
Their script will serve up one of two status buttons depending if you are online or not: either a 'call-me button' or an 'offline one.' It does not appear to support a 'do-not disturb' status or anything else at this time.
Their buttons themselves are fine, but are easily replaced with your own status buttons with some simple javascript, if you are so inclined. Really, all you have to do is an image swap.
I wrote a bare-bones script to do just that. Calling the function swapEkigaPresenceImage( ) after the page has loaded (for example in the body tag add the attribute onload="swapEkigaPresenceImage( )" )will swap Ekiga's default buttons with your own. The script probably won't work after Ekiga 3.x is released. All bets are off if ekiga.net changes anything to their current presence support, which could happen at anytime.
I think the following is fairly clear. The function is a simple loop that reads all of the images's src attribute on a page. If it finds an image that's served up from ekiga, it replaces that image with yours. If you don't understand the script, probably better off not mucking around with such things anyways.
# Thomas Evdokimoff 2007-08-24
# function swapEkigaPresenceImage( ) {
# /* Edit the following two vars accordingly */
# var myOnlineImage = "path/to/your_online.png";
# var myOfflineImage = "path/to/your_offline.png";
# for (var x=0; x < document.images.length; x++){
# var ekigaText = document.images[x].getAttribute("src");
# if (ekigaText.match(/ekiga/) && ekigaText.match(/call-me/) ) {
# document.images[x].setAttribute("src", myOnlineImage);
# } else if (ekigaText.match(/ekiga/) && ekigaText.match(/offline/) ) {
# document.images[x].setAttribute("src", myOfflineImage);
# } //end conditionals
# } // end for loop
# } // end function
You'll have to design your own buttons, that's the point after all.
You can add the script to the head section of your web page, your script library, or wherever it makes sense for your site. Remember to call the function after the page has loaded or it won't work. If you would like to share the script, link back to here rather than reposting somewhere else as those damn php-nukers do.
What would be nice, is if ekiga.net provided an option in their script for those of us that like to customize things. Perhaps add a second variable to their script that a user could set to either 'default' or 'custom.' The 'custom' setting could simply return a text node inside of div tags with an id attribute, for example, the user's sip-address. The text could simply be 'online,' or 'offline.' Then it would be easy to write a script to determine the current status, and grab/replace the node with whatever markup desired.
And that's it!
Labels: ekiga

<< Home