summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-06 21:10:09 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-11-08 00:47:56 +0100
commit51364f7bea78f27820c67bf83a8e62ca593d61bb (patch)
treefd26f69fa343aef218637f9f3b46e2ed2b2abe0c
parent32a75fd5c746ba6080f43ef56be361deb2e3bad3 (diff)
downloadpoezio-51364f7bea78f27820c67bf83a8e62ca593d61bb.tar.gz
poezio-51364f7bea78f27820c67bf83a8e62ca593d61bb.tar.bz2
poezio-51364f7bea78f27820c67bf83a8e62ca593d61bb.tar.xz
poezio-51364f7bea78f27820c67bf83a8e62ca593d61bb.zip
Code cleanup (unused import, variables, undefined names, etc…)
-rw-r--r--src/common.py1
-rw-r--r--src/connection.py1
-rw-r--r--src/core.py6
-rw-r--r--src/keyboard.py2
-rw-r--r--src/logger.py1
-rw-r--r--src/multiuserchat.py2
-rw-r--r--src/roster.py2
-rw-r--r--src/tabs.py9
-rw-r--r--src/user.py5
-rw-r--r--src/windows.py11
10 files changed, 10 insertions, 30 deletions
diff --git a/src/common.py b/src/common.py
index 11a09b93..7e1c0642 100644
--- a/src/common.py
+++ b/src/common.py
@@ -15,7 +15,6 @@ import os
import mimetypes
import hashlib
import subprocess
-import curses
import time
import shlex
diff --git a/src/connection.py b/src/connection.py
index 7246ae1e..f407dfe9 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -15,7 +15,6 @@ log = logging.getLogger(__name__)
from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset,
gettext as _)
-import sys
import getpass
import sleekxmpp
diff --git a/src/core.py b/src/core.py
index f92e2730..78ca971b 100644
--- a/src/core.py
+++ b/src/core.py
@@ -8,7 +8,6 @@
from gettext import gettext as _
import os
-import re
import sys
import time
import curses
@@ -44,8 +43,7 @@ from plugin_manager import PluginManager
from data_forms import DataFormsTab
from config import config, options
from logger import logger
-from user import User
-from roster import Roster, RosterGroup, roster
+from roster import roster
from contact import Contact, Resource
from text_buffer import TextBuffer
from keyboard import read_char
@@ -1286,7 +1284,6 @@ class Core(object):
the_input.auto_completion(items, '')
else:
# we are writing the server: complete the server
- serv = jid.server
serv_list = []
for tab in self.tabs:
if isinstance(tab, tabs.MucTab):
@@ -1295,7 +1292,6 @@ class Core(object):
return True
def completion_list(self, the_input):
- txt = the_input.get_text()
muc_serv_list = []
for tab in self.tabs: # TODO, also from an history
if isinstance(tab, tabs.MucTab) and\
diff --git a/src/keyboard.py b/src/keyboard.py
index 99173f40..c8f4b60c 100644
--- a/src/keyboard.py
+++ b/src/keyboard.py
@@ -12,8 +12,6 @@ of the time ONE char, but may be longer if it's a keyboard
shortcut, like ^A, M-a or KEY_RESIZE)
"""
-import time
-
def get_next_byte(s):
"""
Read the next byte of the utf-8 char
diff --git a/src/logger.py b/src/logger.py
index e8a29a3f..bd24eb3b 100644
--- a/src/logger.py
+++ b/src/logger.py
@@ -5,7 +5,6 @@
# Poezio is free software: you can redistribute it and/or modify
# it under the terms of the zlib license. See the COPYING file.
-import sys
from os import environ, makedirs
import os
from datetime import datetime
diff --git a/src/multiuserchat.py b/src/multiuserchat.py
index ac910837..0527c1ed 100644
--- a/src/multiuserchat.py
+++ b/src/multiuserchat.py
@@ -11,8 +11,6 @@ Add some facilities that are not available on the XEP_0045
sleek plugin
"""
-import sleekxmpp
-
from xml.etree import cElementTree as ET
import logging
diff --git a/src/roster.py b/src/roster.py
index 4ef2da1b..df84d4d8 100644
--- a/src/roster.py
+++ b/src/roster.py
@@ -14,7 +14,7 @@ log = logging.getLogger(__name__)
from config import config
from os import path as p
-from contact import Contact, Resource
+from contact import Contact
from sleekxmpp.xmlstream.stanzabase import JID
class Roster(object):
diff --git a/src/tabs.py b/src/tabs.py
index 984d428f..ce091913 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -24,7 +24,6 @@ from gettext import gettext as _
import windows
import curses
import difflib
-import text_buffer
import string
import common
import core
@@ -40,7 +39,7 @@ from theming import get_theme
from sleekxmpp.xmlstream.stanzabase import JID
from config import config
from roster import RosterGroup, roster
-from contact import Contact, Resource
+from contact import Contact
from text_buffer import TextBuffer
from user import User
from os import getenv, path
@@ -568,9 +567,9 @@ class MucTab(ChatTab):
"""
args = arg.split()
if len(args):
- msg = ' '.join(args)
+ arg = ' '.join(args)
else:
- msg = None
+ arg = None
if self.joined:
muc.leave_groupchat(self.core.xmpp, self.name, self.own_nick, arg)
self.add_message(_("\x195}You left the chatroom\x193}"))
@@ -938,7 +937,7 @@ class MucTab(ChatTab):
self.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s\x195} joined the room' % {'nick':from_nick, 'color':color, 'spec':get_theme().CHAR_JOIN})
else:
self.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s \x195}(\x194}%(jid)s\x195}) joined the room' % {'spec':get_theme().CHAR_JOIN, 'nick':from_nick, 'color':color, 'jid':jid.full})
- self.core.on_user_rejoined_private_conversation(room.name, from_nick)
+ self.core.on_user_rejoined_private_conversation(self.name, from_nick)
def on_user_nick_change(self, presence, user, from_nick, from_room):
new_nick = presence.find('{%s}x/{%s}item' % (NS_MUC_USER, NS_MUC_USER)).attrib['nick']
diff --git a/src/user.py b/src/user.py
index 5867e1f3..0d29569f 100644
--- a/src/user.py
+++ b/src/user.py
@@ -10,10 +10,7 @@ Define the user class.
An user is a MUC participant, not a roster contact (see contact.py)
"""
-import curses
-
-from random import randrange, choice
-from config import config
+from random import choice
from datetime import timedelta, datetime
from theming import get_theme
diff --git a/src/windows.py b/src/windows.py
index 1ff8f858..a6b1993b 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -14,26 +14,23 @@ A Tab (see tab.py) is composed of multiple Windows
from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset,
gettext as _)
-from os.path import isfile
import logging
log = logging.getLogger(__name__)
-import shlex
import curses
import string
from config import config
from threading import RLock
-from contact import Contact, Resource
-from roster import RosterGroup, roster
+from contact import Contact
+from roster import RosterGroup
from poopt import cut_text
from sleekxmpp.xmlstream.stanzabase import JID
import core
-import common
import wcwidth
import singleton
import collections
@@ -1472,11 +1469,9 @@ class RosterWin(Win):
if not resource:
# There's no online resource
presence = 'unavailable'
- folder = ' '
nb = ''
else:
presence = resource.get_presence()
- folder = '[+]' if contact._folded else '[-]'
nb = ' (%s)' % (contact.get_nb_resources(),)
color = RosterWin.color_show[presence]
if contact.get_name():
@@ -1520,11 +1515,11 @@ class ContactInfoWin(Win):
"""
draw the contact information
"""
+ resource = contact.get_highest_priority_resource()
if contact:
jid = contact.get_bare_jid()
else:
jid = jid or resource.get_jid().full
- resource = contact.get_highest_priority_resource()
if resource:
presence = resource.get_presence()
else: