|
|
|
/*
|
|
|
|
testbedcontact.h - Kopete Testbed Protocol
|
|
|
|
|
|
|
|
Copyright (c) 2003 by Will Stephenson <will@stevello.free-online.co.uk>
|
|
|
|
Kopete (c) 2002-2003 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 General Public *
|
|
|
|
* License as published by the Free Software Foundation; either *
|
|
|
|
* version 2 of the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
*************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TESTBEDCONTACT_H
|
|
|
|
#define TESTBEDCONTACT_H
|
|
|
|
|
|
|
|
#include <tqmap.h>
|
|
|
|
#include "kopetecontact.h"
|
|
|
|
#include "kopetemessage.h"
|
|
|
|
|
|
|
|
class TDEAction;
|
|
|
|
class TDEActionCollection;
|
|
|
|
namespace Kopete { class Account; }
|
|
|
|
namespace Kopete { class ChatSession; }
|
|
|
|
namespace Kopete { class MetaContact; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
@author Will Stephenson
|
|
|
|
*/
|
|
|
|
class TestbedContact : public Kopete::Contact
|
|
|
|
{
|
|
|
|
TQ_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* The range of possible contact types
|
|
|
|
*/
|
|
|
|
enum TestbedContactType { Null, Echo };
|
|
|
|
|
|
|
|
TestbedContact( Kopete::Account* _account, const TQString &uniqueName,
|
|
|
|
const TestbedContact::TestbedContactType type, const TQString &displayName,
|
|
|
|
Kopete::MetaContact *parent );
|
|
|
|
|
|
|
|
~TestbedContact();
|
|
|
|
|
|
|
|
virtual bool isReachable();
|
|
|
|
/**
|
|
|
|
* Serialize the contact's data into a key-value map
|
|
|
|
* suitable for writing to a file
|
|
|
|
*/
|
|
|
|
virtual void serialize(TQMap< TQString, TQString >& serializedData,
|
|
|
|
TQMap< TQString, TQString >& addressBookData);
|
|
|
|
/**
|
|
|
|
* Return the actions for this contact
|
|
|
|
*/
|
|
|
|
virtual TQPtrList<TDEAction> *customContextMenuActions();
|
|
|
|
/**
|
|
|
|
* Returns a Kopete::ChatSession associated with this contact
|
|
|
|
*/
|
|
|
|
virtual Kopete::ChatSession *manager( CanCreateFlags canCreate = CannotCreate );
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
/**
|
|
|
|
* Transmits an outgoing message to the server
|
|
|
|
* Called when the chat window send button has been pressed
|
|
|
|
* (in response to the relevant Kopete::ChatSession signal)
|
|
|
|
*/
|
|
|
|
void sendMessage( Kopete::Message &message );
|
|
|
|
/**
|
|
|
|
* Called when an incoming message arrived
|
|
|
|
* This displays it in the chatwindow
|
|
|
|
*/
|
|
|
|
void receivedMessage( const TQString &message );
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
/**
|
|
|
|
* Show the settings dialog
|
|
|
|
*/
|
|
|
|
void showContactSettings();
|
|
|
|
/**
|
|
|
|
* Notify the contact that its current Kopete::ChatSession was
|
|
|
|
* destroyed - probably by the chatwindow being closed
|
|
|
|
*/
|
|
|
|
void slotChatSessionDestroyed();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Kopete::ChatSession* m_msgManager;
|
|
|
|
TDEActionCollection* m_actionCollection;
|
|
|
|
TestbedContactType m_type;
|
|
|
|
TDEAction* m_actionPrefs;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|