summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--data/default_config.cfg15
-rw-r--r--launch.sh2
-rw-r--r--locale/poezio.pot206
-rw-r--r--src/connection.py32
-rw-r--r--src/gui.py2
6 files changed, 165 insertions, 94 deletions
diff --git a/Makefile b/Makefile
index 0ec1f08c..0484b1c5 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ install:all
$(INSTALL) -m644 src/xmpp/* $(DATADIR)/poezio/src/xmpp/
echo "#!/usr/bin/env sh" > $(BINDIR)/poezio
- echo "cd $(DATADIR)/poezio/src/ && python client.py" >> $(BINDIR)/poezio
+ echo "cd $(DATADIR)/poezio/src/ && python poezio.py" >> $(BINDIR)/poezio
chmod 755 $(BINDIR)/poezio
for localename in `find locale/ -maxdepth 1 -type d | grep -v '.svn' | sed 's:locale/::g'` ; do \
diff --git a/data/default_config.cfg b/data/default_config.cfg
index a9873eb3..c7cef3d5 100644
--- a/data/default_config.cfg
+++ b/data/default_config.cfg
@@ -1,4 +1,5 @@
[Poezio]
+
# the server. Make sure the server you're using accepts anonymous authentification
server = louiz.org
@@ -11,12 +12,22 @@ resource = poezio
# the nick you will use when joining a room with no associated nick
default_nick = poezio
+# Jabber identifiant. Specify it only if you want to connect using an existing
+# account on a server. This is optional and useful only for some features,
+# like room administration, nickname registration.
+# The 'server' option will be ignored if you specify a JID (Jabber identifiant)
+# It should be in the form nickname@server.tld
+jid =
+
+# A password is needed only if you specified a jid. It will be ignored otherwise
+password =
+
# the rooms you will join automatically on startup, with associated nickname or not
rooms = poezio@conference.codingteam.net:discussion@kikoo.louiz.org
# PROXY
# set to true if you want to use an http proxy server
-# if false, no proxy will be used and the proxy_* settings have no effect
+# if false, no proxy will be used and the proxy_* settings will have no effect
use_proxy = false
proxy_server =
proxy_port =
@@ -45,7 +56,7 @@ highlight_on =
# 0: the notices will NEVER be displayed
# n: On any other number, the notices will only be displayed
# if the user involved has talked since the last n seconds
-# The join messages will be hidden only if hide_exit_join is 0
+# The quit messages will be hidden only if hide_exit_join is 0
# if the value is incorrect, -1 is assumed
hide_exit_join = -1 # all quit and join notices will be displayed
hide_status_change = 120 # status changes won't be displayed unless
diff --git a/launch.sh b/launch.sh
index f38a5a5e..9024603e 100644
--- a/launch.sh
+++ b/launch.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
-cd src/ && python client.py "$@"
+cd src/ && python poezio.py "$@"
diff --git a/locale/poezio.pot b/locale/poezio.pot
index 731b745c..ab288fad 100644
--- a/locale/poezio.pot
+++ b/locale/poezio.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-02-13 17:55+0100\n"
+"POT-Creation-Date: 2010-05-12 15:08+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,128 +16,99 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/gui.py:125
+#: src/connection.py:91
#, python-format
-msgid "Your nickname is %s"
-msgstr ""
-
-#: src/gui.py:126
-#, python-format
-msgid "%s is in the room"
-msgstr ""
-
-#: src/gui.py:134
-#, python-format
-msgid "%(nick)s joined the room %(roomname)s"
-msgstr ""
-
-#: src/gui.py:141
-#, python-format
-msgid "%(old_nick)s is now known as %(new_nick)s"
-msgstr ""
-
-#: src/gui.py:153
-#, python-format
-msgid "You have been kicked by %(by)s. Reason: %(reason)s"
-msgstr ""
-
-#: src/gui.py:155
-#, python-format
-msgid "You have been kicked. Reason: %s"
-msgstr ""
-
-#: src/gui.py:158
-#, python-format
-msgid "%(nick)s has been kicked by %(by)s. Reason: %(reason)s"
-msgstr ""
-
-#: src/gui.py:160
-#, python-format
-msgid "%(nick)s has been kicked. Reason: %(reason)s"
-msgstr ""
-
-#: src/gui.py:165
-#, python-format
-msgid "%s has left the room"
-msgstr ""
-
-#: src/gui.py:170
-#, python-format
-msgid "%(nick)s changed his/her status : %(a)s, %(b)s, %(c)s, %(d)s"
+msgid ""
+"Error: Could not authenticate. Please make sure the server you chose (%s) "
+"supports anonymous authentication"
msgstr ""
-#: src/gui.py:191
+#: src/gui.py:67
msgid "OLOL, this is SOOO recursive"
msgstr ""
-#: src/gui.py:192
+#: src/gui.py:68
msgid ""
-"Usage: /join [room_name][/nick]\n"
+"Usage: /join [room_name][/nick] [password]\n"
"Join: Join the specified room. You can specify a nickname after a slash (/). "
"If no nickname is specified, you will use the default_nick in the "
"configuration file. You can omit the room name: you will then join the room "
-"you're looking at (useful if you were kicked). Examples:\n"
+"you're looking at (useful if you were kicked). You can also provide a "
+"password to join the room.\n"
+"Examples:\n"
"/join room@server.tld\n"
"/join room@server.tld/John\n"
"/join /me_again\n"
-"/join"
+"/join\n"
+"/join room@server.tld/my_nick password\n"
+"/join / pass"
msgstr ""
-#: src/gui.py:193
+#: src/gui.py:69
msgid ""
"Usage: /quit\n"
"Quit: Just disconnect from the server and exit poezio."
msgstr ""
-#: src/gui.py:194
+#: src/gui.py:70
msgid ""
"Usage: /exit\n"
"Exit: Just disconnect from the server and exit poezio."
msgstr ""
-#: src/gui.py:195
+#: src/gui.py:71
msgid ""
"Usage: /next\n"
"Next: Go to the next room."
msgstr ""
-#: src/gui.py:196
+#: src/gui.py:72
msgid ""
"Usage: /n\n"
"N: Go to the next room."
msgstr ""
-#: src/gui.py:197
+#: src/gui.py:73
msgid ""
"Usage: /prev\n"
"Prev: Go to the previous room."
msgstr ""
-#: src/gui.py:198
+#: src/gui.py:74
msgid ""
"Usage: /p\n"
"P: Go to the previous room."
msgstr ""
-#: src/gui.py:199
+#: src/gui.py:75
msgid ""
"Usage: /win <number>\n"
"Win: Go to the specified room."
msgstr ""
-#: src/gui.py:200
+#: src/gui.py:76
msgid ""
"Usage: /w <number>\n"
"W: Go to the specified room."
msgstr ""
-#: src/gui.py:201
+#: src/gui.py:77
+msgid "Usage: /ignore <nickname>\\Ignore: Ignore a specified nickname."
+msgstr ""
+
+#: src/gui.py:78
+msgid ""
+"Usage: /unignore <nickname>\\Unignore: Remove the specified nickname from "
+"the ignore list."
+msgstr ""
+
+#: src/gui.py:79
msgid ""
"Usage: /part [message]\n"
"Part: disconnect from a room. You can specify an optional message."
msgstr ""
-#: src/gui.py:202
+#: src/gui.py:80
msgid ""
"Usage: /show <availability> [status]\n"
"Show: Change your availability and (optionaly) your status. The "
@@ -146,45 +117,45 @@ msgid ""
"message"
msgstr ""
-#: src/gui.py:203
+#: src/gui.py:81
msgid ""
"Usage: /away [message]\n"
"Away: Sets your availability to away and (optional) sets your status "
"message. This is equivalent to \"/show away [message]\""
msgstr ""
-#: src/gui.py:204
+#: src/gui.py:82
msgid ""
"Usage: /busy [message]\n"
"Busy: Sets your availability to busy and (optional) sets your status "
"message. This is equivalent to \"/show busy [message]\""
msgstr ""
-#: src/gui.py:205
+#: src/gui.py:83
msgid ""
"Usage: /avail [message]\n"
"Avail: Sets your availability to available and (optional) sets your status "
"message. This is equivalent to \"/show available [message]\""
msgstr ""
-#: src/gui.py:206
+#: src/gui.py:84
msgid ""
"Usage: /available [message]\n"
"Available: Sets your availability to available and (optional) sets your "
"status message. This is equivalent to \"/show available [message]\""
msgstr ""
-#: src/gui.py:207
+#: src/gui.py:85
msgid ""
"Usage: /bookmark [roomname][/nick]\n"
"Bookmark: Bookmark the specified room (you will then auto-join it on each "
-"poezio start). This commands uses the same syntaxe as /nick. Type /help nick "
+"poezio start). This commands uses the same syntaxe as /join. Type /help join "
"for syntaxe examples. Note that when typing \"/bookmark\" on its own, the "
"room will be bookmarked with the nickname you're currently using in this "
"room (instead of default_nick)"
msgstr ""
-#: src/gui.py:208
+#: src/gui.py:86
msgid ""
"Usage: /set <option> [value]\n"
"Set: Sets the value to the option in your configuration file. You can, for "
@@ -193,64 +164,131 @@ msgid ""
"(nothing) by providing no [value] after <option>."
msgstr ""
-#: src/gui.py:209
+#: src/gui.py:87
msgid ""
"Usage: /kick <nick> [reason]\n"
"Kick: Kick the user with the specified nickname. You also can give an "
"optional reason."
msgstr ""
-#: src/gui.py:211
+#: src/gui.py:88
+msgid ""
+"Usage: /topic <subject>\n"
+"Topic: Change the subject of the room"
+msgstr ""
+
+#: src/gui.py:89
msgid ""
"Usage: /nick <nickname>\n"
"Nick: Change your nickname in the current room"
msgstr ""
-#: src/gui.py:311
+#: src/gui.py:193
msgid "Welcome on Poezio \\o/!"
msgstr ""
-#: src/gui.py:312
+#: src/gui.py:194
#, python-format
msgid "Your JID is %s"
msgstr ""
-#: src/gui.py:353
+#: src/gui.py:229
+#, python-format
+msgid "Error: %(code)s-%(msg)s: %(body)s"
+msgstr ""
+
+#: src/gui.py:231
+msgid ""
+"To provide a password in order to join the room, type \"/join / password"
+"\" (replace \"password\" by the real password)"
+msgstr ""
+
+#: src/gui.py:246
#, python-format
msgid "message received for a non-existing room: %s"
msgstr ""
-#: src/gui.py:358
+#: src/gui.py:252
#, python-format
msgid "%(nick)s changed the subject to: %(subject)s"
msgstr ""
-#: src/gui.py:382
+#: src/gui.py:254
+#, python-format
+msgid "The subject is: %(subject)s"
+msgstr ""
+
+#: src/gui.py:284
+#, python-format
+msgid "Your nickname is %s"
+msgstr ""
+
+#: src/gui.py:286
+#, python-format
+msgid "%s is in the room"
+msgstr ""
+
+#: src/gui.py:296
+#, python-format
+msgid "%(nick)s joined the room %(roomname)s"
+msgstr ""
+
+#: src/gui.py:302
+#, python-format
+msgid "%(old_nick)s is now known as %(new_nick)s"
+msgstr ""
+
+#: src/gui.py:317
+#, python-format
+msgid "You have been kicked by %(by)s. Reason: %(reason)s"
+msgstr ""
+
+#: src/gui.py:319
+#, python-format
+msgid "You have been kicked. Reason: %s"
+msgstr ""
+
+#: src/gui.py:322
+#, python-format
+msgid "%(nick)s has been kicked by %(by)s. Reason: %(reason)s"
+msgstr ""
+
+#: src/gui.py:324
+#, python-format
+msgid "%(nick)s has been kicked. Reason: %(reason)s"
+msgstr ""
+
+#: src/gui.py:333
+#, python-format
+msgid "%s has left the room"
+msgstr ""
+
+#: src/gui.py:343
#, python-format
-msgid "presence received for a non-existing room: %s"
+msgid "%(nick)s changed his/her status : %(a)s, %(b)s, %(c)s, %(d)s"
msgstr ""
-#: src/gui.py:384
+#: src/gui.py:388
#, python-format
-msgid "Error: %s"
+msgid "Error: unknown command (%s)"
msgstr ""
-#: src/gui.py:421
+#: src/gui.py:397
msgid "Available commands are:"
msgstr ""
-#: src/gui.py:424
+#: src/gui.py:400
msgid ""
"\n"
"Type /help <command_name> to know what each command does"
msgstr ""
-#: src/gui.py:429
+#: src/gui.py:405
#, python-format
msgid "Unknown command: %s"
msgstr ""
-#: src/gui.py:493
+#: src/gui.py:470
#, python-format
msgid "already in room [%s]"
msgstr ""
diff --git a/src/connection.py b/src/connection.py
index b7326291..7b000cf5 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -49,7 +49,10 @@ class Connection(threading.Thread):
threading.Thread.__init__(self)
self.handler = Handler()
self.daemon = True # exit the program when this thread exits
- self.server = server
+ if config.get('jid', '') == '':
+ self.server = server
+ else:
+ self.server = jid_get_domain(config.get('jid', ''))
self.resource = resource
self.online = 0 # 1:connected, 2:auth confirmed
self.jid = '' # we don't know our jid yet (anon account)
@@ -65,9 +68,10 @@ class Connection(threading.Thread):
if not self.connect_to_server(self.server, self.port):
self.handler.emit('error', msg='Could not connect to server')
sys.exit(-1)
- if not self.authenticate():
+ if not self.authenticate(config.get('jid', '') == ''):
self.handler.emit('error', msg='Could not authenticate to server')
sys.exit(-1)
+ # TODO, become invisible before sendInitPresence
self.client.sendInitPresence(requestRoster=0)
self.online = 1 # 2 when confirmation of our auth is received
self.register_handlers()
@@ -75,6 +79,9 @@ class Connection(threading.Thread):
self.process()
def connect_to_server(self, server, port):
+ """
+ Connect to the server
+ """
if config.get('use_proxy','false') == 'true':
return self.client.connect((server, port),
{'host': config.get("proxy_server", ""),
@@ -99,10 +106,15 @@ class Connection(threading.Thread):
authenticate. Please make sure the server you chose \
(%s) supports anonymous authentication'
% (config.get('server', ''))))
- return None
+ return False
else:
- logger.error('Non-anonymous connections not handled currently')
- return None
+ password = config.get('password', '')
+ jid = config.get('jid', '')
+ from common import debug
+ debug(config.get('server', ''))
+ auth = self.client.auth(jid_get_node(jid), password, "salut")
+ debug(repr(auth))
+ return auth
def register_handlers(self):
"""
@@ -194,3 +206,13 @@ class Connection(threading.Thread):
if not connection:
return
self.handler.emit('send-time', iq_obj=iq)
+
+def jid_get_node(jid):
+ if isinstance(jid, basestring):
+ jid = xmpp.JID(jid)
+ return jid.getNode()
+
+def jid_get_domain(jid):
+ if isinstance(jid, basestring):
+ jid = xmpp.JID(jid)
+ return jid.getDomain()
diff --git a/src/gui.py b/src/gui.py
index 5f368266..2b9d16d6 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -306,7 +306,7 @@ Avail: Sets your availability to available and (optional) sets your status
code = error.getAttr('code')
typ = error.getAttr('type')
body = error.getTag('text').getData()
- self.add_info(r, _('Error: %(code)s-%(msg)s: %(body)s' %
+ self.add_info(room, _('Error: %(code)s-%(msg)s: %(body)s' %
{'msg':msg, 'code':code, 'body':body}))
if code == '401':
self.add_info(room, _("""To provide a password in order