summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/gpg/__init__.py2
-rw-r--r--plugins/ping.py4
-rw-r--r--plugins/time_marker.py4
-rw-r--r--src/core/commands.py48
-rw-r--r--src/core/completions.py18
-rw-r--r--src/core/core.py18
-rw-r--r--src/core/handlers.py6
-rw-r--r--src/tabs/basetabs.py12
-rw-r--r--src/tabs/conversationtab.py29
-rw-r--r--src/tabs/muclisttab.py3
-rw-r--r--src/tabs/muctab.py45
-rw-r--r--src/tabs/privatetab.py17
-rw-r--r--src/tabs/rostertab.py3
-rw-r--r--src/tabs/xmltab.py1
-rw-r--r--src/windows.py4
15 files changed, 101 insertions, 113 deletions
diff --git a/plugins/gpg/__init__.py b/plugins/gpg/__init__.py
index 156f38b2..67720a5e 100644
--- a/plugins/gpg/__init__.py
+++ b/plugins/gpg/__init__.py
@@ -291,7 +291,7 @@ class Plugin(BasePlugin):
jid = JID(args[1])
else:
if isinstance(self.core.current_tab(), ConversationTab):
- jid = JID(self.core.current_tab().get_name())
+ jid = JID(self.core.current_tab().name)
else:
return
command = args[0]
diff --git a/plugins/ping.py b/plugins/ping.py
index 152445c8..4ec706b3 100644
--- a/plugins/ping.py
+++ b/plugins/ping.py
@@ -73,14 +73,14 @@ class Plugin(BasePlugin):
def command_private_ping(self, arg):
if arg:
return self.command_ping(arg)
- self.command_ping(self.api.current_tab().get_name())
+ self.command_ping(self.api.current_tab().name)
def command_muc_ping(self, arg):
if not arg.strip():
return
user = self.api.current_tab().get_user_by_name(arg)
if user:
- jid = safeJID(self.api.current_tab().get_name())
+ jid = safeJID(self.api.current_tab().name)
jid.resource = user.nick
else:
jid = safeJID(arg)
diff --git a/plugins/time_marker.py b/plugins/time_marker.py
index 8fc1c08b..9ef27ee6 100644
--- a/plugins/time_marker.py
+++ b/plugins/time_marker.py
@@ -65,8 +65,8 @@ class Plugin(BasePlugin):
res += "%s seconds, " % seconds
return res[:-2]
- last_message_date = self.last_messages.get(tab.get_name())
- self.last_messages[tab.get_name()] = datetime.now()
+ last_message_date = self.last_messages.get(tab.name)
+ self.last_messages[tab.name] = datetime.now()
if last_message_date:
delta = datetime.now() - last_message_date
if delta >= timedelta(0, self.config.get('delay', 900)):
diff --git a/src/core/commands.py b/src/core/commands.py
index 1c728283..d4df1099 100644
--- a/src/core/commands.py
+++ b/src/core/commands.py
@@ -147,7 +147,7 @@ def command_presence(self, arg):
else:
return
if jid == '.' and isinstance(self.current_tab(), tabs.ChatTab):
- jid = self.current_tab().get_name()
+ jid = self.current_tab().name
if type == 'available':
type = None
try:
@@ -238,7 +238,7 @@ def command_move_tab(self, arg):
except ValueError:
old_tab = None
for tab in self.tabs:
- if not old_tab and value == tab.get_name():
+ if not old_tab and value == tab.name:
old_tab = tab
if not old_tab:
self.information("Tab %s does not exist" % args[0], "Error")
@@ -269,7 +269,7 @@ def command_list(self, arg):
else:
if not isinstance(self.current_tab(), tabs.MucTab):
return self.information('Please provide a server', 'Error')
- server = safeJID(self.current_tab().get_name()).server
+ server = safeJID(self.current_tab().name).server
list_tab = tabs.MucListTab(server)
self.add_tab(list_tab, True)
cb = list_tab.on_muc_list_item_received
@@ -316,7 +316,7 @@ def command_join(self, arg, histo_length=None):
tab = self.current_tab()
if not isinstance(tab, (tabs.MucTab, tabs.PrivateTab)):
return
- room = safeJID(tab.get_name()).bare
+ room = safeJID(tab.name).bare
nick = tab.own_nick
else:
if args[0].startswith('@'): # we try to join a server directly
@@ -335,7 +335,7 @@ def command_join(self, arg, histo_length=None):
tab = self.current_tab()
if not isinstance(tab, tabs.MucTab):
return
- room = tab.get_name()
+ room = tab.name
if nick == '':
nick = tab.own_nick
else:
@@ -345,8 +345,8 @@ def command_join(self, arg, histo_length=None):
# check if the current room's name has a server
if room.find('@') == -1 and not server_root:
if isinstance(self.current_tab(), tabs.MucTab) and\
- self.current_tab().get_name().find('@') != -1:
- domain = safeJID(self.current_tab().get_name()).domain
+ self.current_tab().name.find('@') != -1:
+ domain = safeJID(self.current_tab().name).domain
room += '@%s' % domain
else:
room = args[0]
@@ -421,15 +421,15 @@ def command_bookmark_local(self, arg=''):
return
if not args:
tab = self.current_tab()
- roomname = tab.get_name()
+ roomname = tab.name
if tab.joined and tab.own_nick != self.own_nick:
nick = tab.own_nick
elif args[0] == '*':
new_bookmarks = []
for tab in self.get_tabs(tabs.MucTab):
- b = bookmark.get_by_jid(tab.get_name())
+ b = bookmark.get_by_jid(tab.name)
if not b:
- b = bookmark.Bookmark(tab.get_name(),
+ b = bookmark.Bookmark(tab.name,
autojoin=True,
method="local")
new_bookmarks.append(b)
@@ -451,7 +451,7 @@ def command_bookmark_local(self, arg=''):
if not roomname:
if not isinstance(self.current_tab(), tabs.MucTab):
return
- roomname = self.current_tab().get_name()
+ roomname = self.current_tab().name
if len(args) > 1:
password = args[1]
@@ -485,7 +485,7 @@ def command_bookmark(self, arg=''):
return
if not args:
tab = self.current_tab()
- roomname = tab.get_name()
+ roomname = tab.name
if tab.joined:
nick = tab.own_nick
autojoin = True
@@ -497,9 +497,9 @@ def command_bookmark(self, arg=''):
autojoin = True
new_bookmarks = []
for tab in self.get_tabs(tabs.MucTab):
- b = bookmark.get_by_jid(tab.get_name())
+ b = bookmark.get_by_jid(tab.name)
if not b:
- b = bookmark.Bookmark(tab.get_name(), autojoin=autojoin,
+ b = bookmark.Bookmark(tab.name, autojoin=autojoin,
method=bookmark.preferred)
new_bookmarks.append(b)
else:
@@ -523,7 +523,7 @@ def command_bookmark(self, arg=''):
if roomname == '':
if not isinstance(self.current_tab(), tabs.MucTab):
return
- roomname = self.current_tab().get_name()
+ roomname = self.current_tab().name
if len(args) > 1:
autojoin = False if args[1].lower() != 'true' else True
else:
@@ -571,8 +571,8 @@ def command_remove_bookmark(self, arg=''):
args = common.shell_split(arg)
if not args:
tab = self.current_tab()
- if isinstance(tab, tabs.MucTab) and bookmark.get_by_jid(tab.get_name()):
- bookmark.remove(tab.get_name())
+ if isinstance(tab, tabs.MucTab) and bookmark.get_by_jid(tab.name):
+ bookmark.remove(tab.name)
bookmark.save(self.xmpp)
if bookmark.save(self.xmpp):
self.information('Bookmark deleted', 'Info')
@@ -643,22 +643,22 @@ def command_server_cycle(self, arg=''):
message = args[1]
else:
if isinstance(tab, tabs.MucTab):
- domain = safeJID(tab.get_name()).domain
+ domain = safeJID(tab.name).domain
else:
self.information(_("No server specified"), "Error")
return
for tab in self.get_tabs(tabs.MucTab):
- if tab.get_name().endswith(domain):
+ if tab.name.endswith(domain):
if tab.joined:
muc.leave_groupchat(tab.core.xmpp,
- tab.get_name(),
+ tab.name,
tab.own_nick,
message)
tab.joined = False
- if tab.get_name() == domain:
- self.command_join('"@%s/%s"' %(tab.get_name(), tab.own_nick))
+ if tab.name == domain:
+ self.command_join('"@%s/%s"' %(tab.name, tab.own_nick))
else:
- self.command_join('"%s/%s"' %(tab.get_name(), tab.own_nick))
+ self.command_join('"%s/%s"' %(tab.name, tab.own_nick))
def command_last_activity(self, arg):
"""
@@ -928,7 +928,7 @@ def command_message(self, arg):
if not tab:
tab = self.open_conversation_window(jid.full, focus=True)
else:
- self.focus_tab_named(tab.get_name())
+ self.focus_tab_named(tab.name)
if len(args) > 1:
tab.command_say(args[1])
diff --git a/src/core/completions.py b/src/core/completions.py
index 5387eefd..f8fb7fc8 100644
--- a/src/core/completions.py
+++ b/src/core/completions.py
@@ -98,7 +98,7 @@ def completion_join(self, the_input):
relevant_rooms.extend(sorted(self.pending_invites.keys()))
bookmarks = {str(elem.jid): False for elem in bookmark.bookmarks}
for tab in self.get_tabs(tabs.MucTab):
- name = tab.get_name()
+ name = tab.name
if name in bookmarks and not tab.joined:
bookmarks[name] = True
relevant_rooms.extend(sorted(room[0] for room in bookmarks.items() if room[1]))
@@ -126,7 +126,7 @@ def completion_join(self, the_input):
serv_list = []
for tab in self.get_tabs(tabs.MucTab):
if tab.joined:
- serv_list.append('%s@%s'% (jid.user, safeJID(tab.get_name()).host))
+ serv_list.append('%s@%s'% (jid.user, safeJID(tab.name).host))
serv_list.extend(relevant_rooms)
return the_input.new_completion(serv_list, 1, quotify=True)
elif args[1].startswith('/'):
@@ -147,8 +147,8 @@ def completion_list(self, the_input):
"""Completion for /list"""
muc_serv_list = []
for tab in self.get_tabs(tabs.MucTab): # TODO, also from an history
- if tab.get_name() not in muc_serv_list:
- muc_serv_list.append(safeJID(tab.get_name()).server)
+ if tab.name not in muc_serv_list:
+ muc_serv_list.append(safeJID(tab.name).server)
if muc_serv_list:
return the_input.new_completion(muc_serv_list, 1, quotify=False)
@@ -157,7 +157,7 @@ def completion_move_tab(self, the_input):
"""Completion for /move_tab"""
n = the_input.get_argument_position(quoted=True)
if n == 1:
- nodes = [tab.get_name() for tab in self.tabs if tab]
+ nodes = [tab.name for tab in self.tabs if tab]
nodes.remove('Roster')
return the_input.new_completion(nodes, 1, ' ', quotify=True)
@@ -199,7 +199,7 @@ def completion_bookmark(self, the_input):
nicks.append(nick)
jids_list = ['%s/%s' % (jid.bare, nick) for nick in nicks]
return the_input.new_completion(jids_list, 1, quotify=True)
- muc_list = [tab.get_name() for tab in self.get_tabs(tabs.MucTab)]
+ muc_list = [tab.name for tab in self.get_tabs(tabs.MucTab)]
muc_list.sort()
muc_list.append('*')
return the_input.new_completion(muc_list, 1, quotify=True)
@@ -259,7 +259,7 @@ def completion_invite(self, the_input):
rooms = []
for tab in self.get_tabs(tabs.MucTab):
if tab.joined:
- rooms.append(tab.get_name())
+ rooms.append(tab.name)
rooms.sort()
return the_input.new_completion(rooms, n, '', quotify=True)
@@ -300,7 +300,7 @@ def completion_server_cycle(self, the_input):
"""Completion for /server_cycle"""
serv_list = set()
for tab in self.get_tabs(tabs.MucTab):
- serv = safeJID(tab.get_name()).server
+ serv = safeJID(tab.name).server
serv_list.add(serv)
return the_input.new_completion(sorted(serv_list), 1, ' ')
@@ -380,7 +380,7 @@ def completion_bookmark_local(self, the_input):
nicks.append(nick)
jids_list = ['%s/%s' % (jid.bare, nick) for nick in nicks]
return the_input.new_completion(jids_list, 1, quotify=True)
- muc_list = [tab.get_name() for tab in self.get_tabs(tabs.MucTab)]
+ muc_list = [tab.name for tab in self.get_tabs(tabs.MucTab)]
muc_list.append('*')
return the_input.new_completion(muc_list, 1, quotify=True)
diff --git a/src/core/core.py b/src/core/core.py
index 4ffb0213..805cd838 100644
--- a/src/core/core.py
+++ b/src/core/core.py
@@ -902,7 +902,7 @@ class Core(object):
If typ is provided, return a tab of this type only
"""
for tab in self.tabs:
- if tab.get_name() == name:
+ if tab.name == name:
if (typ and isinstance(tab, typ)) or\
not typ:
return tab
@@ -1081,7 +1081,7 @@ class Core(object):
def focus_tab_named(self, tab_name, type_=None):
"""Returns True if it found a tab to focus on"""
for tab in self.tabs:
- if tab.get_name() == tab_name:
+ if tab.name == tab_name:
if (type_ and (isinstance(tab, type_))) or not type_:
self.command_win('%s' % (tab.nb,))
return True
@@ -1133,7 +1133,7 @@ class Core(object):
complete_jid = room_name+'/'+user_nick
# if the room exists, focus it and return
for tab in self.get_tabs(tabs.PrivateTab):
- if tab.get_name() == complete_jid:
+ if tab.name == complete_jid:
self.command_win('%s' % tab.nb)
return tab
# create the new tab
@@ -1206,7 +1206,7 @@ class Core(object):
if reason is None:
reason = _('\x195}You left the chatroom\x193}')
for tab in self.get_tabs(tabs.PrivateTab):
- if tab.get_name().startswith(room_name):
+ if tab.name.startswith(room_name):
tab.deactivate(reason=reason)
def enable_private_tabs(self, room_name, reason=None):
@@ -1216,7 +1216,7 @@ class Core(object):
if reason is None:
reason = _('\x195}You joined the chatroom\x193}')
for tab in self.get_tabs(tabs.PrivateTab):
- if tab.get_name().startswith(room_name):
+ if tab.name.startswith(room_name):
tab.activate(reason=reason)
def on_user_changed_status_in_private(self, jid, msg):
@@ -1246,10 +1246,10 @@ class Core(object):
self.tabs[nb] = tabs.GapTab()
else:
self.tabs.remove(tab)
- if tab and tab.get_name() in logger.fds:
- logger.fds[tab.get_name()].close()
- log.debug("Log file for %s closed.", tab.get_name())
- del logger.fds[tab.get_name()]
+ if tab and tab.name in logger.fds:
+ logger.fds[tab.name].close()
+ log.debug("Log file for %s closed.", tab.name)
+ del logger.fds[tab.name]
if self.current_tab_nb >= len(self.tabs):
self.current_tab_nb = len(self.tabs) - 1
while not self.tabs[self.current_tab_nb]:
diff --git a/src/core/handlers.py b/src/core/handlers.py
index ad696eb1..45a4ff2a 100644
--- a/src/core/handlers.py
+++ b/src/core/handlers.py
@@ -161,7 +161,7 @@ def on_message(self, message):
# Differentiate both type of messages, and call the appropriate handler.
jid_from = message['from']
for tab in self.get_tabs(tabs.MucTab):
- if tab.get_name() == jid_from.bare:
+ if tab.name == jid_from.bare:
if message['type'] == 'error':
return self.room_error(message, jid_from)
else:
@@ -1003,12 +1003,12 @@ def on_attention(self, message):
jid_from = message['from']
self.information('%s requests your attention!' % jid_from, 'Info')
for tab in self.tabs:
- if tab.get_name() == jid_from:
+ if tab.name == jid_from:
tab.state = 'attention'
self.refresh_tab_win()
return
for tab in self.tabs:
- if tab.get_name() == jid_from.bare:
+ if tab.name == jid_from.bare:
tab.state = 'attention'
self.refresh_tab_win()
return
diff --git a/src/tabs/basetabs.py b/src/tabs/basetabs.py
index f16e3f93..9759431d 100644
--- a/src/tabs/basetabs.py
+++ b/src/tabs/basetabs.py
@@ -90,6 +90,7 @@ class Tab(object):
plugin_commands = {}
plugin_keys = {}
def __init__(self):
+ self.name = self.__class__.__name__
self.input = None
self._state = 'normal'
self._prev_state = None
@@ -299,13 +300,13 @@ class Tab(object):
"""
get the name of the tab
"""
- return self.__class__.__name__
+ return self.name
def get_nick(self):
"""
Get the nick of the tab (defaults to its name)
"""
- return self.get_name()
+ return self.name
def get_text_window(self):
"""
@@ -410,7 +411,8 @@ class GapTab(Tab):
def __len__(self):
return 0
- def get_name(self):
+ @property
+ def name(self):
return ''
def refresh(self):
@@ -476,7 +478,7 @@ class ChatTab(Tab):
return False
def load_logs(self, log_nb):
- logs = logger.get_logs(safeJID(self.get_name()).bare, log_nb)
+ logs = logger.get_logs(safeJID(self.name).bare, log_nb)
return logs
def log_message(self, txt, nickname, time=None, typ=1):
@@ -569,7 +571,7 @@ class ChatTab(Tab):
return msg
def get_dest_jid(self):
- return self.get_name()
+ return self.name
@refresh_wrapper.always
def command_clear(self, args):
diff --git a/src/tabs/conversationtab.py b/src/tabs/conversationtab.py
index 756634ce..7480906b 100644
--- a/src/tabs/conversationtab.py
+++ b/src/tabs/conversationtab.py
@@ -73,7 +73,7 @@ class ConversationTab(ChatTab):
@property
def general_jid(self):
- return safeJID(self.get_name()).bare
+ return safeJID(self.name).bare
@staticmethod
def add_information_element(plugin_name, callback):
@@ -109,7 +109,7 @@ class ConversationTab(ChatTab):
replaced = False
if correct or msg['replace']['id']:
msg['replace']['id'] = self.last_sent_message['id']
- if config.get_by_tabname('group_corrections', True, self.get_name()):
+ if config.get_by_tabname('group_corrections', True, self.name):
try:
self.modify_message(msg['body'], self.last_sent_message['id'], msg['id'], jid=self.core.xmpp.boundjid,
nickname=self.core.own_nick)
@@ -306,9 +306,6 @@ class ConversationTab(ChatTab):
self.text_win, self.chatstate, ConversationTab.additional_informations)
self.input.refresh()
- def get_name(self):
- return self.name
-
def get_nick(self):
jid = safeJID(self.name)
contact = roster[jid.bare]
@@ -382,10 +379,10 @@ class ConversationTab(ChatTab):
def matching_names(self):
res = []
- jid = safeJID(self.get_name())
+ jid = safeJID(self.name)
res.append((2, jid.bare))
res.append((1, jid.user))
- contact = roster[self.get_name()]
+ contact = roster[self.name]
if contact and contact.name:
res.append((0, contact.name))
return res
@@ -450,8 +447,8 @@ class DynamicConversationTab(ConversationTab):
the conversation is not locked.
"""
if self.locked_resource:
- return "%s/%s" % (self.get_name(), self.locked_resource)
- return self.get_name()
+ return "%s/%s" % (self.name, self.locked_resource)
+ return self.name
def refresh(self):
"""
@@ -464,12 +461,12 @@ class DynamicConversationTab(ConversationTab):
self.text_win.refresh()
if display_bar:
- self.upper_bar.refresh(self.get_name(), roster[self.get_name()])
+ self.upper_bar.refresh(self.name, roster[self.name])
if self.locked_resource:
- displayed_jid = "%s/%s" % (self.get_name(), self.locked_resource)
+ displayed_jid = "%s/%s" % (self.name, self.locked_resource)
else:
- displayed_jid = self.get_name()
- self.info_header.refresh(displayed_jid, roster[self.get_name()],
+ displayed_jid = self.name
+ self.info_header.refresh(displayed_jid, roster[self.name],
self.text_win, self.chatstate,
ConversationTab.additional_informations)
if display_info_win:
@@ -483,10 +480,10 @@ class DynamicConversationTab(ConversationTab):
Different from the parent class only for the info_header object.
"""
if self.locked_resource:
- displayed_jid = "%s/%s" % (self.get_name(), self.locked_resource)
+ displayed_jid = "%s/%s" % (self.name, self.locked_resource)
else:
- displayed_jid = self.get_name()
- self.info_header.refresh(displayed_jid, roster[self.get_name()],
+ displayed_jid = self.name
+ self.info_header.refresh(displayed_jid, roster[self.name],
self.text_win, self.chatstate, ConversationTab.additional_informations)
self.input.refresh()
diff --git a/src/tabs/muclisttab.py b/src/tabs/muclisttab.py
index b8c49e8c..c04c3ed5 100644
--- a/src/tabs/muclisttab.py
+++ b/src/tabs/muclisttab.py
@@ -184,9 +184,6 @@ class MucListTab(Tab):
self.execute_command(txt)
return self.reset_help_message()
- def get_name(self):
- return self.name
-
def completion(self):
if isinstance(self.input, windows.Input):
self.complete_commands(self.input)
diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py
index 2ea7fe1f..201010f5 100644
--- a/src/tabs/muctab.py
+++ b/src/tabs/muctab.py
@@ -196,7 +196,7 @@ class MucTab(ChatTab):
@property
def general_jid(self):
- return self.get_name()
+ return self.name
@property
def is_muc(self):
@@ -251,7 +251,7 @@ class MucTab(ChatTab):
"""Completion for /nick"""
nicks = [os.environ.get('USER'),
config.get('default_nick', ''),
- self.core.get_bookmark_nickname(self.get_name())]
+ self.core.get_bookmark_nickname(self.name)]
nicks = [i for i in nicks if i]
return the_input.auto_completion(nicks, '', quotify=False)
@@ -360,7 +360,7 @@ class MucTab(ChatTab):
"""
/configure
"""
- form = fixes.get_room_form(self.core.xmpp, self.get_name())
+ form = fixes.get_room_form(self.core.xmpp, self.name)
if not form:
self.core.information(
_('Could not retrieve the configuration form'),
@@ -372,14 +372,14 @@ class MucTab(ChatTab):
"""
The user do not want to send his/her config, send an iq cancel
"""
- self.core.xmpp.plugin['xep_0045'].cancelConfig(self.get_name())
+ self.core.xmpp.plugin['xep_0045'].cancelConfig(self.name)
self.core.close_tab()
def send_config(self, form):
"""
The user sends his/her config to the server
"""
- self.core.xmpp.plugin['xep_0045'].configureRoom(self.get_name(), form)
+ self.core.xmpp.plugin['xep_0045'].configureRoom(self.name, form)
self.core.close_tab()
def command_cycle(self, arg):
@@ -450,7 +450,7 @@ class MucTab(ChatTab):
return self.core.information(_('/nick only works in joined rooms'),
_('Info'))
current_status = self.core.get_status()
- if not safeJID(self.get_name() + '/' + nick):
+ if not safeJID(self.name + '/' + nick):
return self.core.information('Invalid nick', 'Info')
muc.change_nick(self.core, self.name, nick,
current_status.message,
@@ -632,7 +632,7 @@ class MucTab(ChatTab):
"""
def callback(iq):
if iq['type'] == 'error':
- self.core.room_error(iq, self.get_name())
+ self.core.room_error(iq, self.name)
args = common.shell_split(arg)
if not args:
return self.core.command_help('ban')
@@ -643,11 +643,11 @@ class MucTab(ChatTab):
nick = args[0]
if nick in [user.nick for user in self.users]:
- res = muc.set_user_affiliation(self.core.xmpp, self.get_name(),
+ res = muc.set_user_affiliation(self.core.xmpp, self.name,
'outcast', nick=nick,
callback=callback, reason=msg)
else:
- res = muc.set_user_affiliation(self.core.xmpp, self.get_name(),
+ res = muc.set_user_affiliation(self.core.xmpp, self.name,
'outcast', jid=safeJID(nick),
callback=callback, reason=msg)
if not res:
@@ -661,7 +661,7 @@ class MucTab(ChatTab):
"""
def callback(iq):
if iq['type'] == 'error':
- self.core.room_error(iq, self.get_name())
+ self.core.room_error(iq, self.name)
args = common.shell_split(arg)
if len(args) < 2:
self.core.command_help('role')
@@ -674,9 +674,9 @@ class MucTab(ChatTab):
if not self.joined or \
not role in ('none', 'visitor', 'participant', 'moderator'):
return
- if not safeJID(self.get_name() + '/' + nick):
+ if not safeJID(self.name + '/' + nick):
return self.core('Invalid nick', 'Info')
- muc.set_user_role(self.core.xmpp, self.get_name(), nick, reason, role,
+ muc.set_user_role(self.core.xmpp, self.name, nick, reason, role,
callback=callback)
def command_affiliation(self, arg):
@@ -687,7 +687,7 @@ class MucTab(ChatTab):
"""
def callback(iq):
if iq['type'] == 'error':
- self.core.room_error(iq, self.get_name())
+ self.core.room_error(iq, self.name)
args = common.shell_split(arg)
if len(args) < 2:
self.core.command_help('affiliation')
@@ -699,11 +699,11 @@ class MucTab(ChatTab):
self.core.command_help('affiliation')
return
if nick in [user.nick for user in self.users]:
- res = muc.set_user_affiliation(self.core.xmpp, self.get_name(),
+ res = muc.set_user_affiliation(self.core.xmpp, self.name,
affiliation, nick=nick,
callback=callback)
else:
- res = muc.set_user_affiliation(self.core.xmpp, self.get_name(),
+ res = muc.set_user_affiliation(self.core.xmpp, self.name,
affiliation, jid=safeJID(nick),
callback=callback)
if not res:
@@ -715,7 +715,7 @@ class MucTab(ChatTab):
Or normal input + enter
"""
needed = 'inactive' if self.inactive else 'active'
- msg = self.core.xmpp.make_message(self.get_name())
+ msg = self.core.xmpp.make_message(self.name)
msg['type'] = 'groupchat'
msg['body'] = line
# trigger the event BEFORE looking for colors.
@@ -900,9 +900,6 @@ class MucTab(ChatTab):
self.input.get_text().startswith('//'))
self.send_composing_chat_state(empty_after)
- def get_name(self):
- return self.name
-
def get_nick(self):
if not config.get('show_muc_jid', True):
return safeJID(self.name).user
@@ -989,8 +986,8 @@ class MucTab(ChatTab):
# not send a 110 status code with the presence
self.own_nick = from_nick
self.joined = True
- if self.get_name() in self.core.initial_joins:
- self.core.initial_joins.remove(self.get_name())
+ if self.name in self.core.initial_joins:
+ self.core.initial_joins.remove(self.name)
self._state = 'normal'
elif self != self.core.current_tab():
self._state = 'joined'
@@ -1045,7 +1042,7 @@ class MucTab(ChatTab):
self.refresh_tab_win()
self.core.current_tab().input.refresh()
self.core.doupdate()
- self.core.enable_private_tabs(self.get_name())
+ self.core.enable_private_tabs(self.name)
else:
change_nick = '303' in status_codes
kick = '307' in status_codes and typ == 'unavailable'
@@ -1521,7 +1518,7 @@ class MucTab(ChatTab):
and self.state != 'current'):
if (self.state != 'highlight' and
config.get_by_tabname('notify_messages',
- True, self.get_name())):
+ True, self.name)):
self.state = 'message'
if time:
txt = '\x19%(info_col)s}%(txt)s' % {
@@ -1552,6 +1549,6 @@ class MucTab(ChatTab):
return False
def matching_names(self):
- return [(1, safeJID(self.get_name()).user), (3, self.get_name())]
+ return [(1, safeJID(self.name).user), (3, self.name)]
diff --git a/src/tabs/privatetab.py b/src/tabs/privatetab.py
index a88e9060..b8699bd2 100644
--- a/src/tabs/privatetab.py
+++ b/src/tabs/privatetab.py
@@ -66,7 +66,7 @@ class PrivateTab(ChatTab):
@property
def general_jid(self):
- return self.get_name()
+ return self.name
@property
def nick(self):
@@ -84,7 +84,7 @@ class PrivateTab(ChatTab):
del PrivateTab.additional_informations[plugin_name]
def load_logs(self, log_nb):
- logs = logger.get_logs(safeJID(self.get_name()).full.replace('/', '\\'), log_nb)
+ logs = logger.get_logs(safeJID(self.name).full.replace('/', '\\'), log_nb)
def log_message(self, txt, nickname, time=None, typ=1):
"""
@@ -121,7 +121,7 @@ class PrivateTab(ChatTab):
def command_say(self, line, attention=False, correct=False):
if not self.on:
return
- msg = self.core.xmpp.make_message(self.get_name())
+ msg = self.core.xmpp.make_message(self.name)
msg['type'] = 'chat'
msg['body'] = line
# trigger the event BEFORE looking for colors.
@@ -137,7 +137,7 @@ class PrivateTab(ChatTab):
replaced = False
if correct or msg['replace']['id']:
msg['replace']['id'] = self.last_sent_message['id']
- if config.get_by_tabname('group_corrections', True, self.get_name()):
+ if config.get_by_tabname('group_corrections', True, self.name):
try:
self.modify_message(msg['body'], self.last_sent_message['id'], msg['id'],
user=user, jid=self.core.xmpp.boundjid, nickname=self.own_nick)
@@ -181,13 +181,13 @@ class PrivateTab(ChatTab):
if message is not '':
self.command_say(message, attention=True)
else:
- msg = self.core.xmpp.make_message(self.get_name())
+ msg = self.core.xmpp.make_message(self.name)
msg['type'] = 'chat'
msg['attention'] = True
msg.send()
def check_attention(self):
- self.core.xmpp.plugin['xep_0030'].get_info(jid=self.get_name(), block=False, timeout=5, callback=self.on_attention_checked)
+ self.core.xmpp.plugin['xep_0030'].get_info(jid=self.name, block=False, timeout=5, callback=self.on_attention_checked)
def on_attention_checked(self, iq):
if 'urn:xmpp:attention:0' in iq['disco_info'].get_features():
@@ -274,9 +274,6 @@ class PrivateTab(ChatTab):
self.info_header.refresh(self.name, self.text_win, self.chatstate, PrivateTab.additional_informations)
self.input.refresh()
- def get_name(self):
- return self.name
-
def get_nick(self):
return safeJID(self.name).resource
@@ -376,6 +373,6 @@ class PrivateTab(ChatTab):
self.add_message(txt=reason, typ=2)
def matching_names(self):
- return [(3, safeJID(self.get_name()).resource), (4, self.get_name())]
+ return [(3, safeJID(self.name).resource), (4, self.name)]
diff --git a/src/tabs/rostertab.py b/src/tabs/rostertab.py
index adc83445..81b5fcb5 100644
--- a/src/tabs/rostertab.py
+++ b/src/tabs/rostertab.py
@@ -738,9 +738,6 @@ class RosterInfoTab(Tab):
self.refresh_tab_win()
self.input.refresh()
- def get_name(self):
- return self.name
-
def on_input(self, key, raw):
if key == '^M':
selected_row = self.roster_win.get_selected_row()
diff --git a/src/tabs/xmltab.py b/src/tabs/xmltab.py
index 7c79da67..57b55103 100644
--- a/src/tabs/xmltab.py
+++ b/src/tabs/xmltab.py
@@ -22,6 +22,7 @@ class XMLTab(Tab):
def __init__(self):
Tab.__init__(self)
self.state = 'normal'
+ self.name = 'XMLTab'
self.text_win = windows.TextWin()
self.core.xml_buffer.add_window(self.text_win)
self.info_header = windows.XMLInfoWin()
diff --git a/src/windows.py b/src/windows.py
index 72e7a40d..3087c786 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -375,7 +375,7 @@ class GlobalInfoBar(Win):
if use_nicks:
self.addstr("%s" % str(tab.get_nick()), to_curses_attr(color))
else:
- self.addstr("%s" % str(tab.get_name()), to_curses_attr(color))
+ self.addstr("%s" % tab.name, to_curses_attr(color))
self.addstr("|", to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
except: # end of line
break
@@ -425,7 +425,7 @@ class VerticalGlobalInfoBar(Win):
if use_nicks:
self.addnstr("%s" % tab.get_nick(), width - 4, to_curses_attr(color))
else:
- self.addnstr("%s" % tab.get_name(), width - 4, to_curses_attr(color))
+ self.addnstr("%s" % tab.name, width - 4, to_curses_attr(color))
separator = to_curses_attr(get_theme().COLOR_VERTICAL_SEPARATOR)
self._win.attron(separator)
self._win.vline(0, width-1, curses.ACS_VLINE, height)