importing kopete logs

Alin M Elena alinm.elena at gmail.com
Tue Mar 20 21:17:22 UTC 2012


Hi,

I did a small start on importing kopete logs to tp-logger... for one to one chats... 

for each account
kopete keeps the log in a file per contact per month in a xml document
tp logger keeps it in a folder per contact a file per day in a xml document....

for kopete the structure of the file seems to be simple
a header containing year and month plus the actors in the chat...

then each message
 <msg nick="Me Me" in="0" from="me.me at gmail.com" time="31 23:58:37">there are fireworks for a few days here now</msg>
 <msg nick="He He" in="1" from="he.he at gmail.com" time="31 23:58:49">barbarians</msg>

from header we can extract the year and month from the message we can extract the day -- first element in the time attribute
from header one can easily obtain the contact with whom we spoke as the second contact.
  <contact contactId="me.me at gmail.com" type="myself"/>
  <contact contactId="he.he at gmail.com"/>

with this info we can easily recreate the structure for tp-logger

the tp-logger structure of the xml... dtd specification and a root node log with messages as children
the structure is like this 
<message time="20111031T23:59:40" id="me.me at gmail.com" name="Me Me" token="" issuer="True" type="normal" message-token="">i discovered something that makes a lot of sense but never thought about it</message>

the time attribute is trickier but we have all the info to recreate it, id, name are easily mapped to from and nick from kopete, issuer to in, type, message-token 
and token are attributes which are not stored by kopete... for type I assumed normal, for the remaining I assumed empty...


of course I added a proof of concept python script using python-lxml a silly log file... and its output
usage ./log2log.py <kopeteLogFile>

Alin







-- 
Without Questions there are no Answers!
______________________________________________________________________
Alin Marin ELENA
Advanced Molecular Simulation Research Laboratory
School of Physics, University College Dublin
----
Ardionsamblú Móilíneach Saotharlann Taighde
Scoil na Fisice, An Coláiste Ollscoile, Baile Átha Cliath
 
-----------------------------------------------------------------------------------
http://alin.elenaworld.net
______________________________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: log2log.py
Type: text/x-python
Size: 1862 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-telepathy/attachments/20120320/1493bce5/attachment-0001.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kopete.xml
Type: application/xml
Size: 1180 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-telepathy/attachments/20120320/1493bce5/attachment-0001.wsdl>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: he.he at gmail.com.zip
Type: application/zip
Size: 1372 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-telepathy/attachments/20120320/1493bce5/attachment-0001.zip>


More information about the KDE-Telepathy mailing list