Ejemplo n.º 1
0
def cb_rng(md, type, tid, params):
    "Handles switchboard invitations."
    t = params.split(' ')
    sid = tid
    ip, port = t[0].split(':')
    port = int(port)
    hash = t[2]
    email = t[3]

    fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    # we set the socket nonblocking so we don't block (duh!) on connect();
    # it will be picked up later from the select loop and handled via the
    # main read() call, which you will have to see to find out the rest.
    fd.setblocking(0)
    fd.connect_ex((ip, port))

    sbd = msnlib.sbd()
    sbd.fd = fd
    sbd.block = 0
    sbd.state = 'cp'
    sbd.type = 'answer'
    sbd.endpoint = (ip, port)
    sbd.emails.append(email)
    sbd.hash = hash
    sbd.session_id = sid
    md.submit_sbd(sbd)  # it has the connect pending
Ejemplo n.º 2
0
def cb_rng(md, type, tid, params):
	"Handles switchboard invitations."
	t = params.split(' ')
	sid = tid
	ip, port = t[0].split(':')
	port = int(port)
	hash = t[2]
	email = t[3]

	fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	# we set the socket nonblocking so we don't block (duh!) on connect();
	# it will be picked up later from the select loop and handled via the
	# main read() call, which you will have to see to find out the rest.
	fd.setblocking(0)
	fd.connect_ex((ip, port))

	sbd = msnlib.sbd()
	sbd.fd = fd
	sbd.block = 0
	sbd.state = 'cp'
	sbd.type = 'answer'
	sbd.endpoint = (ip, port)
	sbd.emails.append(email)
	sbd.hash = hash
	sbd.session_id = sid
	md.submit_sbd(sbd) 		# it has the connect pending