Show
Ignore:
Timestamp:
12/12/07 09:44:46 (12 months ago)
Author:
asterix
Message:

merge diff from trunk

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/pep/src/common/commands.py

    r8478 r9123  
    22## Copyright (C) 2006 Gajim Team 
    33## 
    4 ## This program is free software; you can redistribute it and/or modify 
     4## This file is part of Gajim. 
     5## 
     6## Gajim is free software; you can redistribute it and/or modify 
    57## it under the terms of the GNU General Public License as published 
    6 ## by the Free Software Foundation; version 2 only. 
    7 ## 
    8 ## This program is distributed in the hope that it will be useful, 
     8## by the Free Software Foundation; version 3 only. 
     9## 
     10## Gajim is distributed in the hope that it will be useful, 
    911## but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1012## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1113## GNU General Public License for more details. 
     14## 
     15## You should have received a copy of the GNU General Public License 
     16## along with Gajim.  If not, see <http://www.gnu.org/licenses/>. 
    1217## 
    1318 
     
    163168class LeaveGroupchatsCommand(AdHocCommand): 
    164169        commandnode = 'leave-groupchats' 
    165         commandname = 'Leave Groupchats' 
     170        commandname = _('Leave Groupchats') 
    166171 
    167172        @staticmethod 
     
    289294                jid = helpers.get_full_jid_from_iq(iq_obj) 
    290295                q = iq.getTag('query') 
     296                # buildReply don't copy the node attribute. Re-add it 
     297                q.setAttr('node', xmpp.NS_COMMANDS) 
    291298 
    292299                for node, cmd in self.__commands.iteritems(): 
     
    300307                self.connection.send(iq) 
    301308 
    302         def commandQuery(self, con, iq_obj): 
    303                 ''' Send disco result for query for command (JEP-0050, example 6.). 
     309        def commandInfoQuery(self, con, iq_obj): 
     310                ''' Send disco#info result for query for command (JEP-0050, example 6.). 
    304311                Return True if the result was sent, False if not. ''' 
    305312                jid = helpers.get_full_jid_from_iq(iq_obj) 
     
    319326                                q.addChild('feature', attrs = {'var': feature}) 
    320327 
     328                        self.connection.send(iq) 
     329                        return True 
     330 
     331                return False 
     332 
     333        def commandItemsQuery(self, con, iq_obj): 
     334                ''' Send disco#items result for query for command. 
     335                Return True if the result was sent, False if not. ''' 
     336                jid = helpers.get_full_jid_from_iq(iq_obj) 
     337                node = iq_obj.getTagAttr('query', 'node') 
     338 
     339                if node not in self.__commands: return False 
     340 
     341                cmd = self.__commands[node] 
     342                if cmd.isVisibleFor(self.isSameJID(jid)): 
     343                        iq = iq_obj.buildReply('result') 
    321344                        self.connection.send(iq) 
    322345                        return True