summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/oscar/liboscar/flapprotocol.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/protocols/oscar/liboscar/flapprotocol.cpp
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/oscar/liboscar/flapprotocol.cpp')
-rw-r--r--kopete/protocols/oscar/liboscar/flapprotocol.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/kopete/protocols/oscar/liboscar/flapprotocol.cpp b/kopete/protocols/oscar/liboscar/flapprotocol.cpp
new file mode 100644
index 00000000..c5dc04ed
--- /dev/null
+++ b/kopete/protocols/oscar/liboscar/flapprotocol.cpp
@@ -0,0 +1,72 @@
+/*
+ Kopete Oscar Protocol
+ flapprotocol.cpp - reads the protocol used by Oscar for signaling stuff
+
+ Copyright (c) 2004 Matt Rogers <mattr@kde.org>
+ Based on code copyright (c) 2004 SUSE Linux AG <http://www.suse.com>
+
+ Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
+
+ *************************************************************************
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ *************************************************************************
+*/
+
+#include "flapprotocol.h"
+
+#include <qcstring.h>
+#include <qdatastream.h>
+#include <qobject.h>
+#include <kdebug.h>
+
+#include "transfer.h"
+
+using namespace Oscar;
+
+FlapProtocol::FlapProtocol(QObject *parent, const char *name)
+ : InputProtocolBase(parent, name)
+{
+}
+
+FlapProtocol::~FlapProtocol()
+{
+}
+
+Transfer* FlapProtocol::parse( const QByteArray & packet, uint& bytes )
+{
+ QDataStream* m_din = new QDataStream( packet, IO_ReadOnly );
+
+ BYTE b;
+ WORD w;
+
+ FLAP f;
+ *m_din >> b; //this should be the start byte
+ *m_din >> b;
+ f.channel = b;
+ *m_din >> w;
+ f.sequence = w;
+ *m_din >> w;
+ f.length = w;
+
+ kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "channel: " << f.channel
+ << " sequence: " << f.sequence << " length: " << f.length << endl;
+ //use pointer arithmatic to skip the flap and snac headers
+ //so we don't have to do double parsing in the tasks
+ char* charPacket = packet.data();
+ char* snacData = charPacket + 6;
+ Buffer *snacBuffer = new Buffer( snacData, f.length );
+
+ FlapTransfer* ft = new FlapTransfer( f, snacBuffer );
+ bytes = snacBuffer->length() + 6;
+ delete m_din;
+ m_din = 0;
+ return ft;
+}
+
+
+#include "flapprotocol.moc"