Hi,
I notice that PyMSNt inserts its own images when the user has set no
avatar. I believe that inserting data into users' sessions is wrong, and
a misfeature (further, I certainly do not want it). Here is a patch.
Matthew W.S. Bell
# HG changeset patch
# User men...@engelbert
# Date 1233973852 0
# Node ID 6d6107c075a1ffa39852a7aa233e21d66a6627a6
# Parent b704db19896ad03f142f88e62912b3e67a4f2990
Don't insert avatars into users' sessions. Add a config. option to enable old
behaviour.
diff -r b704db19896a -r 6d6107c075a1 config-example.xml
--- a/config-example.xml Mon Feb 02 22:49:45 2009 +0200
+++ b/config-example.xml Sat Feb 07 02:30:52 2009 +0000
@@ -51,6 +51,8 @@
<allowRegister/>
<!-- Get all avatars. If this is set to true then avatars are grabbed for all
your contacts immediately. If false then avatars are only grabbed when you're
in a chat with a contact -->
<getAllAvatars/>
+<!-- If this option is set, pymsnt inserts default avatars where no avatar is
specified, instead of propogating the users' settings -->
+<!--<insertDefaultAvatars/>-->
<!-- The amount of time a user has to join a groupchat they are invited to
before the transport makes them leave the room. (MSN protocol requires
autojoining of groupchats) -->
<!-- <groupchatTimeout>120</groupchatTimeout> -->
diff -r b704db19896a -r 6d6107c075a1 src/config.py
--- a/src/config.py Mon Feb 02 22:49:45 2009 +0200
+++ b/src/config.py Sat Feb 07 02:30:52 2009 +0000
@@ -19,6 +19,7 @@
registerMessage = ""
allowRegister = False
getAllAvatars = False
+insertDefaultAvatars = False
groupchatTimeout = "180"
useXCP = False
diff -r b704db19896a -r 6d6107c075a1 src/legacy/glue.py
--- a/src/legacy/glue.py Mon Feb 02 22:49:45 2009 +0200
+++ b/src/legacy/glue.py Sat Feb 07 02:30:52 2009 +0000
@@ -337,9 +337,12 @@
global defaultJabberAvatarData
if av:
- msn.MSNConnection.changeAvatar(self, av.getImageData)
+ newAv = av.getImageData
+ elif config.insertDefaultAvatars:
+ newAv = lambda: defaultJabberAvatarData
else:
- msn.MSNConnection.changeAvatar(self, lambda:
defaultJabberAvatarData)
+ newAv = av
+ msn.MSNConnection.changeAvatar(self, newAv)
def sendTypingNotifications(self):
if not self.session: return
@@ -481,8 +484,11 @@
d.addCallback(updateAvatarCB)
else:
# They've turned off their avatar
- global defaultAvatar
- c.updateAvatar(defaultAvatar)
+ if config.insertDefaultAvatars:
+ global defaultAvatar
+ c.updateAvatar(defaultAvatar)
+ else:
+ c.updateAvatar()
def contactStatusChanged(self, remoteUser):
LogEvent(INFO, self.jabberID)
@@ -647,7 +653,10 @@
# contact base on the old list data and then
# sync it with current
jabContact =
self.session.contactList.createContact(msn2jid(contact.userHandle, False),
msnlist2jabsub(oldLists))
- jabContact.updateAvatar(defaultAvatar, push=False)
+ if config.insertDefaultAvatars:
+ jabContact.updateAvatar(defaultAvatar,
push=False)
+ else:
+ jabContact.updateAvatar(push=False)
if addedToList(msn.FORWARD_LIST):
jabContact.syncGroups(getGroupNames(contact,
contactList), push=False)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"py-transports" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/py-transports?hl=en
-~----------~----~----~----~------~----~------~--~---