def send_message(maincontact,transport,sec,body,compression = True): global lastprint if(compression == True): to_send = fivebit.compress(body) else: to_send = bytes(body,'UTF-8') if not (maincontact in contacts.Contactlist): logging.warning("Contact not found in contact list, not sending message") return False seqid = gen_seqid(maincontact) contacts.Contactlist[maincontact].Messages_pending[seqid] = body tp.send_msg(transport,contacts.Contactlist[maincontact],to_send,seqid) #Use "..." if the message is sent or received from the same person if (maincontact,transport) != lastprint: GLib.idle_add(msg_out_box,contacts.Contactlist[maincontact].nick,body,transport) lastprint = (maincontact,transport) else: GLib.idle_add(msg_dots_out,body)
print( "Compressing random string 65536 characters, range 26-128 Dictionary on..." ) tstr = teststr() starttime = time.time() h = (fivebit.s.sub(tstr)) 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 on...") tstr = teststr() starttime = time.time() h = (fivebit.s.sub(tstr)) 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()