diff participant.py @ 203:2a81c480439a

renamed camelCased functions Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Thu, 25 Feb 2010 23:29:39 +0100
parents 740effa74c18
children fbe40b397f67
line wrap: on
line diff
--- a/participant.py
+++ b/participant.py
@@ -39,21 +39,21 @@ class Participant:
 		self.muc = None
 		self.left = False
 		if protocol == 'xmpp' and self.bridge.mode in ['normal', 'bypass']:
-			self.createDuplicateOnIRC()
+			self.create_duplicate_on_irc()
 		elif protocol == 'irc' and self.bridge.mode != 'minimal':
-			self.createDuplicateOnXMPP()
+			self.create_duplicate_on_xmpp()
 	
 	
 	def _get_new_duplicate_nickname(self):
 		new_duplicate_nickname = self.duplicate_nickname
 		for i in xrange(5):
 			new_duplicate_nickname = new_duplicate_nickname+'_'
-			if not self.bridge.hasParticipant(new_duplicate_nickname):
+			if not self.bridge.has_participant(new_duplicate_nickname):
 				return new_duplicate_nickname
 		return None
 	
 	
-	def createDuplicateOnXMPP(self):
+	def create_duplicate_on_xmpp(self):
 		if isinstance(self.xmpp_c, xmpp.client.Client) or isinstance(self.irc_connection, ServerConnection):
 			return
 		self.xmpp_c = self.bridge.bot.get_xmpp_connection(self.duplicate_nickname)
@@ -90,7 +90,7 @@ class Participant:
 							if isinstance(self.xmpp_c, xmpp.client.Client):
 								self.bridge.bot.close_xmpp_connection(self.nickname)
 								self.xmpp_c = None
-							self.createDuplicateOnXMPP()
+							self.create_duplicate_on_xmpp()
 							return
 					
 					else:
@@ -107,7 +107,7 @@ class Participant:
 					self.xmpp_c = None
 	
 	
-	def createDuplicateOnIRC(self):
+	def create_duplicate_on_irc(self):
 		if isinstance(self.xmpp_c, xmpp.client.Client) or isinstance(self.irc_connection, ServerConnection):
 			return
 		self.irc_connection = self.bridge.bot.irc.open_connection(self.bridge.irc_server, self.bridge.irc_port, self.duplicate_nickname)
@@ -139,7 +139,7 @@ class Participant:
 						if isinstance(self.irc_connection, ServerConnection):
 							self.irc_connection.close('')
 							self.irc_connection = error
-						self.createDuplicateOnIRC()
+						self.create_duplicate_on_irc()
 						return
 				
 				else:
@@ -151,7 +151,7 @@ class Participant:
 					if isinstance(self.irc_connection, ServerConnection):
 						self.irc_connection.close('')
 						self.irc_connection = error
-					self.createDuplicateOnIRC()
+					self.create_duplicate_on_irc()
 					return
 				else:
 					self.bridge.say(say_levels.warning, 'The nickname "'+self.nickname+'" contains unauthorized characters and cannot be used in the IRC channel', log=True)
@@ -180,7 +180,7 @@ class Participant:
 			self.xmpp_c = 'both'
 	
 	
-	def changeNickname(self, newnick, on_protocol):
+	def change_nickname(self, newnick, on_protocol):
 		"""Change participant's nickname."""
 		
 		p = None
@@ -193,7 +193,7 @@ class Participant:
 			
 			else:
 				try:
-					p = self.bridge.getParticipant(newnick)
+					p = self.bridge.get_participant(newnick)
 				except self.bridge.NoSuchParticipantException:
 					self.nickname = newnick
 					self.duplicate_nickname = newnick
@@ -203,11 +203,11 @@ class Participant:
 							self.irc_connection.nick(newnick, callback=self._irc_nick_callback)
 						else:
 							self._close_irc_connection('Changed nickname')
-							self.createDuplicateOnIRC()
+							self.create_duplicate_on_irc()
 					else:
 						if self.irc_connection == 'both':
-							self.bridge.addParticipant('irc', oldnick)
-						self.createDuplicateOnIRC()
+							self.bridge.add_participant('irc', oldnick)
+						self.create_duplicate_on_irc()
 					return
 		
 		elif self.protocol == 'irc':
@@ -217,17 +217,17 @@ class Participant:
 			
 			else:
 				try:
-					p = self.bridge.getParticipant(newnick)
+					p = self.bridge.get_participant(newnick)
 				except self.bridge.NoSuchParticipantException:
 					self.nickname = newnick
 					self.duplicate_nickname = newnick
 					if isinstance(self.xmpp_c, xmpp.client.Client):
 						for b in self.bridge.bot.bridges:
-							if b.hasParticipant(oldnick) and b.irc_server != self.bridge.irc_server:
+							if b.has_participant(oldnick) and b.irc_server != self.bridge.irc_server:
 								self.muc.leave(message='Changed nickname to "'+self.nickname+'"')
 								self.xmpp_c = None
 								self.bridge.bot.close_xmpp_connection(oldnick)
-								self.createDuplicateOnXMPP()
+								self.create_duplicate_on_xmpp()
 								return
 						
 						if not self.bridge.bot.xmpp_connections.has_key(newnick):
@@ -238,8 +238,8 @@ class Participant:
 						self.muc.change_nick(newnick, status='From IRC', callback=self._xmpp_join_callback)
 					else:
 						if self.xmpp_c == 'both':
-							self.bridge.addParticipant('xmpp', oldnick)
-						self.createDuplicateOnXMPP()
+							self.bridge.add_participant('xmpp', oldnick)
+						self.create_duplicate_on_xmpp()
 					return
 		
 		self.nickname = newnick
@@ -268,13 +268,13 @@ class Participant:
 					p.xmpp_c = None
 					p.muc = None
 				p.duplicate_nickname = p._get_new_duplicate_nickname()
-				p.createDuplicateOnXMPP()
+				p.create_duplicate_on_xmpp()
 		else:
 			# should never happen
 			raise Exception('WTF ?')
 	
 	
-	def sayOnIRC(self, message):
+	def say_on_irc(self, message):
 		bot_say = False
 		if message[:4] == '/me ':
 			action = True
@@ -299,17 +299,17 @@ class Participant:
 				self.bridge.say(-1, '<'+self.nickname+'> '+message, on_xmpp=False)
 	
 	
-	def sayOnIRCTo(self, to, message):
+	def say_on_irc_to(self, to, message):
 		if isinstance(self.irc_connection, ServerConnection):
 			self.irc_connection.privmsg(to, message)
 		elif not isinstance(self.xmpp_c, xmpp.client.Client):
 			if self.bridge.mode != 'normal':
-				self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.')
+				self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.')
 			else:
-				self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but you cannot send cross-protocol private messages because I don\'t have an IRC duplicate with your nickname.')
+				self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'Sorry but you cannot send cross-protocol private messages because I don\'t have an IRC duplicate with your nickname.')
 	
 	
-	def sayOnXMPP(self, message):
+	def say_on_xmpp(self, message):
 		if isinstance(self.xmpp_c, xmpp.client.Client):
 			self.muc.say(message)
 		elif not isinstance(self.irc_connection, ServerConnection):
@@ -323,14 +323,14 @@ class Participant:
 			self.bridge.say(-1, '<'+self.nickname+'> '+message, on_irc=False)
 	
 	
-	def sayOnXMPPTo(self, to, message):
+	def say_on_xmpp_to(self, to, message):
 		if isinstance(self.xmpp_c, xmpp.client.Client):
-			self.muc.sayTo(to, message)
+			self.muc.say_to(to, message)
 		elif not isinstance(self.irc_connection, ServerConnection):
 			if self.bridge.mode != 'normal':
-				self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.')
+				self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.')
 			else:
-				self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but you cannot send cross-protocol private messages because I don\'t have an XMPP duplicate with your nickname.')
+				self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'Sorry but you cannot send cross-protocol private messages because I don\'t have an XMPP duplicate with your nickname.')
 	
 	
 	def leave(self, message):