On Thursday 18 June 2015 20:21:42 Joshua Joseph wrote:
> On Thu, Jun 18, 2015 at 8:59 PM, Pali Rohár <pali.ro...@gmail.com>
> wrote:
> > > I intended for the account field to be protocol
> > > dependant, as you had said earlier, so that jabber can store full
> > > JID.
> > 
> > But then you cannot show history! You will get
> > Kopete::Acount::accountId and you cannot match anything in
> > database against accountId if you store protocol dependent string
> > into database... This is no go way.
> > 
> > You will select Kopete::Contact object, from it you will ask for
> > contactId() and this information you will use for searching for
> > history messages in database. If you do not store contactId() into
> > database how other you want to search for history which belongs to
> > particular Kopete::Contact object?
> 
> I get it now.
> 
> We will have to store the contactId() also. I will need to get good
> column names
> to avoid confusion with the foreign key columns.
> 

See my yesterday email where I proposed to store pluginId() as protocol, 
accounId() as account, contactId() as contact and from/to values to be 
protocol dependent.

And another question: Do we need to separate table for group chat 
messages? Cannot we use some chat session identifier for each message?

If for each message we store these data:

protocol independent:

* protocol - Kopete::Protocol::pluginId() - not null
* account - Kopete::Protocol::accoundId() - not null
* direction - Kopete::Message::direction() - not null
* contact - Kopete::Protocol::contactId()

protocol dependent (all strings):

* session - session identifier
* session_name - human readable name of session
* from - from contact identifier
* from_name - human readable from contact name
* to - to contact identifier
* to_name - human readable to contact name

then I think it it should work for both single user and multi user chat.
In this case either "contact" or "session" needs to be provided to will 
be able to know to which "view" message belongs. "contact" can be used 
for single user chat (there is no problem) and room based multi user 
chat. And session (unique string identifier) can be used for multi user 
chats without rooms (e.g. Skype-like).

Columns from/to can be used to store protocol dependent information 
about sender/receiver (e.g full JID for jabber) or full of contacts in 
multi user chat...

Do not remember that messages are changing their state! StateSending 
will be later changed to StateSent or StateError. The only way how to 
track this information is Kopete::Message::id() function. But id is 
unique only for one running kopete instance (not after quit and start!). 
So this information cannot be stored into database, but is it needed to 
track number of message row in table (which is unique) with in-memory 
Kopete::Message::id().

-- 
Pali Rohár
pali.ro...@gmail.com

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to