[Papyon] papyon with NTLM
lew ghiewa
ghiewa at gmail.com
Mon Aug 22 19:28:36 PDT 2011
Hi There,
I have merged most updated papyon form github.com, and test below codes
at home (ADSL), it is work fine. But in office,
errors,
INFO:papyon.msnp2p.transport:Registering transport <NotificationP2PTransport
obj
ect at 0x1562d00 (papyon+msnp2p+transport+base+BaseP2PTransport at
0xd97180)>
DEBUG:papyon.transport:<-> Connecting to gateway.messenger.hotmail.com:80
DEBUG:papyon.transport:>>> VER 0 MSNP15
DEBUG:papyon.transport:<-> Changing gateway to 64.4.61.122:80
WARNING:papyon.gnet.HTTP:Received response but wasn't waiting for one
DEBUG:papyon.transport:<<< VER 0 MSNP15
DEBUG:papyon.transport:>>> CVR 1 0x0409 winnt 5.1 i386 MSNMSGR 8.1.0178
msmsgs a
verysuzhou at gmail.com
DEBUG:papyon.transport:<<< CVR 1 14.0.8117 14.0.8117 14.0.8117
http://msgruser.d
lservice.microsoft.com/download/A/6/1/A616CCD4-B0CA-4A3D-B975-3EDB38081B38/en/wl
setup-cvr.exe http://download.live.com/?sku=messenger
DEBUG:papyon.transport:>>> USR 2 SSO I averysuzhou at gmail.com
Traceback (most recent call last):
File "C:\Documents and
Settings\randyl\Desktop\Avery_MSN_BOT\papyon\gnet\parse
r.py", line 196, in _on_chunk_received
header, value = chunk.split(":", 1)
ValueError: need more than 1 value to unpack
Traceback (most recent call last):
File "C:\Documents and
Settings\randyl\Desktop\Avery_MSN_BOT\papyon\gnet\parse
r.py", line 180, in _on_status_change
self.__emit_result()
File "C:\Documents and
Settings\randyl\Desktop\Avery_MSN_BOT\papyon\gnet\parse
r.py", line 212, in __emit_result
response.parse(self._receive_buffer)
File "C:\Documents and
Settings\randyl\Desktop\Avery_MSN_BOT\papyon\gnet\messa
ge\HTTP.py", line 158, in parse
self.version = version.split("/",1)[1]
IndexError: list index out of range
DEBUG:papyon.transport:<<< OUT OTH
ERROR : 3 -> 1
codes,
import papyon
import papyon.event
import logging
import gobject
logging.basicConfig(level=logging.DEBUG)
#logging.basicConfig()
finished = False
def get_proxies():
result['http'] = papyon.Proxy('http://127.0.0.1:3128')
return result
class ClientEvents(papyon.event.ClientEventInterface,
papyon.event.InviteEventInterface):
def __init__(self, client):
papyon.event.ClientEventInterface.__init__(self, client)
papyon.event.InviteEventInterface.__init__(self, client)
def on_client_state_changed(self, state):
if state == papyon.event.ClientState.CLOSED:
self._client.quit()
elif state == papyon.event.ClientState.OPEN:
self._client.profile.display_name = "Kimbix"
self._client.profile.presence = papyon.Presence.ONLINE
self._client.profile.current_media = ("I listen to", "Nothing")
for contact in self._client.address_book.contacts:
print contact
#self._client.profile.personal_message = "Testing papyon, and
freeing the pandas!"
gobject.timeout_add_seconds(5, self._client.start_conversation)
def on_client_error(self, error_type, error):
print "ERROR :", error_type, " ->", error
def on_invite_conversation(self, conversation):
print "*** Received invite for conversation"
self._conversation_handler = AnnoyingConversation( conversation)
class AnnoyingConversation(papyon.event.ConversationEventInterface):
def on_conversation_user_joined(self, contact):
gobject.timeout_add_seconds(5, self.annoy_user)
def annoy_user(self):
msg = "Let's free the pandas ! (testing papyon)"
formatting = papyon.TextFormat("Comic Sans MS",
papyon.TextFormat.UNDERLINE |
papyon.TextFormat.BOLD,
'FF0000')
self._client.send_text_message(papyon.ConversationMessage(msg,
formatting))
return True
def on_conversation_user_typing(self, contact):
pass
def on_conversation_message_received(self, sender, message):
print "*** Received message from %s: %s" % (sender.account,
message.content)
self._client.send_text_message(message)
def on_conversation_error(self, error_type, error):
print "ERROR :", error_type, " ->", error
class Client(papyon.Client):
def __init__(self, account, quit, http_mode=False):
server = ('messenger.hotmail.com', 1863)
self.quit = quit
self.account = account
if http_mode:
from papyon.transport import HTTPPollConnection
papyon.Client.__init__(self, server, get_proxies(),
HTTPPollConnection)
else:
papyon.Client.__init__(self, server, proxies = get_proxies())
self._event_handler = ClientEvents(self)
gobject.idle_add(self._connect)
def _connect(self):
self.login(*self.account)
return False
def start_conversation(self):
global peer
pass
return True
def main():
import sys
import getpass
import signal
global peer
if "--http" in sys.argv:
http_mode = True
sys.argv.remove('--http')
else:
http_mode = False
if len(sys.argv) < 2:
account = raw_input('Account: ')
else:
account = sys.argv[1]
if len(sys.argv) < 3:
passwd = getpass.getpass('Password: ')
else:
passwd = sys.argv[2]
mainloop = gobject.MainLoop(is_running=True)
def quit():
mainloop.quit()
def sigterm_cb():
gobject.idle_add(quit)
signal.signal(signal.SIGTERM, sigterm_cb)
n = Client((account, passwd), quit, http_mode)
while mainloop.is_running():
try:
mainloop.run()
except KeyboardInterrupt:
quit()
if __name__ == '__main__':
main()
also, I have run a cntlm service on my pc, it is work well with other
program.
Where is my fault?
Appreciate your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/papyon/attachments/20110823/defeef6c/attachment.htm>
More information about the papyon
mailing list