Ejemplo n.º 1
0
def process_message(Msg_obj,compression = True):
    global lastprint
    #tx = "Message from: " + contacts.Contactlist[Msg_obj.mc].nick + " Transport: " + Msg_obj.transport + "\n" + str(Msg_obj.contents,'UTF-8') + "\n\n"

    if(compression == True):
        Msg_obj.contents = fivebit.decompress(Msg_obj.contents)

    #Use "..." if the message is sent or received from the same person
    if (Msg_obj.mc,Msg_obj.transport) != lastprint:
        GLib.idle_add(msg_to_box,contacts.Contactlist[Msg_obj.mc].nick,Msg_obj.contents,Msg_obj.transport)
        lastprint = (Msg_obj.mc,Msg_obj.transport)
    else: GLib.idle_add(msg_dots_in,Msg_obj.contents)


    #Send receipt
    tp.send_ack("lan",Msg_obj.mc,Msg_obj.seqid)
Ejemplo n.º 2
0
for y in h:
    if (y > 31): print(y, h.index(y))

for u in range(256):
    print(u, ": ", h.count(u))

d = fivebit.compress(tstr)
print("Execution time: " + str(time.time() - starttime) +
      " compressed length: " + str(len(d)))

print(
    "Decompressing random string 65536 characters, range 26-128 Dictionary on..."
)
starttime = time.time()
dec = fivebit.decompress(d)
print("Execution time: " + str(time.time() - starttime))
print(dec == tstr)

if (dec != tstr):
    print(tstr)
    print(dec)

print(
    "Compressing random string 65536 characters, range 26-128 Dictionary off..."
)
starttime = time.time()
nd = fivebit.compress(tstr, False)
print("Execution time: " + str(time.time() - starttime))

#Random lowercase words
Ejemplo n.º 3
0

for y in h:
	if(y > 31): print(y,h.index(y))



for u in range(256):
	print(u, ": ", h.count(u))	

d = fivebit.compress(tstr)
print("Execution time: " + str(time.time() - starttime) + " compressed length: " +str(len(d))  )

print("Decompressing random string 65536 characters, range 26-128 Dictionary on...")
starttime = time.time()
dec = fivebit.decompress(d)
print("Execution time: " + str(time.time() - starttime))
print( dec==tstr)

if(dec != tstr):
	print(tstr)
	print(dec)


print("Compressing random string 65536 characters, range 26-128 Dictionary off...")
starttime = time.time()
nd = fivebit.compress(tstr,False)
print("Execution time: " + str(time.time() - starttime))


#Random lowercase words