Da /data/data/com.viber.voip/databases/viber_messages

select thread_id, recipient_number, number, participants.contact_name, display_name, contact_id, date from threads left join participants on threads._id = participants.thread_id where date > 0 order by thread_id

1. Estrarre i thread, date e' il markup in epoch time:

	select _id, recipient_number from threads where date > 0
	
	_id					recipient_number   fate
	1					+393386638609
	2					+393349115149
	4613805683010349730	groupEntity

	Il recipient e' groupEntity se si tratta di una chat di gruppo
	
2. Estraiamo i partecipanti ad una conversazione, thread_id e' l'_id identificato nella query 1.:
    Attenzione: il target ha sempre id -1, per cui e' semplice distinguerlo dagli altri.
	
	select number, contact_name, display_name, contact_id from participants where thread_id = 4613805683010349730
	
	number			contact_name	display_name	contact_id
	+393349115149	Chiods 4g		Chiods 4g		206
	+393386638609	Easedue			Easedue			212 
	owner							Androide Buono	-1

	contact_name puo' essere null (come in questo caso)

3. Estrarre le conversazioni, thread_id e' l'_id identificato nella query 1.:

	select date, body, person, location_lat, location_lng from messages where thread_id = 4613805683010349730 and body != ''
	
	address			date			body				person	location_lat	location_lng
	groupEntity		1359551860661	Ciao				0		0				0
	groupEntity		1359551864931	Mi scrivete			0		0				0
	+393349115149	1359551934292	P					206		0				0
	+393386638609	1359551940924	"Vaginite"			212		0				0
	+393386638609	1359552022888	http://maps.ge.com/	212		454763140		91909790
	
	Se "person" e' a 0, il sender e' il target, attenzione che nella tabella "participants" il target
	e' identificato con -1 invece.

4. Estrarre le conversazioni e i partecipanti utilizzando una join:

	select distinct date, body, contact_name, display_name, M.[location_lat], M.[location_lng] number from messages as M left join participants as P on M.[person] = P.[contact_id] where body != ''
	
	date			body			contact_name	display_name	location_lat	number
	1359551427717	Chi sei?										0				0
	1359551441543	Androide buono	Easedue			Easedue			0				0
	1359551441543	Androide buono	Easedue			Easedue			0				0
	1359551860914	Yes	Chiods 4g	Chiods 4g						0				0
	
	Se contact_name e display_name sono null, vuol dire che il sender e' il target