[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.5/kdenetwork/kopete/libkopete
From:       Teemu Rytilahti <tpr () d5k ! net>
Date:       2010-08-18 18:40:45
Message-ID: 20100818184045.EA5B4AC855 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1165284 by rytilahti:

backport r1156229:

Use KIO::encodeFilename() before trying to save the user's avatar photo to the disk. \
This is needed because in XMPP the JID may contain a slash, which is reserved \
character in filesystem.

CCBUGS:156184



 M  +4 -4      kopeteavatarmanager.cpp  


--- branches/KDE/4.5/kdenetwork/kopete/libkopete/kopeteavatarmanager.cpp \
#1165283:1165284 @@ -178,7 +178,7 @@
 	// for the contact avatar, save it with the contactId + .png
 	if (newEntry.category == AvatarManager::Contact && newEntry.contact)
 	{
-		avatarFilename = newEntry.contact->contactId() + ".png";
+		avatarFilename = KIO::encodeFileName(newEntry.contact->contactId()) + ".png";
 	}
 	else
 	{
@@ -199,7 +199,7 @@
 
 	if( !avatar.save( avatarUrl.toLocalFile(), "PNG") )
 	{
-		kDebug(14010) << "Saving of " << avatarUrl.toLocalFile() << " failed !";
+		kDebug(14010) << "Saving of scaled avatar to " << avatarUrl.toLocalFile() << " \
failed !";  return AvatarEntry();
 	}
 
@@ -208,7 +208,7 @@
 	// for the contact avatar, save it with the contactId + .png
 	if (newEntry.category == AvatarManager::Contact && newEntry.contact)
 	{
-		dataFilename = newEntry.contact->contactId() + QLatin1String("_");
+		dataFilename = KIO::encodeFileName(newEntry.contact->contactId()) + \
QLatin1String("_");  }
 
 	dataFilename += KMD5(data).hexDigest();
@@ -223,7 +223,7 @@
 	QFile f(dataUrl.toLocalFile());
 	if (!f.open(QIODevice::WriteOnly))
 	{
-		kDebug(14010) << "Saving of " << dataUrl.toLocalFile() << " failed !";
+		kDebug(14010) << "Saving of original avatar to " << dataUrl.toLocalFile() << " \
failed !";  return AvatarEntry();
 	}
 	f.write(data);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic