wwwjfy/MeegoSMSBackupRestore

groupId is somehow not set when no sms exist

teleshoes opened this issue · 15 comments

everytime i do "delete all messages", then smsbackuprestore import f, i get this:

About to commit the changes
virtual bool CommHistory::EventModelPrivate::doAddEvent(CommHis tory::Event&) Group id not set
Error adding events

if i send a message or a receive a message first, it works great.

Interesting as I tried both ways, delete all messages first or not.

Though maybe not related, could you paste a sample csv file here?

I add some debug logs in http://wwwjfy.net/tmp/smsbackuprestore
could you give a try?

deleted all messages, received a message, backed it up with smsbackuprestore, deleted all messages, imported with smsbackuprestore

{number changed in the message and in the logs, otherwise the same}

+15555555555,1,2012-03-22 00:41:50,"msg"

Handling 1 messages
phone number not cached
"GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.352" (uid=29999 pid=24809 comm="./smsbackuprestore import MyDocs/backup-sms/2012_0") interface="org.freedesktop.Tracker1.Steroids" member="Query" error name="(unset)" requested_reply=0 destination="org.freedesktop.Tracker1" (uid=29999 pid=1296 comm="/usr/lib/tracker/tracker-store "))"
QTrackerDirectSelectResult: QSparqlError(9, "GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.352" (uid=29999 pid=24809 comm="./smsbackuprestore import MyDocs/backup-sms/2012_0") interface="org.freedesktop.Tracker1.Steroids" member="Query" error name="(unset)" requested_reply=0 destination="org.freedesktop.Tracker1" (uid=29999 pid=1296 comm="/usr/lib/tracker/tracker-store "))", 4) "SELECT ?channel nie:subject(?channel) nie:generator(?channel) nie:identifier(?channel) nie:title(?channel) ?_lastDate ( SELECT COUNT(?_total_messages_1) WHERE { ?_total_messages_1 nmo:communicationChannel ?channel . ?_total_messages_1 nmo:isDeleted false . }) ( SELECT COUNT(?_total_unread_messages_1) WHERE { ?_total_unread_messages_1 nmo:communicationChannel ?channel . ?_total_unread_messages_1 nmo:isRead false . ?_total_unread_messages_1 nmo:isDeleted false . }) ( SELECT COUNT(?_total_sent_messages_1) WHERE { ?_total_sent_messages_1 nmo:communicationChannel ?channel . ?_total_sent_messages_1 nmo:isSent true . ?_total_sent_messages_1 nmo:isDeleted false . }) ?_lastMessage (SELECT GROUP_CONCAT( fn:concat(tracker:id(?contact), "\u001e", tracker:coalesce(nco:nameGiven(?contact), ""), "\u001e", tracker:coalesce(nco:nameFamily(?contact), ""), "\u001d", tracker:coalesce(nco:nickname(?contact), ""), "\u001d", tracker:coalesce(?nicknames, "")), "\u001c") WHERE { SELECT ?contact (SELECT GROUP_CONCAT(fn:string-join((nco:imID(?addr), ?nickname), "\u001f"), "\u001e") WHERE { ?contact nco:hasAffiliation [ nco:hasIMAddress ?addr ] . ?addr nco:imNickname ?nickname . }) AS ?nicknames WHERE { { ?part nco:hasIMAddress ?address . ?contact nco:hasAffiliation [ nco:hasIMAddress ?address ] . } UNION { ?part nco:hasPhoneNumber [ maemo:localPhoneNumber ?number ] . ?contact nco:hasAffiliation [ nco:hasPhoneNumber [ maemo:localPhoneNumber ?number ] ] . }} }) AS ?contacts rdf:nil fn:string-join((nmo:messageSubject(?_lastMessage),nie:plainTextContent(?_lastMessage)),"\u001e") nfo:fileName(nmo:fromVCard(?_lastMessage)) rdfs:label(nmo:fromVCard(?_lastMessage)) rdf:type(?_lastMessage) AS ?_type nmo:deliveryStatus(?_lastMessage) AS ?_deliveryStatus ?_lastModified nmo:sentDate(?_lastMessage)WHERE { { SELECT ?channel ?_lastDate ?_lastModified ?part ( SELECT ?_message WHERE { ?_message nmo:communicationChannel ?channel . ?_message nmo:isDeleted false . ?_message nmo:sentDate ?messageSentDate . } ORDER BY DESC(?messageSentDate) DESC(tracker:id(?_message)) LIMIT 1) AS ?_lastMessage WHERE { GRAPH commhistory:message-channels { ?channel a nmo:CommunicationChannel . } ?channel nmo:lastMessageDate ?_lastDate . ?channel nie:contentLastModified ?_lastModified . ?channel nmo:hasParticipant ?part . ?channel nmo:hasParticipant [nco:hasPhoneNumber [maemo:localPhoneNumber "5555555"]] . FILTER(nie:subject(?channel) = "/org/freedesktop/Telepathy/Account/ring/tel/ring") } }}ORDER BY DESC(?_lastDate)"
Create a new group: 74
Used group id is 74
Handled 1 messages
About to commit the changes
QTrackerDirectUpdateResult: QSparqlError(-1, "", 0) "INSERT OR REPLACE { GRAPH commhistory:message-channels { conversation:74 a nmo:CommunicationChannel } conversation:74 nie:subject "/org/freedesktop/Telepathy/Account/ring/tel/ring" ; nie:identifier "0" ; nie:title "" ; nie:generator "+15555555555" ; nmo:lastMessageDate "1970-01-01T00:00:00Z"^^xsd:dateTime ; nie:contentLastModified "2012-03-22T15:09:53Z"^^xsd:dateTime . } INSERT SILENT { urn:x-maemo-phone:+15555555555 a nco:PhoneNumber ; nco:phoneNumber "+15555555555" ; maemo:localPhoneNumber "5555555" . } INSERT { conversation:74 nmo:hasParticipant [ a nco:Contact ; nco:hasPhoneNumber urn:x-maemo-phone:+15555555555 ] } "
void CommHistory::CommittingTransactionPrivate::finished() "GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.352" (uid=29999 pid=24809 comm="./smsbackuprestore import MyDocs/backup-sms/2012_0") interface="org.freedesktop.Tracker1.Steroids" member="Update" error name="(unset)" requested_reply=0 destination="org.freedesktop.Tracker1" (uid=29999 pid=1296 comm="/usr/lib/tracker/tracker-store "))"
QTrackerDirectUpdateResult: QSparqlError(-1, "", 0) "DELETE {conversation:74 nmo:lastMessageDate ?d} WHERE {conversation:74 nmo:lastMessageDate ?d OPTIONAL{SELECT ?lastMessage { ?lastMessage nmo:communicationChannel conversation:74} ORDER BY DESC(nmo:sentDate(?lastMessage)) DESC(tracker:id(?lastMessage)) LIMIT 1} FILTER(!bound(?lastMessage) || nmo:sentDate(?lastMessage) < "2012-03-22T04:41:50Z"^^xsd:dateTime)} DELETE { conversation:74 nmo:hasParticipant ?_0 } WHERE { conversation:74 nmo:hasParticipant ?_0 } INSERT SILENT { conversation:74 nmo:lastMessageDate "2012-03-22T04:41:50Z"^^xsd:dateTime . } INSERT OR REPLACE { conversation:74 nie:contentLastModified "2012-03-22T04:41:50Z"^^xsd:dateTime ; nie:generator "+15555555555" . http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#predefined-phone-msg-folder-inbox nie:contentLastModified "2012-03-22T15:09:53Z"^^xsd:dateTime . message:1762 rdf:type nmo:SMSMessage ; nie:plainTextContent "msg" ; nmo:messageId "{50e5a235-5736-43f2-a677-92921699d056}" ; nmo:sentDate "2012-03-22T04:41:50Z"^^xsd:dateTime ; nmo:receivedDate "2012-03-22T04:41:50Z"^^xsd:dateTime ; nmo:isSent false ; nmo:isDraft false ; nmo:isRead true ; nmo:deliveryStatus http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#delivery-status-delivered ; nie:contentSize "0"^^xsd:int ; nmo:isDeleted false ; nmo:phoneMessageId "4098"^^xsd:int ; nmo:to [rdf:type nco:Contact; nco:hasIMAddress telepathy:/org/freedesktop/Telepathy/Account/ring/tel/ring] ; rdf:type nie:DataObject ; nmo:communicationChannel conversation:74 ; nie:contentLastModified "2012-03-22T15:09:53Z"^^xsd:dateTime . } INSERT SILENT { urn:x-maemo-phone:+15555555555 a nco:PhoneNumber ; nco:phoneNumber "+15555555555" ; maemo:localPhoneNumber "5555555" . } INSERT { message:1762 nmo:from [ a nco:Contact ; nco:hasPhoneNumber urn:x-maemo-phone:+15555555555 ] } INSERT { conversation:74 nmo:hasParticipant [ a nco:Contact ; nco:hasPhoneNumber urn:x-maemo-phone:+15555555555 ] } "
void CommHistory::CommittingTransactionPrivate::finished() "GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.352" (uid=29999 pid=24809 comm="./smsbackuprestore import MyDocs/backup-sms/2012_0") interface="org.freedesktop.Tracker1.Steroids" member="Update" error name="(unset)" requested_reply=0 destination="org.freedesktop.Tracker1" (uid=29999 pid=1296 comm="/usr/lib/tracker/tracker-store "))"

actually, the bin you sent ALWAYS produces that error. its apparently unrelated to the problem.

more information: this appears to be the case with just one specific contact, and i can delete their contact card without altering the problem. unknown people with made up phone numbers show up fine, but unknown people with the number causing the problem get the same no group id error.

do you mean no error produced in the previous bin but only this one? I only added some debug lines, as you see, like "phone number not cached". and I didn't see group id not set in the logs.

it's better that you can get more specific for the phone number things. if I understand correctly, THE number whether w/ or w/o contact card will cause it.
I'm not sure if this helps: http://wiki.meego.com/Architecture/Documentation/PIM/Contacts_Engine#User_Data.2C_Configurability
some place use 7 as numberMatchLength, and here in China, it's 11

md5sum of the bin i have installed:
d4983cfb8341d5edec8f4a2932f97e39

md5sum of the bin you posted:
2aaa3d78e5a1431e74fb5a17d3640792

the bin you asked me to try always fails with the error you see above. the bin i have installed works for every number, but fails with a group error for a certain number.

the number length does not seem to be the trouble; if i use +15554445555 or 5554445555 or 4445555, it figures out who i mean, and fails {or succeeds if she already has a message}.

I haven't got the phone on hand so I didn't test the posted bin on a real device. I apologies for that.
I added lines like 'std::cout << "Use existing group: " << groupId << std::endl;' or without groupId, so in theory, it should not affect the functionality. We can ignore the problem though, as it's a corner thing.

I want to make sure that if the problem is about the phone number. so as I understand, if you replace the number with something else, it'll work, right? if so, that'll be unfortunate, I need to dig a bit deep for that.

Could you also try commhistory-tool, coming with libcommhistory, http://wwwjfy.net/tmp/commhistory-tool
and try to use it to add SMS with same number (text is generated randomly)
using like
./commhistory-tool add -newgroup -startTime xxx -sms -in /org/freedesktop/Telepathy/Account/ring/tel/ring 1555555

$ /root/commhistory-tool add -newgroup -startTime 20120322:10:30 -sms -in /org/freedesktop/Telepathy/Account/ring/
tel/ring 5555555555
Added group 95
.
.
.
.
.
QTrackerDirectUpdateResult: QSparqlError(-1, "", 0) "INSERT OR REPLACE { GRAPH commhistory:message-channels { conversation:95 a nmo:CommunicationChannel } conversation:95 nie:subject "/org/freedesktop/Telepathy/Account/ring/tel/ring" ; nie:identifier "0" ; nie:title "" ; nie:generator "5555555555" ; nmo:lastMessageDate "1970-01-01T00:00:00Z"^^xsd:dateTime ; nie:contentLastModified "2012-03-22T17:14:13Z"^^xsd:dateTime . } INSERT SILENT { urn:x-maemo-phone:5555555555 a nco:PhoneNumber ; nco:phoneNumber "5555555555" ; maemo:localPhoneNumber "5555555" . } INSERT { conversation:95 nmo:hasParticipant [ a nco:Contact ; nco:hasPhoneNumber urn:x-maemo-phone:5555555555 ] } "
void CommHistory::CommittingTransactionPrivate::finished() "GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.435" (uid=29999 pid=27153 comm="./commhistory-tool add -newgroup -startTime 201203") interface="org.freedesktop.Tracker1.Steroids" member="Update" error name="(unset)" requested_reply=0 destination="org.freedesktop.Tracker1" (uid=29999 pid=1296 comm="/usr/lib/tracker/tracker-store "))"
.
.
.
QTrackerDirectUpdateResult: QSparqlError(-1, "", 0) "DELETE {conversation:95 nmo:lastMessageDate ?d} WHERE {conversation:95 nmo:lastMessageDate ?d OPTIONAL{SELECT ?lastMessage { ?lastMessage nmo:communicationChannel conversation:95} ORDER BY DESC(nmo:sentDate(?lastMessage)) DESC(tracker:id(?lastMessage)) LIMIT 1} FILTER(!bound(?lastMessage) || nmo:sentDate(?lastMessage) < "2012-03-22T14:30:00Z"^^xsd:dateTime)} DELETE { conversation:95 nmo:hasParticipant ?_0 } WHERE { conversation:95 nmo:hasParticipant ?_0 } INSERT SILENT { conversation:95 nmo:lastMessageDate "2012-03-22T14:30:00Z"^^xsd:dateTime . } INSERT OR REPLACE { conversation:95 nie:contentLastModified "2012-03-22T14:30:00Z"^^xsd:dateTime ; nie:generator "5555555555" . http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#predefined-phone-msg-folder-inbox nie:contentLastModified "2012-03-22T17:14:13Z"^^xsd:dateTime . message:1784 rdf:type nmo:SMSMessage ; nie:plainTextContent "Alussa olivat suo, kuokka ja Jussi." ; nmo:messageId "{73a7e450-58f5-4362-a3bf-252ade452a54}" ; nmo:sentDate "2012-03-22T14:30:00Z"^^xsd:dateTime ; nmo:receivedDate "2012-03-22T14:30:00Z"^^xsd:dateTime ; nmo:isSent false ; nmo:isDraft false ; nmo:isRead false ; nie:contentSize "946"^^xsd:int ; nmo:isDeleted false ; nmo:phoneMessageId "4098"^^xsd:int ; nmo:to [rdf:type nco:Contact; nco:hasIMAddress telepathy:/org/freedesktop/Telepathy/Account/ring/tel/ring] ; rdf:type nie:DataObject ; nmo:communicationChannel conversation:95 ; nie:contentLastModified "2012-03-22T17:14:13Z"^^xsd:dateTime . } INSERT SILENT { urn:x-maemo-phone:5555555555 a nco:PhoneNumber ; nco:phoneNumber "5555555555" ; maemo:localPhoneNumber "5555555" . } INSERT { message:1784 nmo:from [ a nco:Contact ; nco:hasPhoneNumber urn:x-maemo-phone:5555555555 ] } INSERT { conversation:95 nmo:hasParticipant [ a nco:Contact ; nco:hasPhoneNumber urn:x-maemo-phone:5555555555 ] } "
void CommHistory::CommittingTransactionPrivate::finished() "GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.435" (uid=29999 pid=27153 comm="./commhistory-tool add -newgroup -startTime 201203") interface="org.freedesktop.Tracker1.Steroids" member="Update" error name="(unset)" requested_reply=0 destination="org.freedesktop.Tracker1" (uid=29999 pid=1296 comm="/usr/lib/tracker/tracker-store "))"
void Catcher::eventsCommittedSlot(QListCommHistory::Event, bool)

i cant get the libcommhistory tool to add any SMSes though.

I found out the "GDBus.Error:org.freedesktop.DBus.Error.AccessDenied" error is caused by running the program using root user. Please switch to developer and try again

confirmed that i dont get the above error when running as developer, and i always get it running as root or user.

its weird, though; it works perfectly as root or user for version 0.2 in the deb; only the one with the debug prints thrown in fails as user/root.

also, note that su doesnt preserve $HOME; maybe you should hardcode the location of commhistory to "/home/user/.commhistoryd" {since this is a single-user operating system.}

otherwise, if you run it as root or developer, you have to set HOME explicitly.

i cant reproduce it anymore...neither with 0.2, 0.1, or the debug one you sent.
since no one can now repro, ill close it until i can.

the .commhistoryd is not necessary. that message is only a warning. Anyway, I think the utility should be run as a user who wants to do something to the SMSs, so I won't fix that

k, cool