I've created: class FwdMsgThenDisconnectCommand(AdHocCommand): commandnode = 'fwd-msd-disconnect' commandname = _('Forward unread message then disconnect')
@staticmethod def isVisibleFor(samejid): """ Change status is visible only if the entity has the same bare jid """ return samejid def execute(self, request): account = self.connection.name # Forward messages events = gajim.events.get_events(account, types=['chat', 'normal']) j, resource = gajim.get_room_and_nick_from_fjid(self.jid) for jid in events: for event in events[jid]: self.connection.send_message(j, event.parameters[0], '', type_=event.type_, subject=event.parameters[1], resource=resource, forward_from=jid, delayed=event.time_) response, cmd = self.buildResponse(request, status = 'completed') cmd.addChild('note', {}, _('The status has been changed.')) # if going offline, we need to push response so it won't go into # queue and disappear self.connection.connection.send(response, now = True) # send new status gajim.interface.roster.send_status(self.connection.name, 'offline', '') return False # finish the session But when I test it, I only have the disconnect action, the events are not forwarded first, what did I missed? -- Geobert QUACH http://pti-zarticles.dnsalias.org On Thu, Apr 15, 2010 at 10:54 PM, Yann Leboulanger <aste...@lagaule.org>wrote: > On 04/15/2010 08:29 PM, Geobert Quach wrote: > >> Hi all, >> >> I was wondering of it is possible to have a command that forward all >> unread messages then disconnect the account. I know there two separate >> commands to do so but when I need it, I disconnect 3 accounts so I need >> to click a bunch of time before finishing it. >> > > Yes it is, and I don't think it's too difficult. > > > I'd have a look at adhoc_commands but I did not understand how I can >> merge two commands as there is no static list >> > > This file is the client part, how to browse and use adhoc commands. The > file yo're interested in is the one that exposes commands: > src/common/commands.py > > -- > Yann > _______________________________________________ > Gajim-devel mailing list > Gajim-devel@gajim.org > http://lists.gajim.org/cgi-bin/listinfo/gajim-devel >
_______________________________________________ Gajim-devel mailing list Gajim-devel@gajim.org http://lists.gajim.org/cgi-bin/listinfo/gajim-devel