Ignore:
Timestamp:
04/13/10 17:48:28 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Implementado o status de mensagem e a busca da foto no ldap.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js

    r2491 r2511  
    656656                                'path_jabberit' : path_jabberit 
    657657        }; 
    658          
     658 
     659        titleWindow = barejid.toLowerCase(); 
     660                titleWindow = titleWindow.substring(0, titleWindow.indexOf('@')); 
     661 
    659662        if( TrophyIM.rosterObj.roster[barejid] ) 
    660663        { 
     
    664667            } 
    665668        } 
    666         else 
    667         { 
    668                 titleWindow = barejid.toLowerCase(); 
    669                 titleWindow = titleWindow.substring(0, titleWindow.indexOf('@')); 
    670         }        
    671669 
    672670        var winChatBox =  
     
    687685         
    688686        _winBuild(winChatBox); 
     687 
     688        // Photo User; 
     689                loadIM.getPhotoUser(barejid); 
    689690                 
    690691                loadIM.configEvents( document.getElementById( barejid + '__sendBox'), 
     
    9991000                for( var i = 0 ; i < users.length; i++ ) 
    10001001                { 
    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 ) 
    10061005                                { 
    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                                        } 
    10091017                                } 
    10101018                                else 
     
    10131021                                } 
    10141022                        } 
    1015                         else 
    1016                         { 
    1017                                 addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element, 0 ); 
    1018                         } 
    10191023                }        
    10201024        }, 
     
    10461050     */ 
    10471051 
    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                } 
    10511078        }, 
    10521079         
     
    11571184        this.addContact = function(jid, subscription, name, groups ) 
    11581185        { 
    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]] ) 
    11671205                                { 
    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; 
    11861210                } 
    1187                 else 
    1188                 { 
    1189                         this.removeContact(jid); 
    1190                 } 
     1211        } 
     1212        else 
     1213        { 
     1214                this.removeContact(jid); 
    11911215        } 
    11921216    } 
     
    13141338        var jid_lower = barejid.toLowerCase(); 
    13151339         
    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); 
    13471363    } 
    13481364 
Note: See TracChangeset for help on using the changeset viewer.