[nicotine+] Fix RHBZ #662786

Mohamed ElMorabity melmorabity at fedoraproject.org
Wed Dec 29 00:13:43 UTC 2010


commit 52eeb4db7a2b7d5825ea5a5a997a9774b7ff541d
Author: Mohamed El Morabity <melmorabity at fedoraproject.org>
Date:   Wed Dec 29 01:13:32 2010 +0100

    Fix RHBZ #662786

 nicotine+-1.2.16-RHBZ662786.patch |  113 +++++++++++++++++++++++++++++++++++++
 nicotine+.spec                    |    8 ++-
 2 files changed, 120 insertions(+), 1 deletions(-)
---
diff --git a/nicotine+-1.2.16-RHBZ662786.patch b/nicotine+-1.2.16-RHBZ662786.patch
new file mode 100644
index 0000000..ccd7716
--- /dev/null
+++ b/nicotine+-1.2.16-RHBZ662786.patch
@@ -0,0 +1,113 @@
+Index: /trunk/nicotine+/pynicotine/gtkgui/privatechat.py
+===================================================================
+--- /trunk/nicotine+/pynicotine/gtkgui/privatechat.py	(revision 1291)
++++ /trunk/nicotine+/pynicotine/gtkgui/privatechat.py	(revision 1457)
+@@ -30,4 +30,7 @@
+ from pynicotine.logfacility import log
+ 
++CTCP_VERSION = "\x01VERSION\x01"
++
++
+ class PrivateChats(IconNotebook):
+ 	CMDS = set(["/alias ", "/unalias ", "/whois ", "/browse ", "/ip ", "/pm ", "/msg ", "/search ", "/usearch ", "/rsearch ",
+@@ -87,5 +90,5 @@
+ 			tab.GetUserStatus(msg.status)
+ 
+-	def SendMessage(self, user, text = None, direction = None):
++	def SendMessage(self, user, text = None, direction = None, bytestring = False):
+ 		if user not in self.users:
+ 			tab = PrivateChat(self, user)
+@@ -98,5 +101,5 @@
+ 				self.set_current_page(self.page_num(self.users[user].Main))
+ 		if text is not None:
+-			self.users[user].SendMessage(text)
++			self.users[user].SendMessage(text, bytestring=bytestring)
+ 	
+ 	def TabPopup(self, user):
+@@ -189,10 +192,10 @@
+ 		# SEND CLIENT VERSION to user if the following string is sent
+ 		ctcpversion = 0
+-		if text == "\x01VERSION\x01":
++		if text == CTCP_VERSION:
+ 			ctcpversion = 1
+ 			text = "CTCP VERSION"
+ 		self.users[msg.user].ShowMessage(text, status, msg.timestamp)	
+ 		if ctcpversion and self.frame.np.config.sections["server"]["ctcpmsgs"] == 0:
+-			self.SendMessage(msg.user, "Nicotine-Plus %s" % version)
++			self.SendMessage(msg.user, u"Nicotine-Plus %s" % version)
+ 		self.frame.pluginhandler.IncomingPrivateChatNotification(msg.user, text)
+ 
+@@ -480,9 +483,9 @@
+ 		autoreply = self.frame.np.config.sections["server"]["autoreply"]
+ 		if self.frame.away and not self.autoreplied and autoreply:
+-			self.SendMessage("[Auto-Message] %s" % autoreply)
++			self.SendMessage(u"[Auto-Message] %s" % autoreply)
+ 			self.autoreplied = 1
+ 		self.frame.Notifications.new_tts(self.frame.np.config.sections["ui"]["speechprivate"] %{"user":self.frame.Notifications.tts_clean(self.user), "message": self.frame.Notifications.tts_clean(speech)} )
+ 
+-	def SendMessage(self, text):
++	def SendMessage(self, text, bytestring=False):
+ 		user_text = self.frame.pluginhandler.OutgoingPrivateChatEvent(self.user, text)
+ 		if user_text == None:
+@@ -496,5 +499,5 @@
+ 		else:
+ 			
+-			if text == "\x01VERSION\x01":
++			if text == CTCP_VERSION:
+ 				line = "CTCP VERSION"
+ 			else:
+@@ -508,10 +511,14 @@
+ 			self.logfile = WriteLog(self.logfile, self.frame.np.config.sections["logging"]["privatelogsdir"], self.user, line)
+ 		
++		if bytestring:
++			payload = text
++		else:
++			payload = ToBeEncoded(self.frame.AutoReplace(text), self.encoding)
++
+ 		if self.PeerPrivateMessages.get_active():
+ 			# not in the soulseek protocol
+-			self.frame.np.ProcessRequestToPeer(self.user, slskmessages.PMessageUser(None, my_username, ToBeEncoded(self.frame.AutoReplace(text), self.encoding)))
+-		else:
+-			self.frame.np.queue.put(slskmessages.MessageUser(self.user, ToBeEncoded(self.frame.AutoReplace(text), self.encoding)))
+-			
++			self.frame.np.ProcessRequestToPeer(self.user, slskmessages.PMessageUser(None, my_username, payload))
++		else:
++			self.frame.np.queue.put(slskmessages.MessageUser(self.user, payload))
+ 
+ 		
+@@ -633,5 +640,5 @@
+ 		elif cmd == "/ctcpversion":
+ 			if args:
+-				self.frame.privatechats.SendMessage(args, "\x01VERSION\x01", 1)
++				self.frame.privatechats.SendMessage(args, CTCP_VERSION, 1, bytestring=True)
+ 		elif cmd in ["/clear", "/cl"]:
+ 			self.ChatScroll.get_buffer().set_text("")
+Index: /trunk/nicotine+/pynicotine/gtkgui/chatrooms.py
+===================================================================
+--- /trunk/nicotine+/pynicotine/gtkgui/chatrooms.py	(revision 1454)
++++ /trunk/nicotine+/pynicotine/gtkgui/chatrooms.py	(revision 1457)
+@@ -1275,9 +1275,8 @@
+ 		elif cmd in ["/m", "/msg"]:
+ 			if byteargs:
+-				s = byteargs.split(" ", 1)
+-				user = s[0]
+-				if len(s) == 2:
+-					msg = s[1]
+-				else:
++				user = byteargs.split(" ", 1)[0]
++				try:
++					msg = args.split(" ", 1)[1]
++				except IndexError:
+ 					msg = None
+ 				self.frame.privatechats.SendMessage(user, msg)
+Index: /trunk/nicotine+/pynicotine/gtkgui/utils.py
+===================================================================
+--- /trunk/nicotine+/pynicotine/gtkgui/utils.py	(revision 1454)
++++ /trunk/nicotine+/pynicotine/gtkgui/utils.py	(revision 1457)
+@@ -1021,5 +1021,5 @@
+ 			
+ 	def OnVersion(self, widget):
+-		self.frame.privatechats.SendMessage(self.user, "\x01VERSION\x01")
++		self.frame.privatechats.SendMessage(self.user, "\x01VERSION\x01", bytestring=True)
+ 		
+ 	def OnCopyUser(self, widget):
diff --git a/nicotine+.spec b/nicotine+.spec
index 8e220d1..836fe83 100644
--- a/nicotine+.spec
+++ b/nicotine+.spec
@@ -7,7 +7,7 @@
 
 Name:           nicotine+
 Version:        1.2.16
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A client for the SoulSeek file sharing network
 
 Group:          Applications/Internet
@@ -26,6 +26,8 @@ Patch1:         nicotine+-1.2.16-urls_commands.patch
 # Disable installation of documentation files, except the manual needed by
 # application help
 Patch2:         nicotine+-1.2.16-documentation.patch
+# Fix RHBZ #662786 (see http://www.nicotine-plus.org/ticket/697)
+Patch3:         nicotine+-1.2.16-RHBZ662786.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  desktop-file-utils
@@ -49,6 +51,7 @@ PySoulSeek project by Alexander Kanavin.
 %setup -q
 %patch1 -p1 -b .urls_commands
 %patch2 -p1 -b .documentation
+%patch3 -p3 -b .RHBZ662786
 
 # Remove shebangs
 pushd pynicotine
@@ -104,6 +107,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Wed Dec 29 2010 Mohamed El Morabity <melmorabity at fedorapeople.org> - 1.2.16-2
+- Add nicotine+-1.2.16-RHBZ662786.patch paych to fix RHBZ #66278
+
 * Tue Nov 09 2010 Mohamed El Morabity <melmorabity at fedoraproject.org> - 1.2.16-1
 - Update to 1.2.16
 - Repack source to remove nonfree sound themes (licensed under CC Sampling Plus


More information about the scm-commits mailing list