IRCNetworkAdapter Class Reference

Interprets communication between the client and the IRC server. More...

#include <ircnetworkadapter.h>

+ Inheritance diagram for IRCNetworkAdapter:

Public Slots

void openNewAdapter (const QString &recipientName)
 Opens a new chat adapter for specified recipient. More...
 
void print (const QString &printWhat, const QString &printWhere)
 
void printMsgLiteral (const QString &recipient, const QString &content, const IRCMessageClass &msgClass)
 
void printToCurrentChatBox (const QString &printWhat, const IRCMessageClass &msgClass)
 
void printWithClass (const QString &printWhat, const QString &printWhere, const IRCMessageClass &msgClass)
 
void reloadNetworkEntityFromConfig ()
 
void userPing (const QString &nickname, qint64 ping)
 
- Public Slots inherited from IRCAdapterBase
void emitMessageToAllChatBoxes (const QString &message, const IRCMessageClass &msgClass)
 
void sendMessage (const QString &message)
 

Signals

void newChatWindowIsOpened (IRCChatAdapter *pWindow)
 Signal emitted when a new chat (priv or channel) is opened from this network. More...
 
- 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...
 

Public Member Functions

 IRCNetworkAdapter (const IRCNetworkConnectionInfo &connectionInfo)
 
AdapterType adapterType () const
 Gets adapter type for this adapter instance. More...
 
bool amIOperator (const QString &channel) const
 Checks if client is an operator on a specified channel. More...
 
void banUser (const QString &nickname, const QString &reason, const QString &channel)
 Bans specified user from a channel. More...
 
QList< IRCAdapterBase * > childrenAdapters ()
 
void connect ()
 
const IRCNetworkConnectionInfoconnection () const
 
void detachChatWindow (const IRCChatAdapter *pAdapter)
 Detaches the specified IRCChatAdapter instance from this network without deleting it. More...
 
void disconnect (const QString &farewellMessage)
 
void doSendMessage (const QString &message, IRCAdapterBase *pOrigin)
 Implemented to support direct communication between client and server. More...
 
bool hasRecipient (const QString &recipient) const
 
const PatternListignoredUsersPatterns () const
 
bool isAdapterRelated (const IRCAdapterBase *pAdapter) const
 Checks if pAdapter equals this or is one of chat windows of this network. More...
 
bool isConnected () const
 
bool isMyNickname (const QString &nickname) const
 
bool isOperator (const QString &nickname, const QString &channel) const
 Checks if user is an operator on a given channel. More...
 
void killAllChatWindows ()
 
const QString & myNickname () const
 
IRCNetworkAdapternetwork ()
 The idea of the adapter system is that each adapter is either a network or is a child of a network. More...
 
IRCResponseParserresponseParser ()
 
void sendCtcp (const QString &nickname, const QString &command)
 
void setChannelMode (const QString &channel, const QString &nickname, const QString &flag, bool bSet)
 Sets channel flags. More...
 
void setEmitAllIRCMessagesEnabled (bool b)
 
void setNetworkEntity (const IRCNetworkEntity &network)
 
QString title () const
 Gets title for this adapter. More...
 
const IRCUserPrefixuserPrefixes () const
 All allowed modes with their nickname prefixes for this network. More...
 
- Public Member Functions inherited from IRCAdapterBase
virtual ~IRCAdapterBase ()
 Destructor emits terminating() signal. More...
 
void emitError (const QString &strError)
 
void emitFocusRequest ()
 
void emitMessage (const QString &strMessage)
 
void emitMessageWithClass (const QString &strMessage, const IRCMessageClass &messageClass)
 
const IRCNetworkEntitynetworkEntity () const
 
virtual QString recipient () const
 

Friends

class IRCSocketSignalsAdapter
 

Additional Inherited Members

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

Detailed Description

Interprets communication between the client and the IRC server.

Definition at line 27 of file ircnetworkadapter.h.

Member Function Documentation

AdapterType IRCNetworkAdapter::adapterType ( ) const
inlinevirtual

Gets adapter type for this adapter instance.

Implements IRCAdapterBase.

Definition at line 37 of file ircnetworkadapter.h.

bool IRCNetworkAdapter::amIOperator ( const QString &  channel) const
inline

Checks if client is an operator on a specified channel.

Definition at line 42 of file ircnetworkadapter.h.

void IRCNetworkAdapter::banUser ( const QString &  nickname,
const QString &  reason,
const QString &  channel 
)

Bans specified user from a channel.

The data that is required to deliver a ban is contained inside the string returned by /whois query.

This will create a IRCDelayedOperation object and first send /whois <nickname> query. When the /whois returns the delayed operations are searched for pending bans. This is when bans are delivered.

For end-user this effect should be almost completely invisible.

Parameters
nickNameVictim's nick.
reasonReason for ban (this will be delivered to /kick message).
channelChannel from which the user will be banned.

Definition at line 155 of file ircnetworkadapter.cpp.

void IRCNetworkAdapter::detachChatWindow ( const IRCChatAdapter pAdapter)

Detaches the specified IRCChatAdapter instance from this network without deleting it.

Definition at line 178 of file ircnetworkadapter.cpp.

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

Implemented to support direct communication between client and server.

All messages that do not begin with '/' character will be ignored here. In fact if the '/' character is missing an error() signal will be emitted to notify the user of this fact.

Programmers must remember that although IRC protocol itself doesn't require clients to prepend the messages with a slash this class always does - the slash character is stripped, then the remainder of the message is sent 'as is'.

Parameters
pOriginIf this is not null the IRCNetworkAdapter will attempt to pass some message and error signals through this pOrigin. Otherwise these signals will be sent directly.

Implements IRCAdapterBase.

Definition at line 189 of file ircnetworkadapter.cpp.

bool IRCNetworkAdapter::isAdapterRelated ( const IRCAdapterBase pAdapter) const

Checks if pAdapter equals this or is one of chat windows of this network.

Definition at line 387 of file ircnetworkadapter.cpp.

bool IRCNetworkAdapter::isOperator ( const QString &  nickname,
const QString &  channel 
) const

Checks if user is an operator on a given channel.

This will work only for known channels (ie. the ones the client is registered on).

Returns
True if given nickname has op privileges on given channel.

Definition at line 412 of file ircnetworkadapter.cpp.

IRCNetworkAdapter* IRCNetworkAdapter::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 130 of file ircnetworkadapter.h.

void IRCNetworkAdapter::newChatWindowIsOpened ( IRCChatAdapter pWindow)
signal

Signal emitted when a new chat (priv or channel) is opened from this network.

void IRCNetworkAdapter::openNewAdapter ( const QString &  recipientName)
slot

Opens a new chat adapter for specified recipient.

If specified recipient is a channel a /join command will be sent to that channel. If recipient is a user a chat window will simply be opened.

If adapter is not connected to a network or empty name is specified this becomes a no-op. Also if such recipient is already present the window will emit focus signal request.

Definition at line 543 of file ircnetworkadapter.cpp.

void IRCNetworkAdapter::print ( const QString &  printWhat,
const QString &  printWhere 
)
slot
See Also
IRCResponseParser::print()

Definition at line 569 of file ircnetworkadapter.cpp.

void IRCNetworkAdapter::setChannelMode ( const QString &  channel,
const QString &  nickname,
const QString &  flag,
bool  bSet 
)

Sets channel flags.

Flags are set using following command:

/mode <channel> [-|+]<flag> <nickname> command

Definition at line 658 of file ircnetworkadapter.cpp.

void IRCNetworkAdapter::setEmitAllIRCMessagesEnabled ( bool  b)
inline
See Also
bEmitAllIRCMessages

Definition at line 155 of file ircnetworkadapter.h.

QString IRCNetworkAdapter::title ( ) const
virtual

Gets title for this adapter.

Implements IRCAdapterBase.

Definition at line 676 of file ircnetworkadapter.cpp.

const IRCUserPrefix & IRCNetworkAdapter::userPrefixes ( ) const

All allowed modes with their nickname prefixes for this network.

Definition at line 770 of file ircnetworkadapter.cpp.


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