- Timestamp:
- 09/30/10 17:21:21 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js
r3308 r3314 640 640 if( msg.getAttribute('from').toString().indexOf( TROPHYIM_CHATROOM ) < 0 ) 641 641 { 642 TrophyIM.rosterObj.setPresence( msg.getAttribute('from'), priority, show, status ); 642 var _from = Strophe.getBareJidFromJid( msg.getAttribute('from') ); 643 var _flag = true; 644 645 if( TrophyIM.removeResult.idResult.length > 0 ) 646 { 647 for( var i = 0 ; i < TrophyIM.removeResult.idResult.length; i++ ) 648 { 649 if( TrophyIM.removeResult.idResult[i] == _from ) 650 { 651 _flag = false; 652 653 TrophyIM.removeResult.idResult.splice(i,1); 654 655 i--; 656 657 if( show.toLowerCase() === 'subscribe' ) 658 _flag = true; 659 } 660 } 661 } 662 663 if( _flag ) 664 TrophyIM.rosterObj.setPresence( msg.getAttribute('from'), priority, show, status ); 643 665 } 644 666 … … 1151 1173 addContact : function( jidTo, name, group ) 1152 1174 { 1153 // Add Contact 1154 var _id = TrophyIM.connection.getUniqueId('add'); 1155 var newContact = $iq({type: 'set', id: _id }); 1156 newContact = newContact.c('query').attrs({xmlns : 'jabber:iq:roster'}); 1157 newContact = newContact.c('item').attrs({jid: jidTo, name:name }); 1158 newContact = newContact.c('group').t(group).tree(); 1159 1160 TrophyIM.connection.send(newContact); 1175 var _flag = true; 1176 1177 if( TrophyIM.removeResult.idResult.length > 0 ) 1178 { 1179 for( var i = 0 ; i < TrophyIM.removeResult.idResult.length; i++ ) 1180 { 1181 if( TrophyIM.removeResult.idResult[i] == jidTo ) 1182 { 1183 _flag = false; 1184 1185 TrophyIM.removeResult.idResult.splice(i,1); 1186 1187 i--; 1188 } 1189 } 1190 } 1191 1192 if( _flag ) 1193 { 1194 // Add Contact 1195 var _id = TrophyIM.connection.getUniqueId('add'); 1196 var newContact = $iq({type: 'set', id: _id }); 1197 newContact = newContact.c('query').attrs({xmlns : 'jabber:iq:roster'}); 1198 newContact = newContact.c('item').attrs({jid: jidTo, name:name }); 1199 newContact = newContact.c('group').t(group).tree(); 1200 1201 TrophyIM.connection.send(newContact); 1202 } 1161 1203 }, 1162 1204 … … 1336 1378 1337 1379 // Controller Result 1338 //TrophyIM.removeResult.idResult[ TrophyIM.removeResult.idResult.length ] = jidTo;1380 TrophyIM.removeResult.idResult[ TrophyIM.removeResult.idResult.length ] = jidTo; 1339 1381 1340 1382 var delContact = $iq({type: 'set', id: _id})
Note: See TracChangeset
for help on using the changeset viewer.