summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-10-16 18:47:39 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-10-16 18:47:39 +0000
commitdb27041571b6c4b2cf9b7a9567702d8dacba5e74 (patch)
tree760b303da16346f9b4845c2a00b3fdf3f8c98bab
parent3a66bc99e3ce3a21bbfe49b6308534cca4904877 (diff)
downloadpoezio-db27041571b6c4b2cf9b7a9567702d8dacba5e74.tar.gz
poezio-db27041571b6c4b2cf9b7a9567702d8dacba5e74.tar.bz2
poezio-db27041571b6c4b2cf9b7a9567702d8dacba5e74.tar.xz
poezio-db27041571b6c4b2cf9b7a9567702d8dacba5e74.zip
remove the warnings caused by the new version of sleekxmpp, and update the connection method (changed also in sleek)
-rw-r--r--src/connection.py15
-rw-r--r--src/gui.py10
-rw-r--r--src/multiuserchat.py6
-rw-r--r--src/poezio.py2
4 files changed, 15 insertions, 18 deletions
diff --git a/src/connection.py b/src/connection.py
index e284d82b..ae480e22 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -27,7 +27,6 @@ import sleekxmpp
from config import config
from logger import logger
from handler import Handler
-from common import jid_get_node, jid_get_domain, is_jid_the_same
class Connection(sleekxmpp.ClientXMPP):
"""
@@ -35,23 +34,21 @@ class Connection(sleekxmpp.ClientXMPP):
appropriate signals
"""
def __init__(self):
+ resource = config.get('resource', '')
if config.get('jid', ''):
self.anon = False # Field used to know if we are anonymous or not.
# many features will be handled diferently
# depending on this setting
- jid = config.get('jid', '')
+ jid = '%s/%s' % (config.get('jid', ''), resource)
password = config.get('password', '')
- else: # anonymous auth
+ else: # anonymous auth
self.anon = True
- jid = None
+ jid = '%s/%s' % (config.get('server', 'anon.louiz.org'), resource)
password = None
- sleekxmpp.ClientXMPP.__init__(self, jid, password, ssl=True,
- resource=config.get('resource', 'poezio'))
-
+ sleekxmpp.ClientXMPP.__init__(self, jid, password, ssl=True)
self.registerPlugin('xep_0045')
def start(self):
# TODO, try multiple servers
- if self.connect((config.get('server', 'anon.louiz.org'),
- config.get('port', 5222))):
+ if self.connect((config.get('server', 'anon.louiz.org'), config.get('port', 5222))):
self.process(threaded=True)
diff --git a/src/gui.py b/src/gui.py
index bcf974c7..13fea525 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -44,7 +44,7 @@ from contact import Contact
from message import Message
from text_buffer import TextBuffer
from keyboard import read_char
-from common import is_jid_the_same, jid_get_domain, jid_get_resource, is_jid
+from common import jid_get_domain, is_jid
from common import debug
# http://xmpp.org/extensions/xep-0045.html#errorstatus
@@ -196,13 +196,13 @@ class Gui(object):
Called when we are connected and authenticated
"""
self.information(_("Welcome on Poezio \o/!"))
- self.information(_("Your JID is %s") % self.xmpp.fulljid)
+ self.information(_("Your JID is %s") % self.xmpp.boundjid.full)
if not self.xmpp.anon:
# request the roster
self.xmpp.getRoster()
# send initial presence
- self.xmpp.makePresence(pfrom=self.xmpp.jid).send()
+ self.xmpp.makePresence(pfrom=self.xmpp.boundjid.bare).send()
rooms = config.get('rooms', '')
if rooms == '' or not isinstance(rooms, str):
return
@@ -426,7 +426,7 @@ class Gui(object):
We received a Private Message (from someone in a Muc)
"""
jid = message['from']
- nick_from = jid.resource
+ nick_from = jid.boundjid.resource
room_from = jid.bare
room = self.get_room_by_name(jid.full) # get the tab with the private conversation
if not room: # It's the first message we receive: create the tab
@@ -692,7 +692,7 @@ class Gui(object):
"""
open a new conversation tab and focus it if needed
"""
- r = Room(room_name, self.xmpp.fulljid)
+ r = Room(room_name, self.xmpp.boundjid.full)
new_tab = ConversationTab(self.stdscr, r, self.information_win_size)
# insert it in the rooms
if self.current_tab().nb == 0:
diff --git a/src/multiuserchat.py b/src/multiuserchat.py
index 2e04c609..d1941a03 100644
--- a/src/multiuserchat.py
+++ b/src/multiuserchat.py
@@ -49,7 +49,7 @@ def change_show(xmpp, jid, own_nick, show, status):
Change our 'Show'
"""
pres = xmpp.makePresence(pto='%s/%s' % (jid, own_nick),
- pfrom=xmpp.fulljid)
+ pfrom=xmpp.boundjid.full)
if show: # if show is None, don't put a <show /> tag. It means "online"
pres['type'] = show
if status:
@@ -64,7 +64,7 @@ def change_subject(xmpp, jid, subject):
msg = xmpp.makeMessage(jid)
msg['type'] = 'groupchat'
msg['subject'] = subject
- msg['from'] = xmpp.jid
+ msg['from'] = xmpp.boundjid.bare
msg.send()
def change_nick(xmpp, jid, nick):
@@ -72,7 +72,7 @@ def change_nick(xmpp, jid, nick):
Change our own nick in a room
"""
xmpp.makePresence(pto='%s/%s' % (jid, nick),
- pfrom=xmpp.jid).send()
+ pfrom=xmpp.boundjid.bare).send()
def join_groupchat(xmpp, jid, nick, password=None):
"""
diff --git a/src/poezio.py b/src/poezio.py
index 8b245c08..6c707714 100644
--- a/src/poezio.py
+++ b/src/poezio.py
@@ -21,7 +21,7 @@ Starting point of poezio. Launches both the Connection and Gui
"""
import os
-# chdir in the source directory, so that import are never failed
+# chdir in the source directory, to import the modules
# also, no need to use a sh script to "cd" in this directoy
# before launching poezio.
os.chdir(os.path.dirname(os.path.abspath(__file__)))