Hi,
I was using Kopetex ( Latex extension ) and when I send a Latex formula, 
Kopetex just sends to the other client the text just like I typed, for example: 
$$ x $$. I would really like if it could export the image like if it were a 
hand written message, so I tried to add the functionality by myself and this is 
what I get to:

It seems an Ink message is just a gif image, and the message sent to the server 
is something like:

MSG 66 N 1234
MIME-Version: 1.0
Content-Type: image/gif

base64:The GIF Image

I've also found a different way to do the same thing:

MSG [EMAIL PROTECTED] 1349
MIME-Version: 1.0
Content-Type: application/x-msnmsgrp2p
P2P-Dest: [EMAIL PROTECTED]

@...p.s.........................................M.I.M.E.-.V.e.r.s.i.o.n.:. 
.1...0.
.
.C.o.n.t.e.n.t.-.T.y.p.e.:. .i.m.a.g.e./.g.i.f.
.
.
.
...b.a.s.e.6.4.:.R.0.l.G.O.D.l.h.5.g.A.2.A.P.c.A.A.A.A.A.A.I.A.A.A.A.C.A.A.I.C.A.A.A.A.A.g.I.A.A.g.A.C.A.g.I.C.A.g.M.D.A.w.P.8.A.A.A.D./.A.P././.A.A.A.A././.8.A./.w.D././././././.w.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.M.w.A.A.Z.g.A.A.m.Q.A.A.z.A.A.A./.w.A.z.A.A.A.z.M.w.A.z.Z.g.A.z.m.Q.A.z.z.A.A.z./.w.B.m.A.A.B.m.M.w.B.m.Z.g.B.m.m.Q.B.m.z.A.B.m./.w.C.Z.A.A.C.Z.M.w.C.Z.Z.g.C.Z.m.Q.C.Z.z.A.C.Z./.w.D
.M.A.A.D.M.M.w.D.M.Z.g.D.M.m.Q.D.M.z.A.D.M./.w.D./.A.A.D./.M.w.D./.Z.g.D./.m.Q.D./.z.A.D././.z.M.A.A.D.M.A.M.z.M.A.Z.j.M.A.m.T.M.A.z.D.M.A./.z.M.z.A.D.M.z.M.z.M.z.Z.j.M.z.m.T.M.z.z.D.M.z./.z.N.m.A.D.N.m.M.z.N.m.Z.j.N.m.m.T.N.m.z.D.N.m./.z.O.Z.A.D.O.Z.M.z.O.Z.Z.j.O.Z.m.T.O.Z.z.D.O.Z./.z.P.M.A.D.P.M.M.z.P.M.Z.j.P.M.m.T.P.M.z.D.P.M./.z.P./.A.D.P./.M.z.P./.Z.j.P./.m.T.P./.z.D.P././.2.Y.A.A.G.Y.A.M.2.Y.A.Z.m.Y.A.m.W.Y.A.z.G.Y
.A./.2.Y.z.A.G.Y.z.M.2.Y.z.Z.m.Y.z.m.W.Y.z.z.G.Y.z./.2.Z.m.A.G.Z.m.M.2.Z.m.Z.m.Z.m.m.W.Z.m.z.G.Z.m./.2.a.Z.A.G.a.Z.M.2.a.....


encoded in UTF-16. I don't know what the "@ps" stands for.

So, I modified msnswitchboardsocket.cpp: MSnSwitchBoardSocket::sendMsg (... ) 
to something like this:

if( msg.format() & Kopete::Message::RichText )
    {
        QRegExp regex("^\\s*<img src=\"([^>\"]+)\"[^>]*>\\s*$");
        if(regex.search(msg.escapedBody()) != -1)
        {
            QFile imageFile ( regex.cap(1) );
            if ( imageFile.exists() && imageFile.name().endsWith( "GIF", false 
) )
            {
                imageFile.open ( IO_ReadOnly );
                QByteArray ba = imageFile.readAll ();
                imageFile.close ();
                
                message = QString::fromLatin1("base64:%1").arg( 
KCodecs::base64Encode( ba ) );
                inkSend = true;
            }
        }
    }

so it can handle GIF files, after that I modified a little the Latex extension 
to make it use the GIF format. I also had to modify the bash script ( 
kopetex_latexconver.sh ) because it was generating transparent images and the 
official MSN client was not displaying them properly.
Off course these patches are ugly, they are not intended to be real code in 
Kopete, I'm just trying to make this work, and maybe after that I could release 
a real patch ( off course, only if you want, because I can imagine you must be 
focusing on QT & KDE 4 ).
Now, here comes my problem, the image is sent to the other client without 
problems and my friends can see my Latex formulae, however, I can't see my own 
Latex formulae. The information I gathered is this:

When I send a message:
1. The function aboutToSend() ( Latex plugin ) is called and the message is 
modified to include the proper <img src="..." />
2. The function aboutToShow() ( Latex plugin ) is called and the message is 
modified to include the proper <img src="..." /> only if necessary ( because a 
message sent by me was already modified on step 1, so this modification is only 
for incoming messages ).
3. The function sendMsg() ( MSN Protocol ) is called and the message is 
converted to an Ink draw gif image.

But the problem is this: My modified messages in step 1 don't get to step 2, 
the message I get in aboutToShow() is just an empty string, and that is surely 
the explanation to the problem ( not showing up on screen ).

Please, could anyone give me some indications about this, because I'm totally 
lost on this one, I don't get why Kopete keeps sending me an emtpy message.

Thank you very much to all of you !!!

P.S: I'm sorry if this mail doesn't belong here, is just I know nothing about 
this mailing list, I just registered myself the other day.
P.S2: Sorry for my english, and if anyone wants to talk me in spanish :D
P.S3: The patch is against Kdenetwork 3.5.7. To apply the patch just go to the 
directory where your kdenetwork 3.5.7 source is located and type: patch -p1 < 
parche

---
Ezequiel R. Aguerre




      __________________________________________________ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 

Attachment: parche
Description: Binary data

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

Reply via email to