Changeset 2975
- Timestamp:
- 06/28/10 12:13:37 (14 years ago)
- Location:
- trunk/jmessenger/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jmessenger/js/jscode/loadIM.js
r2969 r2975 57 57 var _element = ( e.target ) ? e.target : e.srcElement; 58 58 var jid = arguments[1]; 59 var index = arguments[2];60 59 var coord = null; 61 60 … … 79 78 { 80 79 if( e.button > 1 ) 81 optionsItensContact( jid, index,coord );80 optionsItensContact( jid, coord ); 82 81 else 83 82 TrophyIM.rosterClick(jid); … … 86 85 { 87 86 if( e.which > 1 ) 88 optionsItensContact( jid, index,coord );87 optionsItensContact( jid, coord ); 89 88 else 90 89 if( e.target.id ) … … 281 280 } 282 281 } 283 282 283 function disabledNotificationNewUsers() 284 { 285 var _notification = getElement('notification_new_users_jabber') ; 286 var _statusJabber = getElement('status_jabber_expresso'); 287 288 _notification.style.display = 'none'; 289 290 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat"; 291 292 if( _timeOutNotification ) 293 clearTimeout(_timeOutNotification ); 294 295 TrophyIM.controll.notificationNewUsers = 0; 296 } 297 298 function enabledNotificationNewUsers() 299 { 300 var _notification = getElement('notification_new_users_jabber') ; 301 var _statusJabber = getElement('status_jabber_expresso'); 302 303 if( _notification && _statusJabber ) 304 { 305 if ( _notification.style.display == 'none' ) 306 { 307 _notification.style.display = 'block'; 308 309 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/alert_mini.png') no-repeat"; 310 311 if( _timeOutNotification ) 312 clearTimeout(_timeOutNotification ); 313 314 _timeOutNotification = setTimeout( function(){ enabledNotificationNewUsers(); }, 2000 ); 315 } 316 else 317 { 318 _notification.style.display = 'none'; 319 320 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat"; 321 322 if( _timeOutNotification ) 323 clearTimeout(_timeOutNotification ); 324 325 _timeOutNotification = setTimeout( function(){ enabledNotificationNewUsers(); }, 800 ); 326 } 327 } 328 } 329 284 330 function fastMenu() 285 331 { … … 579 625 { 580 626 var jid = arguments[0]; 581 var index = arguments[1]; 582 var coord = arguments[2]; 583 var element = getElement('itenContact_' + jid + '_' + index ); 627 var coord = arguments[1]; 628 var element = getElement('itenContact_' + jid ); 584 629 var action = ( element.getAttribute("subscription") === "not-in-roster" ) ? "Adicionar" : "Autorizar"; 585 630 … … 588 633 589 634 var _options = [ 590 [ action , 'loadscript.setAutorization(\''+jid+'\' ,\''+index+'\')'],591 ['Remover' , 'loadscript.removeContact(\''+jid+'\' ,\''+index+'\')'],592 ['Renomear' , 'loadscript.renameContact(\''+jid+'\' ,\''+index+'\')'],593 ['Trocar grupo' , 'loadscript.renameGroup(\''+jid+'\' ,\''+index+'\')']635 [ action , 'loadscript.setAutorization(\''+jid+'\')'], 636 ['Remover' , 'loadscript.removeContact(\''+jid+'\')'], 637 ['Renomear' , 'loadscript.renameContact(\''+jid+'\')'], 638 ['Trocar grupo' , 'loadscript.renameGroup(\''+jid+'\')'] 594 639 ]; 595 640 … … 709 754 } 710 755 711 function removeContact(jid, index) 712 { 713 setTimeout(function() 714 { 715 TrophyIM.removeContact(jid, index); 716 717 },300); 756 function removeContact( jid ) 757 { 758 TrophyIM.removeContact( jid ); 718 759 } 719 760 … … 742 783 { 743 784 var _jid = arguments[0]; 744 var _index = arguments[1]; 745 746 TrophyIM.renameContact( _jid, _index ); 785 786 TrophyIM.renameContact( _jid ); 747 787 } 748 788 } … … 753 793 { 754 794 var _jid = arguments[0]; 755 var _index = arguments[1]; 756 757 TrophyIM.renameGroup( _jid , _index ); 795 796 TrophyIM.renameGroup( _jid ); 758 797 } 759 798 } … … 815 854 } 816 855 817 function setAutorization(jidTo, indexTo) 818 { 819 var divItenContact = null; 820 821 if( ( divItenContact = getElement('itenContact_' + jidTo + '_' + indexTo ))) 856 function setAutorization() 857 { 858 var divItenContact = null; 859 860 if( arguments.length > 0 ) 861 { 862 var jidTo = arguments[0]; 863 864 if( getElement('itenContact_' + jidTo) ) 865 divItenContact = getElement('itenContact_' + jidTo ); 866 } 867 868 if( divItenContact ) 822 869 { 823 870 var subscription = divItenContact.getAttribute('subscription'); 824 871 825 872 switch(subscription) 826 873 { … … 845 892 if( ( _add = confirm("Deseja adicionar o usuario!")) ) 846 893 { 847 addUser.add( jidTo , indexTo);894 addUser.add( jidTo ); 848 895 } 849 896 … … 863 910 864 911 default : 912 alert( "SEM PARAMETRO DEFINIDO : " + subscription ); 865 913 866 alert( "DEFAULT : " + subscription );867 914 } 868 } 915 } 916 917 setTimeout(function() 918 { 919 if( getElement('itenContactNotification_' + jidTo ) ) 920 loadscript.removeElement( getElement('itenContactNotification_' + jidTo ) ); 921 },500); 922 869 923 } 870 924 … … 1170 1224 var _user = _users.createElement('user'); 1171 1225 var _jid = _users.createElement('jid'); 1172 var _ index = _users.createElement('index');1226 var _status = _users.createElement('status'); 1173 1227 _jid.appendChild( _users.createTextNode(TrophyIM.rosterObj.roster[user].contact.jid) ); 1174 _ index.appendChild( _users.createTextNode("0"));1228 _status.appendChild( _users.createTextNode( _subscription ) ); 1175 1229 _user.appendChild( _jid ); 1176 _user.appendChild( _ index);1230 _user.appendChild( _status ); 1177 1231 _users.documentElement.appendChild( _user ); 1178 1232 } … … 1206 1260 _winBuild( winNotification ); 1207 1261 } 1208 1209 function teste_new() 1210 { 1211 var _notification = getElement('notification_new_users_jabber') ; 1212 var _statusJabber = getElement('status_jabber_expresso'); 1213 1214 if( _notification && _statusJabber ) 1215 { 1216 if ( _notification.style.display == 'none' ) 1217 { 1218 _notification.style.display = 'block'; 1219 1220 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/alert_mini.png') no-repeat"; 1221 1222 if( _timeOutNotification ) 1223 clearTimeout(_timeOutNotification ); 1224 1225 _timeOutNotification = setTimeout( function(){ teste_new(); }, 2000 ); 1226 } 1227 else 1228 { 1229 _notification.style.display = 'none'; 1230 1231 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat"; 1232 1233 if( _timeOutNotification ) 1234 clearTimeout(_timeOutNotification ); 1235 1236 _timeOutNotification = setTimeout( function(){ teste_new(); }, 800 ); 1237 } 1238 } 1239 } 1240 1241 1242 loadIM.prototype.teste_new = teste_new; 1243 1244 1262 1245 1263 function loadIM() 1246 1264 { … … 1320 1338 loadIM.prototype.clrAllContacts = clrAllContacts; 1321 1339 loadIM.prototype.configEvents = configEvents; 1340 loadIM.prototype.disabledNotificationNewUsers = disabledNotificationNewUsers; 1341 loadIM.prototype.enabledNotificationNewUsers = enabledNotificationNewUsers; 1322 1342 loadIM.prototype.getIsIE = getIsIE; 1323 1343 loadIM.prototype.getPhotoUser = getPhotoUser; -
trunk/jmessenger/js/trophyim.js
r2971 r2975 308 308 TrophyIM.connection.rawInput = TrophyIM.rawInput; 309 309 TrophyIM.connection.rawOutput = TrophyIM.rawOutput; 310 Strophe.log = TrophyIM.log;310 //Strophe.log = TrophyIM.log; 311 311 Strophe.info('Attempting Strophe attach.'); 312 312 TrophyIM.connection.attach(xids[0], xids[1], xids[2], TrophyIM.onConnect); … … 397 397 TrophyIM.connection.rawInput = TrophyIM.rawInput; 398 398 TrophyIM.connection.rawOutput = TrophyIM.rawOutput; 399 Strophe.log = TrophyIM.log;399 //Strophe.log = TrophyIM.log; 400 400 401 401 if ( arguments.length > 0 ) … … 1042 1042 var divItenContact = null; 1043 1043 var spanShow = null; 1044 1044 1045 1045 if( ( divItenContact = document.getElementById('itenContact_' + jidTo ))) 1046 1046 { … … 1052 1052 1053 1053 divItenContact.parentNode.removeChild(divItenContact); 1054 1055 1056 1057 1058 1059 1060 1061 1054 1055 // Remove Contact 1056 var _id = TrophyIM.connection.getUniqueId(); 1057 var delContact = $iq({type: 'set', id: _id}) 1058 delContact = delContact.c('query').attrs({xmlns : 'jabber:iq:roster'}); 1059 delContact = delContact.c('item').attrs({jid: jidTo, subscription:'remove'}).tree(); 1060 1061 TrophyIM.connection.send( delContact ); 1062 1062 } 1063 1063 }, … … 1240 1240 status = " (( " + i18n.CONTACT_ASK_FOR_AUTH + " )) "; 1241 1241 statusColor = "orange"; 1242 1243 if ( TrophyIM.controll.notificationNewUsers == 0 )1244 {1245 loadscript.enabledNotificationNewUsers();1246 TrophyIM.controll.notificationNewUsers++;1247 }1248 1249 1242 break; 1250 1243 … … 1265 1258 status = " (( " + i18n.ASK_FOR_AUTH_QUESTION + " )) "; 1266 1259 statusColor = "orange"; 1267 1268 if ( TrophyIM.controll.notificationNewUsers == 0 )1269 {1270 loadscript.enabledNotificationNewUsers();1271 TrophyIM.controll.notificationNewUsers++;1272 }1273 1274 1260 break; 1275 1261 … … 1282 1268 }; 1283 1269 1284 var itensJid = document.getElementById( "itenContact_" + objContact.contact.jid ); 1285 1286 if( itensJid == null ) 1270 if( objContact.contact.subscription != "remove") 1287 1271 { 1288 // Name 1289 var nameContact = ""; 1272 var itensJid = document.getElementById( "itenContact_" + objContact.contact.jid ); 1290 1273 1291 if ( objContact.contact.name ) 1292 nameContact = objContact.contact.name; 1274 if( itensJid == null ) 1275 { 1276 // Name 1277 var nameContact = ""; 1278 1279 if ( objContact.contact.name ) 1280 nameContact = objContact.contact.name; 1281 else 1282 { 1283 nameContact = objContact.contact.jid; 1284 nameContact = nameContact.substring(0, nameContact.indexOf('@')); 1285 } 1286 1287 // Get Presence 1288 _presence(objContact); 1289 1290 var paramsContact = 1291 { 1292 divDisplay : "block", 1293 id : 'itenContact_' + objContact.contact.jid , 1294 jid : objContact.contact.jid, 1295 nameContact : nameContact, 1296 path_jabberit : path_jabberit, 1297 presence : presence, 1298 spanDisplay : statusDisplay, 1299 status : status, 1300 statusColor : "black", 1301 subscription : objContact.contact.subscription, 1302 resource : _resource 1303 } 1304 1305 // Get Authorization 1306 _subscription( objContact ); 1307 1308 if( group != "") 1309 { 1310 var _NodeChild = element.firstChild; 1311 1312 while( _NodeChild ) 1313 { 1314 if( _NodeChild.childNodes[0].nodeName.toLowerCase() === "span" ) 1315 { 1316 if( _NodeChild.childNodes[0].childNodes[0].nodeValue === group ) 1317 { 1318 _NodeChild.innerHTML += loadscript.parse("itens_group", "itensGroup.xsl", paramsContact); 1319 } 1320 } 1321 1322 _NodeChild = _NodeChild.nextSibling; 1323 } 1324 } 1325 } 1293 1326 else 1294 1327 { 1295 nameContact = objContact.contact.jid; 1296 nameContact = nameContact.substring(0, nameContact.indexOf('@')); 1297 } 1298 1299 // Get Presence 1300 _presence(objContact); 1301 1302 var paramsContact = 1303 { 1304 divDisplay : "block", 1305 id : 'itenContact_' + objContact.contact.jid , 1306 jid : objContact.contact.jid, 1307 nameContact : nameContact, 1308 path_jabberit : path_jabberit, 1309 presence : presence, 1310 spanDisplay : statusDisplay, 1311 status : status, 1312 statusColor : "black", 1313 subscription : objContact.contact.subscription, 1314 resource : _resource 1315 } 1316 1317 // Get Authorization 1318 _subscription( objContact ); 1319 1320 if( group != "") 1321 { 1322 var _NodeChild = element.firstChild; 1328 // Get Presence 1329 _presence(objContact); 1330 1331 var is_open = itensJid.parentNode.childNodes[0].style.backgroundImage; 1332 is_open = is_open.indexOf("arrow_down.gif"); 1333 1334 // Get Authorization 1335 _subscription( objContact ); 1323 1336 1324 while( _NodeChild ) 1337 // Set subscription 1338 itensJid.setAttribute('subscription', objContact.contact.subscription ); 1339 1340 with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid ) ) 1325 1341 { 1326 if( _NodeChild.childNodes[0].nodeName.toLowerCase() === "span")1342 if( presence == "unavailable" && !showOffline ) 1327 1343 { 1328 if( _NodeChild.childNodes[0].childNodes[0].nodeValue === group ) 1344 style.display = "none"; 1345 } 1346 else 1347 { 1348 if( is_open > 0 ) 1329 1349 { 1330 _NodeChild.innerHTML += loadscript.parse("itens_group", "itensGroup.xsl", paramsContact); 1350 style.display = statusDisplay; 1351 style.color = statusColor; 1352 innerHTML = status; 1331 1353 } 1332 1354 } 1333 1334 _NodeChild = _NodeChild.nextSibling;1335 1355 } 1336 } 1337 } 1338 else 1339 { 1340 // Get Presence 1341 _presence(objContact); 1342 1343 var is_open = itensJid.parentNode.childNodes[0].style.backgroundImage; 1344 is_open = is_open.indexOf("arrow_down.gif"); 1345 1346 // Get Authorization 1347 _subscription( objContact ); 1348 1349 // Set subscription 1350 itensJid.setAttribute('subscription', objContact.contact.subscription ); 1351 1352 with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid ) ) 1353 { 1356 1354 1357 if( presence == "unavailable" && !showOffline ) 1355 1358 { 1356 style.display = "none";1359 itensJid.style.display = "none"; 1357 1360 } 1358 1361 else … … 1360 1363 if( is_open > 0 ) 1361 1364 { 1362 style.display = statusDisplay; 1363 style.color = statusColor; 1364 innerHTML = status; 1365 itensJid.style.display = "block"; 1366 } 1367 } 1368 1369 itensJid.style.background = "url('"+path_jabberit+"templates/default/images/" + presence + ".gif') no-repeat center left"; 1370 1371 } 1372 1373 // Contact OffLine 1374 if( !objContact.presence && !showOffline ) 1375 { 1376 if( objContact.contact.subscription != "remove" ) 1377 { 1378 with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid )) 1379 { 1380 style.display = "none"; 1381 } 1382 1383 with ( document.getElementById('itenContact_' + objContact.contact.jid ) ) 1384 { 1385 style.display = "none"; 1365 1386 } 1366 1387 } 1367 1388 } 1368 1369 if( presence == "unavailable" && !showOffline )1370 {1371 itensJid.style.display = "none";1372 }1373 else1374 {1375 if( is_open > 0 )1376 {1377 itensJid.style.display = "block";1378 }1379 }1380 1381 itensJid.style.background = "url('"+path_jabberit+"templates/default/images/" + presence + ".gif') no-repeat center left";1382 1389 } 1383 1384 // Contact OffLine 1385 if( !objContact.presence && !showOffline ) 1390 } 1391 }; 1392 1393 var flag = false; 1394 1395 for( var i = 0 ; i < users.length; i++ ) 1396 { 1397 if( TrophyIM.rosterObj.roster[users[i]].contact.jid != Base64.decode( loadscript.getUserCurrent().jid) ) 1398 { 1399 var _subscription = TrophyIM.rosterObj.roster[users[i]].contact.subscription; 1400 1401 if( _subscription == "to" || _subscription == "not-in-roster") 1386 1402 { 1387 with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid )) 1388 { 1389 style.display = "none"; 1390 } 1391 1392 with ( document.getElementById('itenContact_' + objContact.contact.jid ) ) 1393 { 1394 style.display = "none"; 1395 } 1403 flag = true; 1396 1404 } 1397 } 1398 }; 1399 1400 for( var i = 0 ; i < users.length; i++ ) 1401 { 1402 if( TrophyIM.rosterObj.roster[users[i]].contact.jid != Base64.decode( loadscript.getUserCurrent().jid) ) 1403 { 1405 1404 1406 if( TrophyIM.rosterObj.roster[users[i]].contact.groups ) 1405 1407 { … … 1423 1425 } 1424 1426 } 1427 } 1428 1429 if( flag ) 1430 { 1431 if ( TrophyIM.controll.notificationNewUsers == 0 ) 1432 { 1433 loadscript.enabledNotificationNewUsers(); 1434 TrophyIM.controll.notificationNewUsers++; 1435 } 1436 } 1437 else 1438 { 1439 loadscript.disabledNotificationNewUsers(); 1440 TrophyIM.controll.notificationNewUsers = 0; 1425 1441 } 1426 1442 }, … … 1682 1698 this.addContact = function(jid, subscription, name, groups ) 1683 1699 { 1684 if( subscription !== "remove")1700 if( subscription === "remove" || subscription == "remove") 1685 1701 { 1686 var contact = { jid:jid, subscription:subscription, name:name, groups:groups } 1702 this.removeContact(jid); 1703 } 1704 else 1705 { 1706 var contact = { jid:jid, subscription:subscription, name:name, groups:groups } 1687 1707 var jid_lower = jid.toLowerCase(); 1688 1708 … … 1707 1727 this.groups[groups[g]][jid_lower] = jid_lower; 1708 1728 } 1709 }1710 else1711 {1712 this.removeContact(jid);1713 1729 } 1714 1730 }
Note: See TracChangeset
for help on using the changeset viewer.