SHARE
TWEET

Untitled

a guest May 21st, 2017 543 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'msnp.py-0.4.1/msnp';
  2.  
  3. username = 'your@email.com'
  4. password = 'yourpassword'
  5.  
  6. class ChatEvents(msnp.ChatCallbacks):
  7.     def message_received(self, email, name, text, charset):
  8.         print email, '(' + name + ')', 'has sent you "', text, '"with charset', charset;
  9.         self.chat.send_message (text);
  10.  
  11. class SessionEvents(msnp.SessionCallbacks):
  12.     def ping(self):
  13.         print "Pinged by server";
  14.     def chat_started(self, chat):
  15.         new_callbacks = ChatEvents();
  16.         chat.callbacks = new_callbacks;
  17.         new_callbacks.chat = chat;
  18.         print "New chat started with", repr(chat.initial_members);
  19.     def friend_added(self, list_, passport_id, display_name, group_id = -1):
  20.         if (list_ == msnp.Lists.REVERSE):
  21.             print "Added to", passport_id, '(' + display_name + ')','\'s list';
  22.             #Add them back automatically
  23.            
  24.        
  25. print "Logging in...";
  26. msn = msnp.Session(SessionEvents());
  27. msn.login (username, password, msnp.States.ONLINE);
  28.  
  29. print "Syncing friends list, making you visible to friends...";
  30. msn.sync_friend_list(-1);
  31.  
  32. print "Logged in! 'Ctl-C' to exit.";
  33. while(1):
  34.     try:
  35.         msn.process(True);
  36.     except Exception, x:
  37.         print("Error: %s" % (x));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top