code cleanup before 0.6 beta

parent accfe046
......@@ -29,7 +29,7 @@ password =
# the rooms you will join automatically on startup, with associated nickname or not
# format : room@server.tld/nickname:room2@server.tld/nickname2
# default_nick will be used if "/nickname" is not specified
rooms = poezio@conference.codingteam.net:discussion@kikoo.louiz.org
rooms = poezio@conference.codingteam.net
# PROXY
# set to true if you want to use an http proxy server
......@@ -79,7 +79,10 @@ use_log = false
# the full path to the photo (avatar) you want to use
# it should be less than 16Ko
photo = ../data/poezio_80.png
# The avatar is not set by default, because it slows
# poezio's startup a little. Uncomment if you want the default avatar
#photo = ../data/poezio_80.png
# if true, information about the software (name and version)
# will be sent if requested by anyone
......@@ -109,4 +112,4 @@ website = http://poezio.eu
email =
# anything you want to say about you
comment = I am using Poezio, it's a cool XMPP (Jabber) client. Check it out at http://poezio.eu
\ No newline at end of file
comment = I am using Poezio, it's a console XMPP (Jabber) client. Check it out at http://poezio.eu
\ No newline at end of file
......@@ -33,7 +33,6 @@
"""
various useful functions
"""
import base64
import os
import mimetypes
......@@ -60,8 +59,8 @@ def exception_handler(type_, value, trace):
on any traceback: exit ncurses and print the traceback
then exit the program
"""
curses.echo()
curses.endwin()
curses.echo()
traceback.print_exception(type_, value, trace, None, sys.stderr)
sys.exit(2)
......
......@@ -23,16 +23,6 @@ Defines the Connection class
from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset,
gettext as _)
# from os.path import isfile
# if isfile('../locale/poezio.pot'):
# localedir = '../locale'
# else:
# localedir = '/usr/share/locale'
# bindtextdomain('poezio', localedir)
# textdomain('poezio')
# bind_textdomain_codeset('poezio', 'utf-8')
import sys
......
......@@ -23,18 +23,6 @@ from os.path import isfile
from time import sleep
# if isfile('../locale/poezio.pot'):
# localedir = '../locale'
# else:
# localedir = '/usr/share/locale'
# bindtextdomain('poezio', localedir)
# textdomain('poezio')
# bind_textdomain_codeset('poezio', 'utf-8')
# import locale
# locale.setlocale(locale.LC_ALL, '')
import sys
import curses
......@@ -51,9 +39,7 @@ from message import Message
from connection import is_jid_the_same
from common import debug
def doupdate():
debug("doupdate")
curses.doupdate()
class Gui(object):
......@@ -64,8 +50,6 @@ class Gui(object):
self.init_curses(stdscr)
self.stdscr = stdscr
self.window = Window(stdscr)
# self.window.new_room(self.current_room())
# self.window.refresh(self.rooms)
self.rooms = [Room('Info', '', self.window)]
self.ignores = {}
......@@ -131,14 +115,11 @@ class Gui(object):
main loop waiting for the user to press a key
"""
while 1:
# stdscr.leaveok(1)
doupdate()
try:
key = stdscr.getkey()
except:
continue
from common import debug
# debug(str(key))
if str(key) in self.key_func.keys():
self.key_func[key]()
elif str(key) == 'KEY_RESIZE':
......@@ -416,8 +397,6 @@ class Gui(object):
# also change our nick in all private discussion of this room
for _room in self.rooms:
if _room.jid is not None and is_jid_the_same(_room.jid, room.name):
debug(_room.jid)
debug(room.name)
_room.own_nick = stanza.getNick()
user.change_nick(stanza.getNick())
self.add_message_to_room(room, _('%(old)s is now known as %(new)s') % {'old':from_nick, 'new':stanza.getNick()})
......@@ -485,7 +464,6 @@ class Gui(object):
# display the message in the room
self.add_message_to_room(room, msg)
private_room = self.get_room_by_name(stanza.getFrom())
# debug('status change: ' + stanza.getFrom()+'\n')
if private_room: # display the message in private
self.add_message_to_room(private_room, msg)
# finally, effectively change the user status
......@@ -788,6 +766,9 @@ class Gui(object):
self.window.refresh(self.rooms)
def command_query(self, args):
"""
/query
"""
if len(args) != 1:
return
nick = args[0]
......
......@@ -17,7 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with Poezio. If not, see <http://www.gnu.org/licenses/>.
from common import debug
from datetime import datetime
class Message(object):
......
......@@ -23,8 +23,7 @@ import xmpp
import common
import threading
from time import (altzone, daylight, gmtime, localtime, mktime, strftime,
time as time_time, timezone, tzname)
from time import (altzone, gmtime, localtime, strftime, timezone)
from handler import Handler
from config import config
......@@ -99,8 +98,6 @@ class VcardSender(threading.Thread):
iq3.addChild(k).setData(j[k])
else:
iq2.addChild(i).setData(vcard[i])
# id_ = self.connect.getAnId()
# iq.setID(id_)
self.connection.send(iq)
iq = xmpp.Iq(typ = 'set')
iq2 = iq.setTag(xmpp.NS_VCARD_UPDATE)
......@@ -150,7 +147,6 @@ class MultiUserChat(object):
self.connection.send(mes)
def send_private_message(self, user_jid, message):
from common import debug
mes = Message(to=user_jid)
mes.setBody(message)
mes.setType('chat')
......@@ -217,8 +213,6 @@ class MultiUserChat(object):
code=code,
msg=msg)
def on_presence(self, presence):
"""Receive a MUC presence notification"""
from_ = presence.getFrom().__str__()
......
......@@ -20,15 +20,13 @@
"""
Starting point of poezio. Launches both the Connection and Gui
"""
import sys
# import locale
# locale.setlocale(locale.LC_ALL, '')
# disable any printout (this would mess the display)
# sys.stdout = open('/dev/null', 'w')
sys.stderr = open('errors', 'w')
if len(sys.argv) == 2:
sys.stderr = open('errors', 'a')
else:
sys.stderr = open('/dev/null', 'a')
from connection import Connection
from multiuserchat import MultiUserChat
......
......@@ -46,8 +46,6 @@ class Room(object):
if len(self.messages) <= y:
return
self.pos += 14
from common import debug
debug(str(y_x))
if self.pos + y >= len(self.messages):
self.pos = len(self.messages) - y+3
......
......@@ -51,11 +51,9 @@ class User(object):
get a int
Return True if the user talked since the last s seconds
"""
from common import debug
if self.last_talked is None:
return False
delta = timedelta(0, t)
debug("Last talk: %s\nDelai:%s\nDelta:%s\n" % (str(self.last_talked), str(t), str(delta)))
if datetime.now() - delta > self.last_talked:
return False
return True
......@@ -22,23 +22,12 @@ from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset,
gettext as _)
from os.path import isfile
# if isfile('../locale/poezio.pot'):
# localedir = '../locale'
# else:
# localedir = '/usr/share/locale'
# bindtextdomain('poezio', localedir)
# textdomain('poezio')
# bind_textdomain_codeset('poezio', 'utf-8')
import locale
locale.setlocale(locale.LC_ALL, '')
import curses
from config import config
from common import debug
from message import Line
class Win(object):
......@@ -60,7 +49,6 @@ class Win(object):
pass
self.win.idlok(1)
self.win.leaveok(1)
# self.win.syncok(0)
def refresh(self):
self.win.noutrefresh()
......@@ -238,7 +226,6 @@ class TextWin(Win):
Build the Line objects from the messages, and then write
them in the text area
"""
from common import debug
if not self.visible:
return
self.win.erase()
......@@ -605,7 +592,6 @@ class Window(object):
'room' is the current one
"""
room = rooms[0] # get current room
# self.text_win.redraw(room)
self.text_win.refresh(room)
self.user_win.refresh(room.users)
self.topic_win.refresh(room.topic, room.jid)
......@@ -615,6 +601,3 @@ class Window(object):
def do_command(self, key):
self.input.do_command(key)
self.input.refresh()
# def new_room(self, room):
# self.text_win.new_win(room.name)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment