Skip to content

Commit

Permalink
announance joining room
Browse files Browse the repository at this point in the history
  • Loading branch information
mick committed Apr 4, 2012
1 parent e664187 commit 67540bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 8 additions & 4 deletions web/static/client.js
Expand Up @@ -132,19 +132,23 @@ var talkback = {
var message = $msg.find("body").text();
var $messagebox = $("<div class='messagebox'><span class='username'>"+from+":</span> "+message+"</div>");
$("#chatcontent").append($messagebox);
console.log(msg);
return true;
},
roomPresence:function(msg){
console.log("presence: ",$(msg).attr("from"));
console.log("roster: ", talkback.roster);
if($(msg).attr("from") in talkback.roster){
if(talkback.roster[$(msg).attr("from")] !== undefined){
if($(msg).find("photo").text() == talkback.roster[$(msg).attr("from")]){
// we have the image and it is current
return true;
}
}else{
//announce in chat.
var from = $(msg).attr("from").replace(talkback.roomjid+"/","");
var $messagebox = $("<div class='messagebox joined'>"+from+" joined</div>");
$("#chatcontent").append($messagebox);
talkback.roster[$(msg).attr("from")] = $(msg).attr("from");
}
connection.vcard.get(talkback.vcardHandler, $(msg).attr("from"));
//connection.vcard.get(talkback.vcardHandler, $(msg).attr("from"));
return true;
},
sendRoomMessage:function(message){
Expand Down
8 changes: 8 additions & 0 deletions web/static/style.css
Expand Up @@ -70,6 +70,14 @@ div#chatcontent div.messagebox{
min-height:20px;
margin-bottom:10px;
}
div#chatcontent div.messagebox.joined{
font-weight:bold;
font-size:0.6em;
color:#666;
min-height:10px;
padding:1px 5px;
margin-bottom:2px;
}
div#chatcontent span.username{
font-weight:bold;
font-size:0.8em;
Expand Down

0 comments on commit 67540bf

Please sign in to comment.