Guest User

Untitled

a guest
May 3rd, 2018
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #!/usr/bin/python
  2. import sys,os,xmpp,time,imaplib,re
  3. mailuser = 'XXxxXX@gmail.com'
  4. mailpass = 'SupertajneHeslo'
  5. tojid = 'cilove@server.sk'
  6. jid = 'od@koho.eu/stroj'
  7. password = 'heslo'
  8.  
  9. while (1):
  10.  
  11. jid=xmpp.protocol.JID(jid)
  12. cl=xmpp.Client(jid.getDomain(),debug=[])
  13. conn = imaplib.IMAP4_SSL("imap.gmail.com", 993)
  14. con=cl.connect()
  15. auth=cl.auth(jid.getNode(),password,resource=jid.getResource())
  16. conn.login(mailuser, mailpass)
  17. unreadCount = re.search("UNSEEN (\d+)", conn.status("INBOX", "(UNSEEN)")[1][0]).group(1)
  18. if unreadCount == '0':
  19. cl.send(xmpp.protocol.Message(tojid,'0'))
  20. else:
  21. cl.send(xmpp.protocol.Message(tojid,'1'))
  22. time.sleep(1)
  23. cl.disconnect()
Add Comment
Please, Sign In to add comment