Retrieve video and audio from whatsapp db - C, C++, C# and Other Windows Phone Development

I write little application for design message history from whatsapp app. The whatsapp app is stored data into sqlite db.
First of all I decrypt the db.
Secondly, I see that the DB have a table for messages, with those columns:
Code:
TABLE messages
(
_id INTEGER PRIMARY KEY AUTOINCREMENT,
key_remote_jid TEXT NOT NULL,
key_from_me INTEGER,
key_id TEXT NOT NULL,
status INTEGER,
needs_push INTEGER,
data TEXT,
timestamp INTEGER,
media_url TEXT,
media_mime_type TEXT,
media_wa_type TEXT,
media_size INTEGER,
media_name TEXT,
media_hash TEXT,
media_duration INTEGER,
origin INTEGER,
latitude REAL,
longitude REAL,
thumb_image TEXT,
remote_resource TEXT,
received_timestamp INTEGER,
send_timestamp INTEGER,
receipt_server_timestamp INTEGER,
receipt_device_timestamp INTEGER,
raw_data BLOB,
recipient_count INTEGER
)
So, there have a records for images, video, audio and etc. (they are stored on raw_data column)
Now, for every record I try to save to local directory on my pc, as follows:
First way:
Code:
File.WriteAllBytes(Path.Combine(directoryPath, msg.Media.MediaName)), msg.Media.RAW_DATA);
But I see, that it working only for image files, not for audio and video files..
Second way:
Code:
using (FileStream fs = new FileStream(Path.Combine(directoryPath, msg.Media.MediaName), FileMode.Create))
{
using (BinaryWriter writer = new BinaryWriter(fs))
{
writer.Write(msg.Media.RAW_DATA);
}
}
but I get same results
the audio and the video are not stored on the db?

Related

EXCLUDING SIM contacts from Contact list; Not just hiding them...

While using Faria's AKU3.3v2 rom and Molski's AKU3.3 rom, I noticed that SIM contacts are included in your contact list by default. It may have happened when I was running the AKU3.2 and WM6 roms too but don't really want to re-install them just to verify. I have tried posting in Faria's thread but nobody seems to have an answer yet so I decided to bring this to a broader audience.
The "ShowSIM" value DOES NOT solve this issue. As the name suggests, I'm guessing that it simply toggles the visibility property of SIM contacts but does not actually exclude them. Sorta like hidden files in Windows; It's there, you just can't see it.
From my experience, when a call is received, even though I have the ShowSIM value set to "0" (ie SIM contacts hidden), the phone number is still looked up in both the SIM and the Contact list. If the Entry Name is the same, it will use the Contact list profile. If the Entry Name is different, it will use the SIM profile.
Because of this setup, some of custom ringtones don't get triggered when I receive a call. I'm guessing custom photos (don't have this set up) will also not work properly.
Here's an example as to what I'm experiencing:
SIM Entry = John Doe 123 456 7890
Phone Entry = John Doe 123 456 7890 w/ Custom Ringtone
Display comes up as "John Doe"
Custom Ringtone will work
SIM Entry = John D 123 456 7890
Phone Entry = John Doe 123 456 7890 w/ Custom Ringtone
Display comes up as "John D"
Custom Ringtone will NOT work. Default Ringtone will sound.
I have done a ton of searching and can't seem to find a solution. The only workaround I've been able to come up with so far is to either delete the entry on the SIM or rename the Contact Name to match that of the SIM. Unfortunately, I don't find this to be a long term solution.
When I was still running the stock 2.25 Cingular ROM, all the ringtones worked fine. SIM contacts were excluded by default and would only be in your contact list if you use the "Copy to Contacts" option.
Is there a way to re-implement this feature or hide Sim contacts AND not include them in the Contacts List?

Serious WM Bug (sending phone numbers in text messages)

Hi.
I've been experiencing an annoying bug with Windows Mobile 6.1/6.5:
Whenever an incoming call was answered by my mailbox, a text message is send.
This is how it should more or less look like (translated from German):
Code:
From: Mailbox. You have 1 new message. To listen to your messages call 333.
The weird thing is that WM incorrectly matches the number with one of my contacts. I have a contact (let's name him Adam) with a number like +49176000333. Now all these mailbox notifications are incorrectly tagged as coming from Adam and the message reads
Code:
From: Mailbox. You have 1 new message. To listen to your messages call "Adam, h (+4917600033)".
Please notice: Whereas the message says "From Mailbox" (which is simply part of the text message) the actual sender is said to be Adam!
Why does WM incorrectly match this number (it looks as if any number ending with 333 is incorrectly matched)?
I've tried several things:
First, I created a 'Mailbox' contact with the number 333. Unfortunately this didn't do anything.
Second, I've sent myself text messages including different phone numbers, however I've never managed to get the same result as with the provider-messages above. If I merely send a single number like 333, it is displayed as simple text. If I include a '+' sign and the national prefix number +49333, it is displayed as link and if I click on it, a menu pops up "Verify the number is correct:...".
When I use the number of one of my contacts, the matching is done correctly, let's say I have a contact named Briand with the mobile number +491761234567, and I send myself the text message
Code:
call +491761234567
I get the message
Code:
call Brian, m (+491761234567)
However if I add a 'Mailbox' contact with either the number "+49333" or just "333", it doesn't match the name, I simply get
Code:
call +49333
where +49333 is a clickable link.
What I didn't manage to reproduce is the behavior of the provider messages where the contact matching is wrong (333 matching the number +49176000333 and also (and more important) the sender is incorrectly matched!).
This looks like a both annoying and also very serious WM bug, because this could be used to fake text messages!
Windows mobile does by itself (up to WM6 at least) no number-to-name match for incoming SMS in the SMS itself. There is a software called "intruders SMS fix" that may be in your cooked ROM which is doing this.
Mind that the SENDER of the SMS would be (correctly) matched in the address field of the messages list. It is the text inside the message that is treated as above.
If the Sender is correctly matched in the list, you can:
- either press the "green button" in the SMS list to call the sender
- or when the SMS is open (the sender is already highlighted) press enter to access its contacts record
Thanks for your reply.
tobbbie said:
Windows mobile does by itself (up to WM6 at least) no number-to-name match for incoming SMS in the SMS itself. There is a software called "intruders SMS fix" that may be in your cooked ROM which is doing this.
Click to expand...
Click to collapse
Well, I'm using 3VO's latest 6.5 ROM and this software is not listed. I had been using Rickywatt's 6.1 ROM before and had exactly the same problem.
Please notice, that it obviously matches 333 to ANY number ending with 333.
Is there any quick and easy way to get the source of a text message? So I could have a look at the provider messages. This problems reminds me of a typical flaw when comparing database entries with a 'LIKE' parameter.
I guess (just a guess), that the matching works like that:
Code:
input: number n from the text message
output: contact from address book
algorithm:
for each contact c in address book:
if c's number ends with n:
return c
return null
The reason for that matching is obviously that the matching should work, even if no country code or regional code is provided with the number.
Mind that the SENDER of the SMS would be (correctly) matched in the address field of the messages list. It is the text inside the message that is treated as above.
Click to expand...
Click to collapse
It SHOULD be like that, but with the above-mentioned provider messages, the SENDER is also matched incorrectly!
Simple but sad - seems like from WM6.1 onwards WM is doing this match by itself (consistently wrong). Try to search the more general fora at XDA to learn about number to name matching in Windows Mobile. Good luck

Different input format for the same phone numer are not matched to a contact

I got a minor but annoying problem running AOKP JellyBean that probably can be fixed easily and is just me being stupid:
The ROM is a bit daft when it comes to "intelligent" matching of phone numbers. In Germany (as, I believe, in most other countries), you can either use the national format to store a phone number, with an area code starting with "0", "040" for Hamburg, for example. Or you can store it with the international prefix, which replaces the leading zero (+49-40). Sadly, the way numbers are transmitted on incoming calls and text messages is inconsistent, which means that it's vital that the phone recognizes that 0800-330 1000 and +49-800-330 1000 refer to the same contact.
If I got a contact stored in the national format, with a leading "0", and a text comes in with the number transmitted with the +49 in front the MMS app, for example, does only match the contact correctly if you open the contact and select "new text message" (i.e. then the phone realizes that the "unknown number" thread it has belongs to the contact and displays it accordingly).
This is quite annoying. Can it be a result of an US SIM card being in the phone when I first installed AOKP and me now being back in Germany? I remember the phone automatically displaying numbers in the +1-AREA CODE-Number format and even resolving the area code, displaying to which city it refers while I was in the US.

[Q] Using the colon symbol as a separator inside an If, Then statement

I am having a difficult time formatting an If, Then statement with a time format output:
Code:
$#C0Shmm#<#DPmm#?#C1Sh:mm#$
Expected output: 3:30
Actual output: #C1Sh
The problem is with the or operator ":"
How can I use the colon symbol as a separator inside an If, Then statement?

Contacts appear twice if serach is done from Phone app

If a search contacts from CONTACTS APP, they all appear once in the resuls list.
If a search contacts from PHONE APP, some appear twice in the resuls list.
Se attachements:
- profile of ANTONIO from CONTACTS APP
- profile of DAVIDE from CONTACTS APP
I do not see differences in the two profiles 8besides email).
- 1 is the serach I get from CONTACTS APP: both appear only once
- 1 is the serach I get from PHONE APP: DAVIDE appars twice and please note how the same number in the two instances is typed differently (on one instance all numebrs are attached, on one instance they are grouped)
I will try to further explain the problem:
Pixel 2 XL with stock Android.
WhatsApp causes in Phone app a duplication problem for contacts with a mobile number stored with spaces.
Please note that the problem is:
- only in the Phone app and NOT in Contacts app
- only for mobile phone numbers
- only for numbers stored with spaces between groups of digits
- only if WhatsApp is installed and contacts sync is enabled
Please also note that Contacts app is automatically adding spaces between groups of digits when creating a new entry.
So, if in Contacts app I create a new entry named JOHN DOE with a mobile number as follows
+39 xxx yyy zzz (with spaces)
and I give time for WhatsApp sync to kick in, it will show up once when running a search in Contacts app, like follows
John Doe
Mobile +39 xxx yyy zzz (with spaces)
but twice when running a search in Phone app, like follows
John Doe
Mobile +39 xxx yyy zzz (with spaces)
John Doe
Mobile +39xxxyyyzzz (without spaces)
The first search result (with spaces) is from Contacts app, the second search result (without spaces) is from WhatsApp: it's as though Contacts app can do properly the merge but Phone app cannot.
If I edit the John Doe contact entry so that the mobile number has no spaces, so from
+39 xxx yyy zzz (with spaces)
to
+39xxxyyyzzz (without spaces)
the duplicated search result in Phone app disappear.
The following recording
https://drive.google.com/file/d/1psydzk44ifNe2gXwAJ0ofAYrbMbYO2hI/view?usp=drivesdk
shows how a contact stored as
+39 xxx yyy zzz (with spaces)
creates two search results from Phone app (one with spaces and one without spaces) while in Contacts app I still get only one search result.
The following recording
https://drive.google.com/file/d/1HtuAlE3DzhqL6dv81UXRTGk2UO7mDqHv/view?usp=drivesdk
shows that when editing the mobile number by removing spaces, the second search result in Phone app disappears.
It seems a combination of WhatsApp + Android stock because
- on my other Samsung and Huawei and Xiaomi phones, the duplication problem does not happen
- uninstalling WhatsApp, the duplication problem disappear

Categories

Resources