IRCChatAdapter Class Referenceabstract

Handles chatting through IRC. More...

#include <ircchatadapter.h>

+ Inheritance diagram for IRCChatAdapter:

Public Types

enum  IRCQuitType { ChannelPart, NetworkKill, NetworkQuit }
 
- Public Types inherited from IRCAdapterBase
enum  AdapterType { NetworkAdapter, ChannelAdapter, PrivAdapter }
 Defines all possible types of IRC adapters. More...
 

Public Member Functions

 IRCChatAdapter (IRCNetworkAdapter *pNetwork, const QString &recipient)
 
void doSendMessage (const QString &message, IRCAdapterBase *pOrigin)
 
virtual void emitChatMessage (const QString &sender, const QString &content)
 Emits message() signal formatting it to present sender's message. More...
 
IRCNetworkAdapternetwork ()
 The idea of the adapter system is that each adapter is either a network or is a child of a network. More...
 
QString recipient () const
 
void setNetwork (IRCNetworkAdapter *pNetwork)
 Sets IRCNetworkAdapter for this chat window. This adapter is not detached from the old network. More...
 
QString title () const
 For chat adapters this will return recipientName. More...
 
virtual void userChangesNickname (const QString &oldNickname, const QString &newNickname)=0
 Use this to register the fact that user has changed his/hers nickname. More...
 
virtual void userJoins (const QString &nickname, const QString &fullSignature)=0
 Use this to register the fact that user has joined the chat. More...
 
virtual void userLeaves (const QString &nickname, const QString &farewellMessage, IRCQuitType quitType)=0
 Use this to register the fact that user has left the chat. More...
 
virtual void userModeChanges (const QString &nickname, const QList< char > &addedFlags, const QList< char > &removedFlags)=0
 Use this to register the fact that user MODE flags have changed. More...
 
- Public Member Functions inherited from IRCAdapterBase
virtual ~IRCAdapterBase ()
 Destructor emits terminating() signal. More...
 
virtual AdapterType adapterType () const =0
 Gets adapter type for this adapter instance. More...
 
void emitError (const QString &strError)
 
void emitFocusRequest ()
 
void emitMessage (const QString &strMessage)
 
void emitMessageWithClass (const QString &strMessage, const IRCMessageClass &messageClass)
 
const IRCNetworkEntitynetworkEntity () const
 

Protected Member Functions

QString extractMessageLine (QStringList &words, int maxLength)
 
void sendChatMessage (const QString &message)
 
void setRecipient (const QString &name)
 

Protected Attributes

IRCNetworkAdapterpNetwork
 
QString recipientName
 

Additional Inherited Members

- Public Slots inherited from IRCAdapterBase
void emitMessageToAllChatBoxes (const QString &message, const IRCMessageClass &msgClass)
 
void sendMessage (const QString &message)
 
- Signals inherited from IRCAdapterBase
void error (const QString &error)
 
void focusRequest ()
 Called when this adapter requests UI focus. More...
 
void message (const QString &message)
 
void messageToNetworksCurrentChatBox (const QString &message, const IRCMessageClass &msgClass)
 
void messageWithClass (const QString &message, const IRCMessageClass &messageClass)
 
void terminating ()
 
void titleChange ()
 Can be called when the variable returned by title() might have changed and the application should be notified of this fact. More...
 

Detailed Description

Handles chatting through IRC.

This class covers both channel and private messaging. This can be done because the IRC protocol as stated in RFC 1459 doesn't see a difference between transmitting messages between channel and user or between user and user directly.

Definition at line 39 of file ircchatadapter.h.

Constructor & Destructor Documentation

IRCChatAdapter::IRCChatAdapter ( IRCNetworkAdapter pNetwork,
const QString &  recipient 
)
Parameters
pNetworkA pointer to the network this channel or user exists on.
recipientFull name of the entity this adapter will be talking to.

Definition at line 28 of file ircchatadapter.cpp.

Member Function Documentation

void IRCChatAdapter::doSendMessage ( const QString &  message,
IRCAdapterBase pOrigin 
)
virtual

All messages starting with '/' character will be passed to the parent network directly. Also the pOrigin parameter for the parent network will be set to point to 'this'.

All other messages will be sent as:

/PRIVMSG <recipient> :<message>

Implements IRCAdapterBase.

Definition at line 46 of file ircchatadapter.cpp.

void IRCChatAdapter::emitChatMessage ( const QString &  sender,
const QString &  content 
)
virtual

Emits message() signal formatting it to present sender's message.

Reimplemented in IRCChannelAdapter.

Definition at line 72 of file ircchatadapter.cpp.

QString IRCChatAdapter::extractMessageLine ( QStringList &  words,
int  maxLength 
)
protected

Makes sure the sent message will not exceed the IRC character limit.

Parameters
wordsA list of words from which a "sentence" will be build. This list is directly modified and only unused words are left when this method is done processing.

Definition at line 77 of file ircchatadapter.cpp.

IRCNetworkAdapter* IRCChatAdapter::network ( )
inlinevirtual

The idea of the adapter system is that each adapter is either a network or is a child of a network.

This method is supposed to return a pointer to a network to which this adapter belongs.

Implements IRCAdapterBase.

Definition at line 75 of file ircchatadapter.h.

void IRCChatAdapter::setNetwork ( IRCNetworkAdapter pNetwork)

Sets IRCNetworkAdapter for this chat window. This adapter is not detached from the old network.

Definition at line 143 of file ircchatadapter.cpp.

QString IRCChatAdapter::title ( ) const
virtual

For chat adapters this will return recipientName.

Implements IRCAdapterBase.

Definition at line 154 of file ircchatadapter.cpp.

virtual void IRCChatAdapter::userChangesNickname ( const QString &  oldNickname,
const QString &  newNickname 
)
pure virtual

Use this to register the fact that user has changed his/hers nickname.

Implemented in IRCChannelAdapter, and IRCPrivAdapter.

virtual void IRCChatAdapter::userJoins ( const QString &  nickname,
const QString &  fullSignature 
)
pure virtual

Use this to register the fact that user has joined the chat.

Implemented in IRCChannelAdapter, and IRCPrivAdapter.

virtual void IRCChatAdapter::userLeaves ( const QString &  nickname,
const QString &  farewellMessage,
IRCQuitType  quitType 
)
pure virtual

Use this to register the fact that user has left the chat.

Implemented in IRCChannelAdapter, and IRCPrivAdapter.

virtual void IRCChatAdapter::userModeChanges ( const QString &  nickname,
const QList< char > &  addedFlags,
const QList< char > &  removedFlags 
)
pure virtual

Use this to register the fact that user MODE flags have changed.

Implemented in IRCChannelAdapter, and IRCPrivAdapter.


The documentation for this class was generated from the following files: