Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

web: add status icons in CL. closes #23

  • Loading branch information...
commit 36243821c64757a40a44d342213533526d4eb068 1 parent 8b03a12
@billiob billiob authored
View
1  amsn2/ui/front_ends/web/_web.py
@@ -1,4 +1,3 @@
-from bend import *
from main_loop import *
from main import *
from contact_list import *
View
4 amsn2/ui/front_ends/web/contact_list.py
@@ -112,5 +112,7 @@ def contact_updated(self, contactView):
in the affects groups.
"""
self.contacts[contactView.uid]=contactView
- self._main.send("contactUpdated", contactView.uid, unicode(contactView.name))
+ self._main.send("contactUpdated", contactView.uid,
+ unicode(contactView.name),
+ unicode(contactView.status))
View
32 amsn2/ui/front_ends/web/static/js/amsn2.js
@@ -227,10 +227,16 @@ function Contact(_gid, _uid)
{
var name = "";
var uid = _uid;
+ var status = "offline";
var elem = new Element('li',
{id: 'ct_' + _uid + '_' + _gid,
onclick: 'g_cl.contactClick(\''+uid+'\'); return false;'});
+ var img = new Element('img',
+ {src: 'static/images/icons/'+status+'.png'});
+ var span = new Element('span');
+ elem.insert(img);
+ elem.insert(span);
var elements = {};
elements[_gid] = elem;
@@ -249,9 +255,20 @@ function Contact(_gid, _uid)
}
this.setName = function(_name) {
- name = _name;
- for (k in elements) {
- elements[k].update(_name);
+ if (name != _name) {
+ name = _name;
+ for (k in elements) {
+ elements[k].childElements()[1].update('&nbsp'+_name);
+ }
+ }
+ }
+ this.setStatus = function(_status) {
+ if (status != _status) {
+ status = _status;
+ for (k in elements) {
+ e = elements[k].childElements()[0];
+ e.writeAttribute('src','static/images/icons/'+status+'.png');
+ }
}
}
@@ -304,10 +321,13 @@ function groupUpdated(uid, name, contact_ids)
}
}
-function contactUpdated(uid, name)
+function contactUpdated(uid, name, status)
{
- if (g_cl)
- g_cl.getContact(uid).setName(name);
+ if (g_cl) {
+ c = g_cl.getContact(uid);
+ c.setName(name);
+ c.setStatus(status);
+ }
}
// }}}
// ChatWindow {{{
Please sign in to comment.
Something went wrong with that request. Please try again.