<div dir="ltr"><div><div><div><div><div><div><div><div>Hi,<br><br>I've been working on a <a href="http://quickgit.kde.org/?p=scratch/kamath/telepathy-pintxo.git">connection manager for SMS messaging</a> through ModemManager as a GSoC project. By now the CM allows you to send and receive messages.<br>
<br></div><div>We're looking to have a discussion and reach a consensus on how to implement a part of the CM, basically how received SMS messages should be handled, given the slightly unusual nature of SMS messaging as against regular IM messaging.<br>
</div><div><br>So how it works is,<br></div></div>All received SMS messages are stored on the SIM card/modem.<br></div><div>When the modem receives a message while I'm connected, it emits a signal and we add it as a recieved message in Tp.<br>
<br></div>If someone sends me a message when my modem is disconnected, the message actually 'reaches' the modem only after it goes online.<br>So the modem (ModemManager) emits 'new message received' signals for all such messages right after the modem goes online.<br>
<br></div>Currently what the CM does is that all SMS messages are fetched from the SIM/Modem store upon the account going online,  marked as scrollback, and added as received messages.  And any new messages received via signals are subsequently added/displayed.<br>
<br></div>The rationale behind fetching all messages from the modem store everytime upon (the account) going online is :<br></div>1) To make the interface similar to (smart)phones wherein I can typically always see the  entire message threads between me and contacts. (Unlike say, FB or google chat where previous conversation history is not displayed in text-ui).<br>
2) To ensure the CM always keeps track of all the messages, which is not possible by watching for the new message signals alone. For example, if the modem is plugged and connected to a 
different computer, or the SIM is switched between the modem and a 
phone, I might miss new messages if the CM don't scan all messages while connecting.<br><br></div><div></div>But this has the following problem:<br></div><div>Even though these messages fetched at connection time are marked as scrollback, KTp emits a notification (New message received..) even though these messages are just my old messages.<br>
<br></div><div>Even if we fix ktp to stop it from notifying us of scrollback messages (and just notify us of the genuinely new messages received): There's another problem. If there is a delay between the modem going online and the Tp account going online, we miss the signals for the new messages and instead they too get marked as scrollback. So we end up losing notifications for new messages received in this duration (between the modem and the Tp account going online).<br>
<br></div><div>The alternative I see is to have some sort of message 'sync' routine when the modem goes online:<br></div><div>1)Scan all messages from the modem store when the account goes online.<br></div><div>2)Check if there are any new messages which are not there in the logger. Except for these 'new' messages, mark all others as scrollback (and we still need the fix to prevent notifications for scrollback messages).<br>
</div><div>3)Listen for signals for newer messages as usual.<br><br></div><div>This is all assuming that we agree that displaying the entire message thread (history) in text-ui for SMS messages is the right way to go.<br>
Is there a better alternative?<br></div><div><br></div><div>--<br></div><div>Anant<br></div></div>