4
Copyright (c) 2007 by Charles Connell <charles@connells.org>
6
Kopete (c) 2007 by the Kopete developers <kopete-devel@kde.org>
8
*************************************************************************
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
15
*************************************************************************
20
#include "kopeteplugin.h"
23
#include <QDomDocument>
24
#include <QVariantList>
28
class SimpleMessageHandlerFactory;
33
* Core functions of Pipes plugin.
34
* @author Charles Connell <charles@connells.org>
37
class PipesPlugin : public Kopete::Plugin
43
* Used to indicate direction that a pipe is used for
45
enum PipeDirection { Inbound = 0x1, Outbound = 0x2, BothDirections = Inbound | Outbound };
48
* Used to indicate what should be outputted, and what the input should be interpreted as
50
enum PipeContents { HtmlBody = 0, PlainBody = 1, Xml = 2 };
53
* Stores everything we need to know about a pipe
61
PipeDirection direction;
62
PipeContents pipeContents;
64
typedef QList<PipeOptions> PipeOptionsList;
67
static PipesPlugin* plugin();
69
PipesPlugin ( QObject *parent, const QVariantList &args );
74
* Grab incoming message, call doPiping for each
77
void slotIncomingMessage ( Kopete::Message & );
80
* Grab outgoing message, call doPiping for each
83
void slotOutgoingMessage ( Kopete::Message & );
87
* Fork process, push appropriate output to it,
88
* then read it's output and appropriately put it
89
* back in the message.
91
static void doPiping ( Kopete::Message &, PipeOptions );
94
* Turn a Message into a QDomDocument, return that XML.
95
* Info for the XML is pulled from all over Kopete.
97
static QByteArray createXml ( const Kopete::Message & );
100
* Take a QByteArray containing XML, take pertinent info from
101
* that, and put it in the Message.
103
static void readXml ( PipeOptions, Kopete::Message &, const QByteArray & );
106
static PipesPlugin* mPluginStatic;
107
PipeOptionsList mPipesList;
108
Kopete::SimpleMessageHandlerFactory * mInboundHandler;
112
Q_DECLARE_METATYPE ( PipesPlugin::PipeDirection )
113
Q_DECLARE_METATYPE ( PipesPlugin::PipeContents )