Ejemplo n.º 1
0
def output_contact(conn, backup_extractor, is_group, contact_id, contact_name, your_name):
	reset_colors()
	html = open(os.path.join(OUTPUT_DIR, '%s.html' % sanitize_filename(contact_name)), 'w', encoding="utf-8")
	html.write(TEMPLATEBEGINNING % ("WhatsApp",))
	c = conn.cursor()
	c.execute("SELECT {} FROM ZWAMESSAGE WHERE ZFROMJID=? OR ZTOJID=?;".format(FIELDS), (contact_id, contact_id))
	for row in c:
		mdatetime = get_date(row[2])
		mtext = get_text(conn, backup_extractor, row)
		mtext = mtext.replace("\n", "<br>\n")
		mfrom, color = get_from(conn, is_group, contact_id, contact_name, your_name, row)
		html.write((ROWTEMPLATE % (color, mdatetime, mfrom, mtext)))
	html.write(TEMPLATEEND)
	html.close()
Ejemplo n.º 2
0
def output_contact(conn, contact_conn, backup_extractor, chat_id, your_name):
	reset_colors()
	contact_name = str(chat_id)
	html = open(get_filename(conn, contact_conn, chat_id), 'w', encoding="utf-8")
	html.write(TEMPLATEBEGINNING % ("SMS/iMessage",))
	c = conn.cursor()
	c.execute("SELECT {} FROM message WHERE ROWID in ".format(FIELDS) + \
		      "(SELECT message_id FROM chat_message_join WHERE chat_id=?);", (chat_id,))
	for row in c:
		mid, mtext, mdate, is_from_me, handle_id, has_attachment = row
		if has_attachment:
			mtext = handle_media(conn, backup_extractor, mid, mtext)
		mtext = mtext.replace("\n", "<br>\n")
		mdatetime = get_date(mdate)
		mfrom = your_name if is_from_me else get_contact_name(conn, contact_conn, handle_id)
		color = COLORS[0] if is_from_me else get_color(handle_id)
		html.write((ROWTEMPLATE % (color, mdatetime, mfrom, mtext)))
	html.write(TEMPLATEEND)
	html.close()
Ejemplo n.º 3
0
def output_contact(conn, backup_extractor, is_group, contact_id, contact_name,
                   your_name):
    reset_colors()
    html = open(os.path.join(OUTPUT_DIR,
                             '%s.html' % sanitize_filename(contact_name)),
                'w',
                encoding="utf-8")
    html.write(TEMPLATEBEGINNING % ("WhatsApp", ))
    c = conn.cursor()
    c.execute(
        "SELECT {} FROM ZWAMESSAGE WHERE ZFROMJID=? OR ZTOJID=?;".format(
            FIELDS), (contact_id, contact_id))
    for row in c:
        mdatetime = get_date(row[2])
        mtext = get_text(conn, backup_extractor, row)
        mtext = mtext.replace("\n", "<br>\n")
        mfrom, color = get_from(conn, is_group, contact_id, contact_name,
                                your_name, row)
        html.write((ROWTEMPLATE % (color, mdatetime, mfrom, mtext)))
    html.write(TEMPLATEEND)
    html.close()
Ejemplo n.º 4
0
def output_contact(conn, contact_conn, backup_extractor, chat_id, your_name):
	reset_colors()
	contact_name = str(chat_id)
	html = open(get_filename(conn, contact_conn, chat_id), 'w', encoding="utf-8")
	html.write(TEMPLATEBEGINNING % ("SMS/iMessage",))
	c = conn.cursor()
	c.execute("SELECT {} FROM message WHERE ROWID in ".format(FIELDS) + \
		      "(SELECT message_id FROM chat_message_join WHERE chat_id=?);", (chat_id,))
	for row in c:
		mid, mtext, mdate, is_from_me, handle_id, has_attachment = row
		if mtext is None:
			mtext = ""
		if has_attachment:
			mtext = handle_media(conn, backup_extractor, mid, mtext)
		mtext = mtext.replace("\n", "<br>\n")
		mdatetime = get_date(mdate)
		mfrom = your_name if is_from_me else get_contact_name(conn, contact_conn, handle_id)
		color = COLORS[0] if is_from_me else get_color(handle_id)
		html.write((ROWTEMPLATE % (color, mdatetime, mfrom, mtext)))
	html.write(TEMPLATEEND)
	html.close()