def nick(self, new_nick): try: new_nick = helpers.parse_resource(new_nick) except Exception: raise CommandError(_("Invalid nickname")) # FIXME: Check state of MUC self.connection.get_module('MUC').change_nick(self.room_jid, new_nick) self.new_nick = new_nick
def nick(self, new_nick): try: new_nick = helpers.parse_resource(new_nick) except Exception: raise CommandError(_("Invalid nickname")) self.connection.join_gc(new_nick, self.room_jid, None, change_nick=True) self.new_nick = new_nick
def on_okbutton_clicked(self, widget): nick = self.get_text() if nick: nick = nick # send presence to room try: nick = helpers.parse_resource(nick) except Exception: # invalid char ErrorDialog(_('Invalid nickname'), _('The nickname contains invalid characters.')) return self.on_ok(nick, self.is_checked())
def on_nick_entry_changed(self, widget): if self.ignore_events: return (model, iter_) = self.selection.get_selected() if iter_: nick = self.nick_entry.get_text() try: nick = helpers.parse_resource(nick) except helpers.InvalidFormat: ErrorDialog(_('Invalid nickname'), _('Character not allowed'), transient_for=self.window) self.nick_entry.set_text(model[iter_][6]) return True model[iter_][6] = nick
def _on_join_clicked(self, *args): account = self.account_combo.get_active_id() nickname = self.nick_entry.get_text() if app.is_invisible(account): app.interface.raise_dialog('join-while-invisible') return server = self.server_combo.get_active_text() room = self.room_entry.get_text() if room == '': ErrorDialog(_('Invalid Group Chat'), _('Please choose a group chat'), transient_for=self) return self.room_jid = '%s@%s' % (room, server) try: self.room_jid = helpers.parse_jid(self.room_jid) except helpers.InvalidFormat as error: ErrorDialog(_('Invalid XMPP Address'), str(error), transient_for=self) return if app.in_groupchat(account, self.room_jid): # If we already in the groupchat, join_gc_room will bring # it to front app.interface.join_gc_room(account, self.room_jid, nickname, '') self.destroy() return if nickname == '': ErrorDialog(_('Invalid Nickname'), _('Please choose a nickname'), transient_for=self) return try: helpers.parse_resource(nickname) except helpers.InvalidFormat as error: ErrorDialog(_('Invalid Nickname'), str(error), transient_for=self) return if not app.account_is_connected(account): ErrorDialog( _('You are not connected to the server'), _('You can not join a group chat unless you are connected.'), transient_for=self) return password = self.password_entry.get_text() self._add_bookmark(account, nickname, password) app.add_recent_groupchat(account, self.room_jid, nickname) if self.automatic: app.automatic_rooms[self.account][self.room_jid] = self.automatic app.interface.join_gc_room(account, self.room_jid, nickname, password) self.destroy()