Esempio n. 1
0
if os.sys.platform == 'win32':
	sys.path.append(".\\..") # - dla windowsa
else:
	sys.path.append("../") # - dla linuksa
from pygglib import GGSession
from GGConstans import *

def login_ok(sender, args):
	print 'Zalogowano :>'

def print_msg(sender, args):
	print '<%d>: %s' % (args.uin, args.message)

	
def print_unknown_packet(sender, args):
	print 'Unknow packet received: type: %d, length: %d' % (args.type, args.length)
	print

if __name__ == "__main__":
	session = GGSession(uin = 11327271, password = '******')
	session.register('on_login_ok', login_ok)
	session.register('on_msg_recv', print_msg)
	session.register('on_unknown_packet', print_unknown_packet)
	session.login()
	session.change_status(GGStatuses.InvisibleDescr, "richtext_test.py")
	session.send_msg(3993939, 'Zwykla wiadomosc')
	session.send_msg(3993939, 'Richtext: <b>Ala <i><u>ma</u></i></b><color red=123 green=143 blue=123> KOTA</color>', richtext = True)
	session.send_msg(3993939, 'Zwykla wiadomosc 2')
	time.sleep(10)
	session.logout()
Esempio n. 2
0
        print request_to_dict(item)
    print


if __name__ == "__main__":
    if len(sys.argv) == 1:
        uin = 3993939
    else:
        uin = int(sys.argv[1])
    session = GGSession(uin=11327271, password='******')
    session.register('on_login_ok', login_ok_event_handler)
    session.register('on_msg_recv', msg_recv_event_handler)
    session.register('on_unknown_packet', on_unknown_packet_event_handler)
    session.register('on_send_msg_ack', on_send_msg_ack_event_handler)
    session.register('on_pubdir_recv', on_pubdir_recv_event_handler)
    session.login()
    session.pubdir_request({'FmNumber': 1308535})
    time.sleep(5)
    session.send_msg(uin, 'msg1')
    time.sleep(5)
    session.send_msg(uin, 'msg2', msg_class=GGMsgTypes.Chat)
    time.sleep(5)
    print 'Changing status...'
    session.change_status(GGStatuses.AvailDescr, "pygglib")
    time.sleep(5)
    print 'Changing description...'
    session.change_description("ala ma kota")
    time.sleep(5)
    session.logout('Nie ma Henia')
    x = raw_input()
Esempio n. 3
0
def login_ok(sender, args):
    print 'Zalogowano :>'


def print_msg(sender, args):
    print '<%d>: %s' % (args.uin, args.message)


def print_unknown_packet(sender, args):
    print 'Unknow packet received: type: %d, length: %d' % (args.type,
                                                            args.length)
    print


if __name__ == "__main__":
    session = GGSession(uin=11327271, password='******')
    session.register('on_login_ok', login_ok)
    session.register('on_msg_recv', print_msg)
    session.register('on_unknown_packet', print_unknown_packet)
    session.login()
    session.change_status(GGStatuses.InvisibleDescr, "richtext_test.py")
    session.send_msg(3993939, 'Zwykla wiadomosc')
    session.send_msg(
        3993939,
        'Richtext: <b>Ala <i><u>ma</u></i></b><color red=123 green=143 blue=123> KOTA</color>',
        richtext=True)
    session.send_msg(3993939, 'Zwykla wiadomosc 2')
    time.sleep(10)
    session.logout()