From 0c2fb7ffe31253d234c72908fdcad83f57a48102 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Thu, 14 Apr 2005 07:42:26 +0000
Subject: [PATCH] correct some typos

---
 src/common/config.py     |  4 ++--
 src/common/connection.py | 19 ++++++++++---------
 src/config.py            |  4 +++-
 src/roster_window.py     |  2 +-
 4 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/common/config.py b/src/common/config.py
index d22edc5f0..8bcd47a87 100644
--- a/src/common/config.py
+++ b/src/common/config.py
@@ -228,9 +228,9 @@ class Config:
 		return 0
 		
 	def get_per(self, optname, key = None, subname = None):
-		if not self.__options_per_key.has_key(typename):
+		if not self.__options_per_key.has_key(optname):
 			return None
-		dict = self.__options_per_key[typename][1]
+		dict = self.__options_per_key[optname][1]
 		if not key:
 			return dict.keys()
 		if not dict.has_key(key):
diff --git a/src/common/connection.py b/src/common/connection.py
index 0750fcbd2..a66e7074e 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -23,7 +23,8 @@ import time
 
 import common.jabber
 
-from Core import GnuPG
+from common import gajim
+from common import GnuPG
 USE_GPG = GnuPG.USE_GPG
 
 from common import i18n
@@ -219,7 +220,7 @@ class connection:
 			jid = prs.getFrom()
 			self.dispatch('SUBSCRIBED', (jid.getStripped(), jid.getResource()))
 			self.dispatch('UPDUSER', (jid.getStripped(), jid.getNode(), \
-				['General'])))
+				['General']))
 			#BE CAREFUL : no con.updateRosterItem() in a callback
 			gajim.log.debug('we are now subscribed to %s' % who)
 		elif ptype == 'unsubscribe':
@@ -374,9 +375,9 @@ class connection:
 
 		#create connexion if it doesn't already existe
 		if not self.connection:
-			if gajim.config.get_per('accounts', self.name, 'use_proxy')
+			if gajim.config.get_per('accounts', self.name, 'use_proxy'):
 				proxy = {'host': gajim.config.get_per('accounts', self.name, \
-					'proxyhost')
+					'proxyhost')}
 				proxy['port'] = gajim.config.get_per('accounts', self.name, \
 					'proxyport')
 			else:
@@ -503,8 +504,8 @@ class connection:
 			self.connection.sendPresence(ptype, prio, status, msg, signed)
 			self.dispatch('STATUS', status)
 
-	def send_message(jid, msg, keyID)
-		if inot self.connection:
+	def send_message(jid, msg, keyID):
+		if not self.connection:
 			return
 		msgtxt = msg
 		msgenc = ''
@@ -518,7 +519,7 @@ class connection:
 		self.connection.send(msg_iq)
 		self.dispatch('MSGSENT', (jid, msg, keyID))
 
-	def request_subscription(self, jid, msg)
+	def request_subscription(self, jid, msg):
 		if not self.connection:
 			return
 		gajim.log.debug('subscription request for %s' % jid)
@@ -528,12 +529,12 @@ class connection:
 		pres.setStatus(msg)
 		self.connection.send(pres)
 
-	def send_authorization(self, jid)
+	def send_authorization(self, jid):
 		if not self.connection:
 			return
 		self.connection.send(common.jabber.Presence(jid, 'subscribed'))
 
-	def refuse_authorization(self, jid)
+	def refuse_authorization(self, jid):
 		if not self.connection:
 			return
 		self.connection.send(common.jabber.Presence(jid, 'unsubscribed'))
diff --git a/src/config.py b/src/config.py
index 6e01d3025..b5122e756 100644
--- a/src/config.py
+++ b/src/config.py
@@ -22,6 +22,7 @@ import gtk.glade
 import gobject
 import os
 import common.sleepy
+from common import connection
 from common import i18n
 _ = i18n._
 APP = i18n.APP
@@ -1121,6 +1122,7 @@ class Account_modification_window:
 		if name in gajim.connections:
 			Error_dialog(_('An account already has this name'))
 			return
+		gajim.connections[name] = connection.connection(name)
 		#if we neeed to register a new account
 		if new_account_checkbutton.get_active():
 			self.plugin.send('NEW_ACC', None, (hostname, login, password, name, \
@@ -1149,7 +1151,7 @@ class Account_modification_window:
 		#update variables
 		self.plugin.windows[name] = {'infos': {}, 'chats': {}, 'gc': {}}
 		self.plugin.queues[name] = {}
-		gajim.config.connections[name].connected = 0
+		gajim.connections[name].connected = 0
 		self.plugin.roster.groups[name] = {}
 		self.plugin.roster.contacts[name] = {}
 		self.plugin.roster.newly_added[name] = []
diff --git a/src/roster_window.py b/src/roster_window.py
index 6cd69e614..215272a97 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -964,7 +964,7 @@ class Roster_window:
 				if message == -1:
 					message = ''
 				for acct in accounts:
-				if gajim.connections[acct].connected:
+					if gajim.connections[acct].connected:
 						self.send_status(acct, 'offline', message)
 			self.quit_gtkgui_plugin()
 		return True # do NOT destory the window