- Timestamp:
- 04/13/10 17:48:28 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js
r2491 r2511 656 656 'path_jabberit' : path_jabberit 657 657 }; 658 658 659 titleWindow = barejid.toLowerCase(); 660 titleWindow = titleWindow.substring(0, titleWindow.indexOf('@')); 661 659 662 if( TrophyIM.rosterObj.roster[barejid] ) 660 663 { … … 664 667 } 665 668 } 666 else667 {668 titleWindow = barejid.toLowerCase();669 titleWindow = titleWindow.substring(0, titleWindow.indexOf('@'));670 }671 669 672 670 var winChatBox = … … 687 685 688 686 _winBuild(winChatBox); 687 688 // Photo User; 689 loadIM.getPhotoUser(barejid); 689 690 690 691 loadIM.configEvents( document.getElementById( barejid + '__sendBox'), … … 999 1000 for( var i = 0 ; i < users.length; i++ ) 1000 1001 { 1001 if( TrophyIM.rosterObj.roster[users[i]].contact.groups ) 1002 { 1003 var groups = TrophyIM.rosterObj.roster[users[i]].contact.groups; 1004 1005 if( groups.length > 0 ) 1002 if( TrophyIM.rosterObj.roster[users[i]].contact.jid != loadIM.getUserCurrent().jid ) 1003 { 1004 if( TrophyIM.rosterObj.roster[users[i]].contact.groups ) 1006 1005 { 1007 for( var j = 0; j < groups.length; j++ ) 1008 addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element, j ); 1006 var groups = TrophyIM.rosterObj.roster[users[i]].contact.groups; 1007 1008 if( groups.length > 0 ) 1009 { 1010 for( var j = 0; j < groups.length; j++ ) 1011 addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element, j ); 1012 } 1013 else 1014 { 1015 addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element, 0 ); 1016 } 1009 1017 } 1010 1018 else … … 1013 1021 } 1014 1022 } 1015 else1016 {1017 addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element, 0 );1018 }1019 1023 } 1020 1024 }, … … 1046 1050 */ 1047 1051 1048 setPresence : function( show ) 1049 { 1050 TrophyIM.connection.send($pres( ).c('show').t(show).tree()); 1052 setPresence : function( type ) 1053 { 1054 if( type != 'status') 1055 { 1056 TrophyIM.connection.send($pres( ).c('show').t(type).tree()); 1057 } 1058 else 1059 { 1060 var _show = "available"; 1061 var _status = ""; 1062 1063 if (( _status = prompt("Digite sua mensagem !") )) 1064 { 1065 for(var resource in TrophyIM.rosterObj.roster[loadIM.getUserCurrent().jid].presence ) 1066 { 1067 if ( TROPHYIM_RESOURCE === ("/" + resource) ) 1068 _show = TrophyIM.rosterObj.roster[loadIM.getUserCurrent().jid].presence[resource].show; 1069 } 1070 1071 var _presence = $pres( ); 1072 _presence.node.appendChild( Strophe.xmlElement( 'show' ) ).appendChild( Strophe.xmlTextNode( _show ) ); 1073 _presence.node.appendChild( Strophe.xmlElement( 'status' ) ).appendChild( Strophe.xmlTextNode( _status ) ); 1074 1075 TrophyIM.connection.send( _presence.tree() ); 1076 } 1077 } 1051 1078 }, 1052 1079 … … 1157 1184 this.addContact = function(jid, subscription, name, groups ) 1158 1185 { 1159 if( jid != loadIM.getUserCurrent().jid ) 1160 { 1161 if( subscription !== "remove" ) 1162 { 1163 var contact = { jid:jid, subscription:subscription, name:name, groups:groups } 1164 var jid_lower = jid.toLowerCase(); 1165 1166 if ( this.roster[jid_lower] ) 1186 if( subscription !== "remove" ) 1187 { 1188 var contact = { jid:jid, subscription:subscription, name:name, groups:groups } 1189 var jid_lower = jid.toLowerCase(); 1190 1191 if ( this.roster[jid_lower] ) 1192 { 1193 this.roster[jid_lower]['contact'] = contact; 1194 } 1195 else 1196 { 1197 this.roster[jid_lower] = {contact:contact}; 1198 } 1199 1200 groups = groups ? groups : ['']; 1201 1202 for ( var g = 0; g < groups.length; g++ ) 1203 { 1204 if ( !this.groups[groups[g]] ) 1167 1205 { 1168 this.roster[jid_lower]['contact'] = contact; 1169 } 1170 else 1171 { 1172 this.roster[jid_lower] = {contact:contact}; 1173 } 1174 1175 groups = groups ? groups : ['']; 1176 1177 for ( var g = 0; g < groups.length; g++ ) 1178 { 1179 if ( !this.groups[groups[g]] ) 1180 { 1181 this.groups[groups[g]] = {}; 1182 } 1183 1184 this.groups[groups[g]][jid_lower] = jid_lower; 1185 } 1206 this.groups[groups[g]] = {}; 1207 } 1208 1209 this.groups[groups[g]][jid_lower] = jid_lower; 1186 1210 } 1187 else1188 {1189 this.removeContact(jid);1190 }1211 } 1212 else 1213 { 1214 this.removeContact(jid); 1191 1215 } 1192 1216 } … … 1314 1338 var jid_lower = barejid.toLowerCase(); 1315 1339 1316 if( barejid != loadIM.getUserCurrent().jid ) 1317 { 1318 if( show != 'unavailable') 1319 { 1320 if (!this.roster[jid_lower]) 1321 { 1322 this.addContact(barejid, 'not-in-roster'); 1323 } 1324 var presence = 1325 { 1326 resource:resource, priority:priority, show:show, status:status 1327 } 1328 1329 if (!this.roster[jid_lower]['presence']) 1330 { 1331 this.roster[jid_lower]['presence'] = {} 1332 } 1333 this.roster[jid_lower]['presence'][resource] = presence 1334 } 1335 else if (this.roster[jid_lower] && this.roster[jid_lower]['presence'] && this.roster[jid_lower]['presence'][resource]) 1336 { 1337 delete this.roster[jid_lower]['presence'][resource]; 1338 } 1339 1340 this.addChange(jid_lower); 1341 1342 if (TrophyIM.activeChats['divs'][jid_lower]) 1343 { 1344 TrophyIM.setTabPresence(jid_lower, TrophyIM.activeChats['divs'][jid_lower]['tab']); 1345 } 1346 } 1340 if( show != 'unavailable') 1341 { 1342 if (!this.roster[jid_lower]) 1343 { 1344 this.addContact(barejid, 'not-in-roster'); 1345 } 1346 var presence = 1347 { 1348 resource:resource, priority:priority, show:show, status:status 1349 } 1350 1351 if (!this.roster[jid_lower]['presence']) 1352 { 1353 this.roster[jid_lower]['presence'] = {} 1354 } 1355 this.roster[jid_lower]['presence'][resource] = presence 1356 } 1357 else if (this.roster[jid_lower] && this.roster[jid_lower]['presence'] && this.roster[jid_lower]['presence'][resource]) 1358 { 1359 delete this.roster[jid_lower]['presence'][resource]; 1360 } 1361 1362 this.addChange(jid_lower); 1347 1363 } 1348 1364
Note: See TracChangeset
for help on using the changeset viewer.