Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import sys,os,xmpp,time,imaplib,re
- mailuser = 'XXxxXX@gmail.com'
- mailpass = 'SupertajneHeslo'
- tojid = 'cilove@server.sk'
- jid = 'od@koho.eu/stroj'
- password = 'heslo'
- while (1):
- jid=xmpp.protocol.JID(jid)
- cl=xmpp.Client(jid.getDomain(),debug=[])
- conn = imaplib.IMAP4_SSL("imap.gmail.com", 993)
- con=cl.connect()
- auth=cl.auth(jid.getNode(),password,resource=jid.getResource())
- conn.login(mailuser, mailpass)
- unreadCount = re.search("UNSEEN (\d+)", conn.status("INBOX", "(UNSEEN)")[1][0]).group(1)
- if unreadCount == '0':
- cl.send(xmpp.protocol.Message(tojid,'0'))
- else:
- cl.send(xmpp.protocol.Message(tojid,'1'))
- time.sleep(1)
- cl.disconnect()
Add Comment
Please, Sign In to add comment