Skip to content

Commit

Permalink
web: display our nick/psm/presence
Browse files Browse the repository at this point in the history
  • Loading branch information
borisfaure committed Aug 24, 2010
1 parent 3624382 commit 45b2c49
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
3 changes: 2 additions & 1 deletion amsn2/ui/front_ends/web/contact_list.py
Expand Up @@ -48,7 +48,8 @@ def my_info_updated(self, view):
ourself, such as DP, nick, psm, the current media being played,...
@view: the contactView of the ourself (contains DP, nick, psm,
currentMedia,...)"""
self._main.send("myInfoUpdated", unicode(view.nick))
self._main.send("myInfoUpdated", unicode(view.nick),
unicode(view.presence), unicode(view.psm))

def get_contactlist_widget(self):
return self._clwidget
Expand Down
28 changes: 25 additions & 3 deletions amsn2/ui/front_ends/web/static/js/amsn2.js
Expand Up @@ -66,6 +66,25 @@ function debug(d) {
//}}}
// Contact List {{{
var g_cl = null;
var g_pw = null;

function PersonalWidget(_parent)
{
var parent = _parent;

parent.update('<div id="pw_nick"></div><div id="pw_psm"></div>'
+'<a href="#" id="pw_presence"></a>');

this.remove = function() {
parent.update();
}

this.update = function(_nick, _presence, _psm) {
$('pw_nick').update(_nick);
$('pw_psm').update(_psm);
$('pw_presence').update(_presence);
}
}

function ContactList(_parent)
{
Expand Down Expand Up @@ -548,11 +567,12 @@ function showMainWindow()
});
g_mainWindow.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
fixMainWindow();
g_mainWindow.setHTMLContent('<div id="cl"></div>');
g_mainWindow.setHTMLContent('<div id="pw"></div><div id="cl"></div>');
g_mainWindow.setCloseCallback(logoutCb);
}
if (!g_cl) {
g_cl = new ContactList($('cl'));
g_pw = new PersonalWidget($('pw'));
}

g_mainWindow.showCenter(false, 10, document.viewport.getWidth() - g_mainWindow.getSize()['width'] - 10);
Expand Down Expand Up @@ -584,9 +604,11 @@ function signingIn()
hideLogin();
}

function myInfoUpdated(s)
function myInfoUpdated(_nick, _presence, _psm)
{
// TODO
if (g_pw) {
g_pw.update(_nick, _presence, _psm);
}
}

function loggedOut() {
Expand Down

0 comments on commit 45b2c49

Please sign in to comment.