Changeset 2821
- Timestamp:
- 05/19/10 10:42:58 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js
r2815 r2821 494 494 if( status == Strophe.Status.CONNECTED ) 495 495 { 496 loadscript.setStatusJabber('Dispon ível','available');496 loadscript.setStatusJabber('Disponï¿œvel','available'); 497 497 TrophyIM.statusConn.connected = true; 498 498 TrophyIM.showClient(); … … 677 677 } 678 678 679 // Message with body are "content message", this mean state active679 // Message with body are "content message", this means state active 680 680 if ( elems.length > 0 ) 681 681 { … … 713 713 { 714 714 if( chatBox != null ) 715 state = TrophyIM.getChatState(msg); 716 } 717 718 if( chatBox != null ) 719 chatBox.innerHTML = '<font style="font-weight:bold; color:grey; margin-left: 5px; float:right;">' + state + '</font>'; 715 state = contact + TrophyIM.getChatState(msg); 716 } 717 718 // Clean chat status message some time later 719 var clearChatState = function(){ 720 chatBox.innerHTML=''; 721 } 722 723 if (chatBox != null) { 724 chatBox.innerHTML = "<font style='font-weight:bold; color:grey; margin-left: 5px; float:left;'>" + state + "</font>"; 725 var clearChatState = setTimeout(clearChatState, 2000); 726 } 720 727 721 728 return true; … … 734 741 if ( state.length > 0 ) 735 742 { 736 return ' estáinativo...';743 return ' está inativo...'; 737 744 } 738 745 else … … 748 755 if ( state.length > 0 ) 749 756 { 750 return ' est ádigitando...';757 return ' está digitando...'; 751 758 } 752 759 else … … 755 762 if ( state.length > 0 ) 756 763 { 757 return ' est áparado...';764 return ' está parado...'; 758 765 } 759 766 } … … 831 838 loadscript.configEvents( _textarea, 'onkeyup', function( e ) 832 839 { 840 setComposing(); 833 841 if ( e.keyCode == 13 ) 834 842 _send_message( ); … … 860 868 loadscript.getPhotoUser(barejid); 861 869 870 var composingTimer_ = 0; 871 var isComposing_ = 0; 872 var timeCounter; 873 874 function setComposing() 875 { 876 var checkComposing = function() 877 { 878 if (!isComposing_) { 879 // User stopped composing 880 composingTimer_ = 0; 881 clearInterval(timeCounter); 882 TrophyIM.sendContentMessage(barejid, 'paused'); 883 } else { 884 TrophyIM.sendContentMessage(barejid, 'composing'); 885 } 886 isComposing_ = 0; // Reset composing 887 } 888 889 if (!composingTimer_) { 890 /* User (re)starts composing */ 891 composingTimer_ = 1; 892 timeCounter = setInterval(checkComposing,3000); 893 } 894 isComposing_ = 1; 895 } 896 862 897 _textarea.focus( ); 863 898 … … 1204 1239 case "none" : 1205 1240 1206 paramsContact.status = " (( PEDIR AUTORIZA ÇAO ! )) ";1241 paramsContact.status = " (( PEDIR AUTORIZAÃÃO ! )) "; 1207 1242 paramsContact.statusColor = "red"; 1208 1243 break; … … 1210 1245 case "to" : 1211 1246 1212 paramsContact.status = " (( CONTATO PEDE AUTORIZA ÇÃO ! )) ";1247 paramsContact.status = " (( CONTATO PEDE AUTORIZAÃÃO ! )) "; 1213 1248 paramsContact.statusColor = "orange"; 1214 1249 break; … … 1222 1257 case "subscribe" : 1223 1258 1224 paramsContact.status = " (( AUTORIZA ÇÃO ENVIADA ! )) ";1259 paramsContact.status = " (( AUTORIZAÃÃO ENVIADA ! )) "; 1225 1260 paramsContact.statusColor = "red"; 1226 1261 break; … … 1228 1263 case "not-in-roster" : 1229 1264 1230 paramsContact.status = " (( QUERO ADICION Á-LO(A) ! POSSO ? )) ";1265 paramsContact.status = " (( QUERO ADICIONÃ-LO(A) ! POSSO ? )) "; 1231 1266 paramsContact.statusColor = "orange"; 1232 1267 break; … … 1295 1330 case "none" : 1296 1331 1297 status = " (( PEDIR AUTORIZA ÇAO ! )) ";1332 status = " (( PEDIR AUTORIZAÃÃO ! )) "; 1298 1333 statusColor = "red"; 1299 1334 break; … … 1301 1336 case "to" : 1302 1337 1303 status = " (( CONTATO PEDE AUTORIZA ÇÃO ! )) ";1338 status = " (( CONTATO PEDE AUTORIZAÃÃO ! )) "; 1304 1339 statusColor = "orange"; 1305 1340 break; … … 1313 1348 case "subscribe" : 1314 1349 1315 status = " (( AUTORIZA ÇÃO ENVIADA ! )) ";1350 status = " (( AUTORIZAÃÃO ENVIADA ! )) "; 1316 1351 statusColor = "red"; 1317 1352 break; … … 1319 1354 case "not-in-roster" : 1320 1355 1321 status = " (( QUERO ADICION Á-LO(A) ! POSSO ? )) ";1356 status = " (( QUERO ADICIONÃ-LO(A) ! POSSO ? )) "; 1322 1357 statusColor = "orange"; 1323 1358 break; … … 1440 1475 if( _type != 'status') 1441 1476 { 1442 if( _type == "unavailable" && TrophyIM.statusConn.connected)1477 if( _type == "unavailable") 1443 1478 { 1444 1479 var loading_gif = document.getElementById("JabberIMRosterLoadingGif"); … … 1543 1578 */ 1544 1579 1545 sendMessage : function( _jidTo, _message)1580 sendMessage : function() 1546 1581 { 1547 _message = _message.replace(/^\s+|\s+$|^\n|\n$/g,""); 1548 1549 if( _message != "" ) 1550 { 1551 // Send Message 1552 TrophyIM.connection.send( 1553 $msg( { 1554 to: _jidTo, from: TrophyIM.connection.jid, 1555 type: 'chat' 1556 } ).c('body').t( _message ).tree() 1557 ); 1558 return true; 1582 if (arguments.length > 0) { 1583 var jidTo = arguments[0]; 1584 var message_input = arguments[1]; 1585 1586 1587 message_input = message_input.replace(/^\s+|\s+$|^\n|\n$/g, ""); 1588 1589 if (message_input != "") { 1590 1591 // Send Message 1592 var newMessage = $msg({ 1593 to: jidTo, 1594 from: TrophyIM.connection.jid, 1595 type: 'chat' 1596 }); 1597 newMessage = newMessage.c('body').t(message_input); 1598 newMessage.up(); 1599 newMessage = newMessage.c('active').attrs({ 1600 xmlns: 'http://jabber.org/protocol/chatstates' 1601 }); 1602 // Send Message 1603 TrophyIM.connection.send(newMessage.tree()); 1604 1605 return true; 1606 } 1559 1607 } 1560 1608 1561 1609 return false; 1610 }, 1611 1612 /** Function: sendContentMessage 1613 * 1614 * Send a content message from chat input to user 1615 */ 1616 sendContentMessage : function() 1617 { 1618 if( arguments.length > 0 ) 1619 { 1620 var jidTo = arguments[0]; 1621 var state = arguments[1]; 1622 1623 var newMessage = $msg({to: jidTo, from: TrophyIM.connection.jid, type: 'chat'}); 1624 newMessage = newMessage.c(state).attrs({xmlns : 'http://jabber.org/protocol/chatstates'}); 1625 // Send content message 1626 TrophyIM.connection.send(newMessage.tree()); 1627 } 1562 1628 } 1563 1629 };
Note: See TracChangeset
for help on using the changeset viewer.