Sending a message in msnlib

Matthew A. Soldo msnlib-devel@lists.auriga.wearlab.de
Tue, 25 Mar 2003 08:17:07 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_0013_01C2F2A6.ECDA7D30
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi,
 
I've been playing around with msnlib attempting to figure it out. Right now
I'm just trying to build a skeleton script that will send out a "hello
world" message. I can login and change my status to online just fine, but
when I attempt to send a message it gets queued and I can't figure out how
to get it actually sent. It seems like perhaps I'm not getting connected to
the switchboard server. I've tried to figure it out by looking through the
reference implementation, but I'm still somewhat new to python and the
reference implementation is much more complicated than I need. 
 
By the way, if anyone has an example of a minimal implementation of the
msnlib, I'd love to see it. 
 
Your help would be very much appreciated.
 
Here is my code:
 
 
#!/usr/bin/env python 
 
import sys
import os
import socket
import select
import string
import traceback
import urllib
import time
 
import msnlib
import msncb
 
m = msnlib.msnd()
m.cb = msncb.cb()
 
email="im@realitysoft.com"
pwd="my_password"
 
m.email=email
m.pwd=pwd
 
print "Logging In"
provider.login()
 
print "Changing Status to online"
provider.change_status("online")

message_status=provider.sendmsg("matt@realitysoft.com","Hello World")
print message_status
message_status=provider.sendmsg(" <mailto:matt@realitysoft.com>
matt@realitysoft.com")
print message_status
while 1:
    pass

------=_NextPart_000_0013_01C2F2A6.ECDA7D30
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 6.00.2800.1141" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D468320816-25032003>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D468320816-25032003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D468320816-25032003>I've =
been playing=20
around with msnlib attempting to figure it out. Right now I'm just =
trying to=20
build a skeleton script that will send out a "hello world" message. I =
can login=20
and change my status to online just fine, but when I attempt to send a =
message=20
it gets queued and I can't figure out how to get it actually sent. It =
seems like=20
perhaps I'm not getting connected to the switchboard server. I've tried =
to=20
figure it out by looking through the reference implementation, but I'm =
still=20
somewhat new to python and the reference implementation is much more =
complicated=20
than I need. </SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D468320816-25032003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D468320816-25032003>By the =
way, if=20
anyone has an example of a minimal implementation of the msnlib, I'd =
love to see=20
it. </SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D468320816-25032003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D468320816-25032003>Your =
help would be=20
very much appreciated.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D468320816-25032003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D468320816-25032003>Here =
is my=20
code:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D468320816-25032003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D468320816-25032003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D468320816-25032003>#!/usr/bin/env=20
python </SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D468320816-25032003>import =
sys<BR>import=20
os<BR>import socket<BR>import select<BR>import string<BR>import=20
traceback<BR>import urllib<BR>import time</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D468320816-25032003>import =

msnlib<BR>import msncb</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D468320816-25032003>m&nbsp;=3D=20
msnlib.msnd()<BR>m.cb =3D msncb.cb()</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D468320816-25032003>email=3D"<A=20
href=3D"mailto:im@realitysoft.com">im@realitysoft.com</A>"<BR>pwd=3D"my_p=
assword"</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D468320816-25032003>m.email=3Demail<BR>m.pwd=3Dpwd</SPAN></FONT></=
DIV>
<DIV>&nbsp;</DIV><FONT><SPAN class=3D468320816-25032003>
<DIV><FONT face=3DArial size=3D2>print "Logging =
In"<BR>provider.login()</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>print "Changing Status to =
online"</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>provider.change_status("online")<BR></FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>message_status=3Dprovider.sendmsg("matt@realitysoft.com","<SPAN =

class=3D468320816-25032003>Hello World</SPAN>")<BR>print=20
message_status<BR>message_status=3Dprovider.sendmsg("</FONT><A=20
href=3D"mailto:matt@realitysoft.com"><FONT face=3DArial=20
size=3D2>matt@realitysoft.com</FONT></A><FONT face=3DArial =
size=3D2>")<BR>print=20
message_status<BR>while 1:<BR>&nbsp;&nbsp;&nbsp;=20
pass</FONT></SPAN></FONT></DIV></BODY></HTML>

------=_NextPart_000_0013_01C2F2A6.ECDA7D30--