![]() |
KVIrc 5.2.6
Developer APIs
|
An abstraction of a connection to an IRC server. More...
#include <KviIrcConnection.h>
Public Types | |
enum | CreateQueryVisibilityMode { CreateQueryVisibilityMinimized , CreateQueryVisibilityVisible , CreateQueryVisibilityFollowSettings } |
enum | State { Idle , Connecting , Connected } |
The possible "high level" states of this connection. More... | |
Public Slots | |
void | restartNotifyList () |
Called to restart the notify list. | |
void | unhighlightAllChannels () |
Called when we unhighlight all channels. | |
void | unhighlightAllQueries () |
Called when we unhighlight all queries. | |
Signals | |
void | awayStateChanged () |
Emitted when the away state changes. | |
void | chanListChanged () |
Emitted when the channels list change. | |
void | channelRegistered (KviChannelWindow *pChan) |
Emitted when we register a channel. | |
void | channelUnregistered (KviChannelWindow *pChan) |
Emitted when we unregister a channel. | |
void | nickNameChanged () |
Emitted when the nickname changes. | |
void | userModeChanged () |
Emitted when the user modes change. | |
Public Member Functions | |
KviIrcConnectionAntiCtcpFloodData * | antiCtcpFloodData () const |
Returns a pointer to the KviIrcConnectionAntiCtcpFloodData object. | |
KviIrcConnectionAsyncWhoisData * | asyncWhoisData () const |
Returns a pointer to the KviIrcConnectionAsyncWhoisData object. | |
std::vector< KviChannelWindow * > & | channelList () |
Returns the list of the channels bound to the current connection. | |
void | clearOutputQueue (bool bPrivateMessagesOnly) |
void | closeAllChannels () |
Closes all the currently open channels not marked as dead. | |
void | closeAllQueries () |
Closes all the currently open queries not marked as dead. | |
KviConsoleWindow * | console () const |
Returns a pointer to the owning console. | |
KviIrcContext * | context () const |
Returns a pointer to the owning KviIrcContext. | |
KviChannelWindow * | createChannel (const QString &szName) |
Creates a new channel with the specified name. | |
KviQueryWindow * | createQuery (const QString &szNick, CreateQueryVisibilityMode eVisibilityMode=CreateQueryVisibilityFollowSettings) |
Creates a query with the specified nick as target. | |
const QString & | currentNetworkName () const |
Helper that provides a shortcut for really common access to serverInfo()->networkName() | |
const QString & | currentNickName () const |
Helper that provides a shortcut for really common access to userInfo()->nickName() | |
const QString & | currentServerName () const |
Helper that provides a shortcut for really common access to serverInfo()->name() | |
const QString & | currentUserName () const |
Helper that provides a shortcut for really common access to userInfo()->userName() | |
QString | decodeText (const char *szText) |
Decodes the specified text by using the server codec. | |
QByteArray | encodeText (const QString &szText) |
Encodes the specified text by using the local text codec. | |
KviChannelWindow * | findChannel (const QString &szName) |
Finds the channel with the specified unicode name. | |
KviQueryWindow * | findQuery (const QString &szNick) |
Finds the query with the specified nick. | |
int | getCommonChannels (const QString &szNick, QString &szChansBuffer, bool bAddEscapeSequences=true) |
Returns a list of channels bound to the current connection. | |
void | incomingMessage (const char *pcMessage) |
This function is part of the networking stack. | |
void | incomingMessageNoFilter (const char *pcMessage) |
This function is part of the networking stack. | |
void | keepChannelsOpenAfterDisconnect () |
Marks all the currently existing channels as DEAD. | |
void | keepQueriesOpenAfterDisconnect () |
Marks all the currently open queries as DEAD. | |
KviLagMeter * | lagMeter () const |
Returns a pointer to the current KviLagMeter. | |
KviIrcLink * | link () const |
Returns the underlying KviIrcLink object. | |
KviIrcConnectionNetsplitDetectorData * | netsplitDetectorData () const |
Returns a pointer to the KviIrcConnectionNetsplitDetectorData object. | |
KviNotifyListManager * | notifyListManager () const |
Returns a pointer to the current KviNotifyListManager. | |
unsigned int | outputQueueSize () |
Returns the current size of the output queue. | |
std::vector< KviQueryWindow * > & | queryList () |
Returns the list of the currently open queries. | |
void | registerChannel (KviChannelWindow *c) |
void | registerQuery (KviQueryWindow *q) |
KviIrcConnectionRequestQueue * | requestQueue () const |
Returns a pointer to the current KviIrcConnectionRequestQueue. | |
void | restartLagMeter () |
void | resurrectDeadQueries () |
This is the inverse of keepQueriesOpenAfterDisconnect(). | |
bool | sendData (const char *pcBuffer, int iBuflen=-1) |
Sends the specified text on the connected link (and thus socket). | |
bool | sendFmtData (const char *pcFmt,...) |
Sends the specified text on the connected link (and thus socket). | |
QTextCodec * | serverCodec () const |
Returns a pointer to the current global codec for inbound data. | |
KviIrcConnectionServerInfo * | serverInfo () const |
Returns a pointer to the KviIrcConnectionServerInfo object. | |
void | setEncoding (const QString &szEncoding) |
Sets the global encoding for this connection. | |
State | state () const |
Returns the current state of the connection. | |
KviIrcConnectionStateData * | stateData () const |
Returns a pointer to the KviIrcConnectionStateData object. | |
KviIrcConnectionStatistics * | statistics () const |
Returns a pointer to the KviIrcConnectionStatistics object. | |
KviIrcConnectionTarget * | target () const |
Returns the target of this connection. | |
QTextCodec * | textCodec () const |
Returns a pointer to the current global codec for outbound text. | |
void | unregisterChannel (KviChannelWindow *c) |
void | unregisterQuery (KviQueryWindow *q) |
KviIrcUserDataBase * | userDataBase () const |
Returns a pointer to the big connection user database. | |
KviIrcConnectionUserInfo * | userInfo () const |
Returns a pointer to the KviIrcConnectionUserInfo object. | |
Protected Member Functions | |
void | abort () |
Kills any running connection or attempt. | |
void | changeAwayState (bool bAway) |
Called to update the away state. | |
bool | changeUserMode (char cMode, bool bSet) |
Called when MODE is received for each mode character. | |
void | delayedStartNotifyList () |
Starts the notify list in 15 seconds. | |
void | endInitialCapNegotiation () |
Called when we want to end CAP negotiation and go on wi the login. | |
void | endOfMotdReceived () |
Called to start the notify lists when RPL_ENDOFMOTD is received. | |
void | gatherChannelAndPasswordPairs (std::vector< std::pair< QString, QString > > &lChannelsAndPasses) |
void | gatherQueryNames (QStringList &lQueryNames) |
void | handleAuthenticate (KviCString &szResponse) |
Called when AUTHENTICATE answer is received. | |
void | handleFailedInitialCapLs () |
Called when CAP LS negotiation fails. | |
void | handleInitialCapAck () |
Called when CAP ACK answer is received. | |
void | handleInitialCapLs () |
Called when CAP LS answer is received. | |
void | handleInitialCapNak () |
Called when CAP NAK answer is received. | |
void | heartbeat (kvi_time_t tNow) |
Called once in a while (every 5 secs at the moment) | |
void | joinChannels (const std::vector< std::pair< QString, QString > > &lChannelsAndPasses) |
KviIrcConnection (KviIrcContext *pContext, KviIrcConnectionTarget *pTarget, KviUserIdentity *pIdentity) | |
Creates a KviIrcConnection object. | |
void | linkAttemptFailed (int iError) |
This signals that the connection attempt has failed. | |
void | linkEstablished () |
Called by KviIrcLink when the socket state changes to Connected. | |
void | linkTerminated () |
Called by KviIrcLink when the socket state changes to Ready. | |
void | loginComplete (const QString &szNickName) |
Called on the first numeric received from server. | |
void | loginToIrcServer () |
Logins to the irc server. | |
void | nickChange (const QString &szNewNick) |
Called when NICK is received. | |
QString | pickNextLoginNickName (bool bForceDefaultIfPrimaryNicknamesEmpty, const QString &szBaseNickForRandomChoices, QString &szChoiceDescriptionBuffer) |
void | resolveLocalHost () |
Resolves the localhost into an IP address. | |
void | serverInfoReceived (const QString &szServerName, const QString &szUserModes, const QString &szChanModes) |
Called when RPL_SERVINFO (004) is received and sets the info. | |
void | start () |
This starts an asynchronous connection attempt. | |
void | useProfileData (KviIdentityProfileSet *pSet, const QString &szNetwork) |
Uses the profiles' data as connection data. | |
void | useRealName (const QString &szRealName) |
void | userInfoReceived (const QString &szUserName, const QString &szHostName) |
Called on each JOIN and sets the info. | |
~KviIrcConnection () | |
Destroys a KviIrcConnection object. KviConsoleWindow uses this. | |
Private Slots | |
void | hostNameLookupTerminated (KviDnsResolver *pDns) |
Called when the hostname lookup is finished. | |
Private Member Functions | |
void | setupSrvCodec () |
Setups the codec for the server. | |
void | setupTextCodec () |
Setups the codec for the text. | |
Private Attributes | |
bool | m_bIdentdAttached = false |
State | m_eState = Idle |
KviIrcConnectionAntiCtcpFloodData * | m_pAntiCtcpFloodData |
KviIrcConnectionAsyncWhoisData * | m_pAsyncWhoisData |
std::vector< KviChannelWindow * > | m_pChannelList |
KviConsoleWindow * | m_pConsole |
KviIrcContext * | m_pContext |
KviLagMeter * | m_pLagMeter = nullptr |
KviIrcLink * | m_pLink |
KviDnsResolver * | m_pLocalhostDns = nullptr |
KviIrcConnectionNetsplitDetectorData * | m_pNetsplitDetectorData |
KviNotifyListManager * | m_pNotifyListManager = nullptr |
QTimer * | m_pNotifyListTimer = nullptr |
std::vector< KviQueryWindow * > | m_pQueryList |
KviIrcConnectionRequestQueue * | m_pRequestQueue |
KviIrcConnectionServerInfo * | m_pServerInfo |
QTextCodec * | m_pSrvCodec |
KviIrcConnectionStateData * | m_pStateData |
std::unique_ptr< KviIrcConnectionStatistics > | m_pStatistics |
KviIrcConnectionTarget * | m_pTarget |
QTextCodec * | m_pTextCodec |
KviIrcUserDataBase * | m_pUserDataBase |
KviUserIdentity * | m_pUserIdentity |
KviIrcConnectionUserInfo * | m_pUserInfo |
Friends | |
class | KviConsoleWindow |
class | KviIrcContext |
class | KviIrcLink |
class | KviIrcServerParser |
An abstraction of a connection to an IRC server.
This class deals with the high-level logic of a connection to an IRC server. It's always attached to a KviIrcContext and thus to a KviConsoleWindow window. The connection has a KviIrcConnectionTarget object which specifies the data of the server that needs to be contacted and a KviUserIdentity object which specifies the user data to use.
The connection is the upper layer of the KVIrc networking stack. It owns KviIrcLink which is the layer immediately below and which in turn contains a KviIrcSocket.
The connection creates and manages a lot of objects that handle runtime information. These objects include a KviIrcConnectionUserInfo which contains the ACTUAL user information, KviIrcConnectionServerInfo which contains the ACTUAL server information, KviIrcUserDataBase which is substantially a big hash table containing all the users visible to KVIrc in this connection, a list of channels, a list of queries etc...
Visibility mode for createQuery()
|
protected |
Creates a KviIrcConnection object.
This is actually used only by KviConsoleWindow.
pContext must not be nullptr and is kept as shallow pointer (that is, it's not owned and must persists for the entire life of KviIrcConnection: caller is responsable for that).
pTarget must not be nullptr and must be allocated with new as this class takes the ownership.
pIdentity must not be nullptr and must be allocated with new as this class takes the ownership.
pContext | The KviIrcContext we're attacched to |
pTarget | The server data |
pIdentity | User information to use in this connection |
References KviIrcContext::console(), KviIrcContext, KviIrcLink, m_pAntiCtcpFloodData, m_pAsyncWhoisData, m_pConsole, m_pContext, m_pLink, m_pNetsplitDetectorData, m_pRequestQueue, m_pServerInfo, m_pStateData, m_pStatistics, m_pTarget, m_pUserDataBase, m_pUserIdentity, m_pUserInfo, setupSrvCodec(), and setupTextCodec().
Referenced by KviIrcServerParser.
|
protected |
Destroys a KviIrcConnection object. KviConsoleWindow uses this.
References g_pMainWindow, KVI_INTERNALCOMMAND_IDENT_STOP, m_bIdentdAttached, m_pAntiCtcpFloodData, m_pAsyncWhoisData, m_pLagMeter, m_pLink, m_pLocalhostDns, m_pNetsplitDetectorData, m_pNotifyListManager, m_pNotifyListTimer, m_pRequestQueue, m_pServerInfo, m_pStateData, m_pTarget, m_pUserDataBase, m_pUserIdentity, and m_pUserInfo.
|
protected |
Kills any running connection or attempt.
References m_pLink.
Referenced by KviIrcServerParser::parseNumericSaslFail(), and KviIrcContext::terminateConnectionRequest().
|
inline |
Returns a pointer to the KviIrcConnectionAntiCtcpFloodData object.
It contains data private to the Anti CTCP Flood engine. Very similar to KviIrcConnectionStateData but dedicated to Ctcp flood. The returned pointer is never nullptr. Include "KviIrcConnectionAntiCtcpFloodData.h" as the class is only forwarded here.
References m_pAntiCtcpFloodData.
Referenced by KviIrcServerParser::checkCtcpFlood().
|
inline |
Returns a pointer to the KviIrcConnectionAsyncWhoisData object.
It contains data private to the async whois engine. Very similar to KviIrcConnectionStateData but dedicated to async whois. The returned pointer is never nullptr. Include "KviIrcConnectionAsyncWhoisData.h" as the class is only forwarded here.
References m_pAsyncWhoisData.
Referenced by KviIrcServerParser::parseNumericEndOfWhois(), KviIrcServerParser::parseNumericNoSuchNick(), KviIrcServerParser::parseNumericNoSuchServer(), KviIrcServerParser::parseNumericWhoisActually(), KviIrcServerParser::parseNumericWhoisAuth(), KviIrcServerParser::parseNumericWhoisAway(), KviIrcServerParser::parseNumericWhoisChannels(), KviIrcServerParser::parseNumericWhoisIdle(), KviIrcServerParser::parseNumericWhoisOther(), KviIrcServerParser::parseNumericWhoisServer(), and KviIrcServerParser::parseNumericWhoisUser().
|
signal |
|
protected |
Called to update the away state.
bAway | Whether we enter the away mode |
References awayStateChanged(), e, KviIrcUserDataBase::find(), g_pActiveWindow, g_pMainWindow, m_pConsole, m_pUserInfo, userDataBase(), and userInfo().
Referenced by KviIrcServerParser::parseNumericAway(), and KviIrcServerParser::parseNumericBackFromAway().
|
protected |
Called when MODE is received for each mode character.
cMode | The mode flag :) |
bSet | Whether to set the mode |
References g_pMainWindow, m_pConsole, m_pUserInfo, and userModeChanged().
Referenced by KviIrcServerParser::parseUserMode().
|
signal |
Emitted when the channels list change.
Referenced by registerChannel(), and unregisterChannel().
|
inline |
Returns the list of the channels bound to the current connection.
The pointer itself is never null (though the list may be empty).
References m_pChannelList.
Referenced by KviConsoleWindow::getWindowListTipText(), KviIrcServerParser::parseLiteralChghost(), KviIrcServerParser::parseLiteralNick(), KviIrcServerParser::parseLiteralQuit(), KviIrcUrl::run(), and KviConsoleWindow::updateUri().
|
signal |
Emitted when we register a channel.
pChan | The channel :) |
Referenced by registerChannel().
|
signal |
Emitted when we unregister a channel.
pChan | The channel :) |
Referenced by unregisterChannel().
void KviIrcConnection::clearOutputQueue | ( | bool | bPrivateMessagesOnly | ) |
Clears the underlying output queue. Exposed basically for /context.clearQueue You shouldn't need it for any other reason :)
References m_pLink.
void KviIrcConnection::closeAllChannels | ( | ) |
void KviIrcConnection::closeAllQueries | ( | ) |
Closes all the currently open queries not marked as dead.
References m_pChannelList, m_pQueryList, and q.
|
inline |
Returns a pointer to the owning console.
The pointer is never nullptr
References KviConsoleWindow, and m_pConsole.
Referenced by heartbeat(), KviIrcMessage::KviIrcMessage(), KviNotifyListManager::KviNotifyListManager(), KviStatusBarAwayIndicator::mouseDoubleClickEvent(), KviIrcServerParser::parseMessage(), KviIrcServerParser::parseNumericCodePageScheme(), KviIrcServerParser::parseNumericCodePageSet(), and useRealName().
|
inline |
Returns a pointer to the owning KviIrcContext.
The returned value is never nullptr
References KviIrcContext, and m_pContext.
Referenced by KviMainWindow::childConnectionAwayStateChange(), KviMainWindow::childConnectionLagChange(), KviMainWindow::childConnectionNickNameChange(), KviMainWindow::childConnectionServerInfoChange(), KviMainWindow::childConnectionUserModeChange(), incomingMessage(), linkAttemptFailed(), linkEstablished(), linkTerminated(), loginComplete(), KviIrcServerParser::parseNumeric001(), KviIrcServerParser::parseNumeric002(), KviIrcServerParser::parseNumeric003(), KviIrcServerParser::parseNumeric004(), KviIrcServerParser::parseNumeric005(), sendData(), and sendFmtData().
KviChannelWindow * KviIrcConnection::createChannel | ( | const QString & | szName | ) |
Creates a new channel with the specified name.
This should be called in response to a JOIN message. This function assumes that such a channel doesn't exist yet (or if it exists then it's actually in DEAD state). You can assume that channel creation never fails: if the returned pointer is nullptr then we're screwed anyway as virtual memory is exausted.
szName | The name of the channel |
References g_pMainWindow, KVI_OPTION_BOOL, KviOption_boolCreateMinimizedChannels, m_pConsole, m_pContext, and KviChannelWindow::setAliveChan().
Referenced by KviIrcServerParser::parseLiteralJoin().
KviQueryWindow * KviIrcConnection::createQuery | ( | const QString & | szNick, |
CreateQueryVisibilityMode | eVisibilityMode = CreateQueryVisibilityFollowSettings ) |
Creates a query with the specified nick as target.
This function assumes that such a query doesn't exist yet (or if it exists it's actually marked as dead and needs to be resurrected).
szNick | The nickname of the user |
eShowMode | Specifies the show mode for the window |
References CreateQueryVisibilityMinimized, CreateQueryVisibilityVisible, findQuery(), g_pMainWindow, KVI_OPTION_BOOL, KviOption_boolCreateIncomingQueriesAsMinimized, m_pConsole, m_pContext, and q.
Referenced by loginComplete(), KviIrcServerParser::parseCtcpRequestAction(), KviIrcServerParser::parseLiteralNotice(), and KviIrcServerParser::parseLiteralPrivmsg().
const QString & KviIrcConnection::currentNetworkName | ( | ) | const |
Helper that provides a shortcut for really common access to serverInfo()->networkName()
References m_pServerInfo.
Referenced by KviWindowListBase::getTextForConsole(), and KviStatusBar::mouseDoubleClickEvent().
const QString & KviIrcConnection::currentNickName | ( | ) | const |
Helper that provides a shortcut for really common access to userInfo()->nickName()
References KviIrcConnectionUserInfo::nickName(), and userInfo().
Referenced by avatar_kvs_cmd_notify(), avatar_kvs_cmd_set(), avatar_kvs_cmd_unset(), avatar_kvs_fnc_name(), avatar_kvs_fnc_path(), KviIrcContextDisplay::drawContents(), KviChannelWindow::fillCaptionBuffers(), KviQueryWindow::fillCaptionBuffers(), KviApplication::fillRecentNicknamesPopup(), KviApplication::findConsole(), KviKvsCoreSimpleCommands::KVSCSC(), KviChannelWindow::ownAction(), KviIrcServerParser::parseLiteralNotice(), KviIrcServerParser::parseNumericCodePageSet(), KviStatusBar::setPermanentMessage(), and KviIrcContextDisplay::tipRequest().
const QString & KviIrcConnection::currentServerName | ( | ) | const |
Helper that provides a shortcut for really common access to serverInfo()->name()
References KviIrcConnectionServerInfo::name(), and serverInfo().
Referenced by KviIrcMessage::decodeAndSplitPrefix(), KviIrcContextDisplay::drawContents(), KviChannelWindow::fillCaptionBuffers(), KviQueryWindow::fillCaptionBuffers(), KviApplication::findConsole(), KviWindowListBase::getTextForConsole(), KviStatusBar::mouseDoubleClickEvent(), KviIrcServerParser::parseLiteralNotice(), KviIrcMessage::safePrefix(), KviStatusBar::setPermanentMessage(), and KviIrcContextDisplay::tipRequest().
const QString & KviIrcConnection::currentUserName | ( | ) | const |
Helper that provides a shortcut for really common access to userInfo()->userName()
References userInfo(), and KviIrcConnectionUserInfo::userName().
QString KviIrcConnection::decodeText | ( | const char * | szText | ) |
Decodes the specified text by using the server codec.
You should first attempt to decode the text by using the window codec (if you belong to a window).
szText | The text to decode |
References m_pSrvCodec.
Referenced by KviIrcServerParser::echoCtcpReply(), KviIrcServerParser::echoCtcpRequest(), KviIrcServerParser::otherChannelError(), KviIrcServerParser::parseChannelHelp(), KviIrcServerParser::parseChannelMode(), KviIrcServerParser::parseCommandEndOfHelp(), KviIrcServerParser::parseCommandHelp(), KviIrcServerParser::parseCommandSyntaxHelp(), KviIrcServerParser::parseCtcpReply(), KviIrcServerParser::parseCtcpRequest(), KviIrcServerParser::parseCtcpRequestAction(), KviIrcServerParser::parseCtcpRequestPage(), KviIrcServerParser::parseLiteralAccount(), KviIrcServerParser::parseLiteralAway(), KviIrcServerParser::parseLiteralCap(), KviIrcServerParser::parseLiteralChghost(), KviIrcServerParser::parseLiteralError(), KviIrcServerParser::parseLiteralInvite(), KviIrcServerParser::parseLiteralJoin(), KviIrcServerParser::parseLiteralKick(), KviIrcServerParser::parseLiteralMode(), KviIrcServerParser::parseLiteralNick(), KviIrcServerParser::parseLiteralNotice(), KviIrcServerParser::parseLiteralPart(), KviIrcServerParser::parseLiteralPing(), KviIrcServerParser::parseLiteralPong(), KviIrcServerParser::parseLiteralPrivmsg(), KviIrcServerParser::parseLiteralQuit(), KviIrcServerParser::parseLiteralTopic(), KviIrcServerParser::parseLiteralWallops(), KviIrcServerParser::parseLoginNicknameProblem(), KviIrcServerParser::parseMessage(), KviIrcMessage::parseMessageTags(), KviIrcServerParser::parseNumeric001(), KviIrcServerParser::parseNumeric002(), KviIrcServerParser::parseNumeric003(), KviIrcServerParser::parseNumeric004(), KviIrcServerParser::parseNumeric005(), KviIrcServerParser::parseNumeric367(), KviIrcServerParser::parseNumeric368(), KviIrcServerParser::parseNumeric486(), KviIrcServerParser::parseNumeric742(), KviIrcServerParser::parseNumericAlreadyRegistered(), KviIrcServerParser::parseNumericAway(), KviIrcServerParser::parseNumericBackFromAway(), KviIrcServerParser::parseNumericBanOnChan(), KviIrcServerParser::parseNumericCannotSend(), KviIrcServerParser::parseNumericCannotSendColor(), KviIrcServerParser::parseNumericCantJoinChannel(), KviIrcServerParser::parseNumericChannelModeIs(), KviIrcServerParser::parseNumericChanUrl(), KviIrcServerParser::parseNumericCodePageScheme(), KviIrcServerParser::parseNumericCodePageSet(), KviIrcServerParser::parseNumericCommandSyntax(), KviIrcServerParser::parseNumericCreationTime(), KviIrcServerParser::parseNumericEndOfNames(), KviIrcServerParser::parseNumericEndOfQuietList(), KviIrcServerParser::parseNumericEndOfStats(), KviIrcServerParser::parseNumericEndOfWho(), KviIrcServerParser::parseNumericEndOfWhois(), KviIrcServerParser::parseNumericEndOfWhowas(), KviIrcServerParser::parseNumericForward(), KviIrcServerParser::parseNumericHiddenHost(), KviIrcServerParser::parseNumericInfo(), KviIrcServerParser::parseNumericInvited(), KviIrcServerParser::parseNumericInviting(), KviIrcServerParser::parseNumericIsOn(), KviIrcServerParser::parseNumericLinks(), KviIrcServerParser::parseNumericList(), KviIrcServerParser::parseNumericMotd(), KviIrcServerParser::parseNumericMotdMissing(), KviIrcServerParser::parseNumericNames(), KviIrcServerParser::parseNumericNeedSSL(), KviIrcServerParser::parseNumericNicknameProblem(), KviIrcServerParser::parseNumericNoPrivs(), KviIrcServerParser::parseNumericNoSuchChannel(), KviIrcServerParser::parseNumericNoSuchNick(), KviIrcServerParser::parseNumericNoSuchServer(), KviIrcServerParser::parseNumericNotEnoughParams(), KviIrcServerParser::parseNumericNotifyGeneric(), KviIrcServerParser::parseNumericNoTopic(), KviIrcServerParser::parseNumericNotRegistered(), KviIrcServerParser::parseNumericOftcEndOfQuietList(), KviIrcServerParser::parseNumericOftcQuietList(), KviIrcServerParser::parseNumericPasswordIncorrect(), KviIrcServerParser::parseNumericQuietList(), KviIrcServerParser::parseNumericSaslFail(), KviIrcServerParser::parseNumericSaslLogin(), KviIrcServerParser::parseNumericServerAdminInfoAdminContact(), KviIrcServerParser::parseNumericServerAdminInfoAdminName(), KviIrcServerParser::parseNumericServerAdminInfoServerName(), KviIrcServerParser::parseNumericServerAdminInfoTitle(), KviIrcServerParser::parseNumericStats(), KviIrcServerParser::parseNumericTime(), KviIrcServerParser::parseNumericTopic(), KviIrcServerParser::parseNumericTopicWhoTime(), KviIrcServerParser::parseNumericTryAgain(), KviIrcServerParser::parseNumericUnavailResource(), KviIrcServerParser::parseNumericUnknownCommand(), KviIrcServerParser::parseNumericUserhost(), KviIrcServerParser::parseNumericUserInChan(), KviIrcServerParser::parseNumericUsersDontMatch(), KviIrcServerParser::parseNumericWhoisActually(), KviIrcServerParser::parseNumericWhoisAuth(), KviIrcServerParser::parseNumericWhoisAway(), KviIrcServerParser::parseNumericWhoisChannels(), KviIrcServerParser::parseNumericWhoisIdle(), KviIrcServerParser::parseNumericWhoisOther(), KviIrcServerParser::parseNumericWhoisRegistered(), KviIrcServerParser::parseNumericWhoisServer(), KviIrcServerParser::parseNumericWhoisUser(), KviIrcServerParser::parseNumericWhospcrpl(), KviIrcServerParser::parseNumericWhowasUser(), KviIrcServerParser::parseNumericYouHaveCallerID(), KviIrcServerParser::parseNumericYoureOper(), KviIrcServerParser::parseNumericYourUID(), and ListWindow::processData().
|
protected |
Starts the notify list in 15 seconds.
We have this delay to wait an eventual RPL_PROTOCTL from the server telling us that the WATCH notify list method is supported
References connect(), KVI_ASSERT, m_pNotifyListTimer, and restartNotifyList().
Referenced by loginComplete().
QByteArray KviIrcConnection::encodeText | ( | const QString & | szText | ) |
Encodes the specified text by using the local text codec.
You should first attempt to encode the text by using the window codec (if you belong to a window).
szText | The text to encode |
References m_pSrvCodec.
Referenced by avatar_kvs_cmd_notify(), avatar_kvs_cmd_query(), KviChannelWindow::closeEvent(), dcc_kvs_cmd_get(), dcc_module_reply_errmsg(), dccModuleParseDccGet(), KviTrayIconWidget::doAway(), KviKvsTreeNodeAliasSimpleCommand::execute(), handleAuthenticate(), DccBroker::handleResumeRequest(), heartbeat(), ListWindow::itemDoubleClicked(), joinChannels(), KviKvsCoreSimpleCommands::KVSCSC(), loginComplete(), loginToIrcServer(), KviChannelWindow::ownAction(), KviQueryWindow::ownAction(), KviChannelWindow::ownMessage(), KviQueryWindow::ownMessage(), KviIrcServerParser::parseCtcpReplyAvatar(), KviIrcServerParser::parseCtcpRequestPing(), KviIrcServerParser::parseLiteralKick(), KviIrcServerParser::parseLiteralPing(), KviIrcServerParser::parseLoginNicknameProblem(), KviUserInput::parseNonCommand(), KviIrcServerParser::parseNumericAway(), KviIrcServerParser::parseNumericBackFromAway(), KviIrcServerParser::parseNumericWhospcrpl(), KviChannelWindow::removeMasks(), KviIrcServerParser::replyCtcp(), DccBroker::rsendExecute(), KviIrcUrl::run(), KviChannelWindow::setAliveChan(), KviChannelWindow::setMode(), KviIrcContext::terminateConnectionRequest(), KviIrcConnectionRequestQueue::timerSlot(), KviChannelWindow::toggleListModeEditor(), and KviChannelWindow::topicSelected().
|
protected |
Called when we want to end CAP negotiation and go on wi the login.
References loginToIrcServer(), m_pStateData, and sendFmtData().
Referenced by handleInitialCapAck(), handleInitialCapLs(), handleInitialCapNak(), KviIrcServerParser::parseNumericSaslFail(), KviIrcServerParser::parseNumericSaslLogin(), and KviIrcServerParser::parseNumericSaslSuccess().
|
protected |
Called to start the notify lists when RPL_ENDOFMOTD is received.
References m_pNotifyListTimer, and restartNotifyList().
Referenced by KviIrcServerParser::parseNumericMotd().
KviChannelWindow * KviIrcConnection::findChannel | ( | const QString & | szName | ) |
Finds the channel with the specified unicode name.
Returns the pointer to the channel found or nullptr if there is no such channel.
szName | The name of the channel |
References KviQString::equalCI(), and m_pChannelList.
Referenced by KviIrcServerParser::echoCtcpReply(), KviIrcServerParser::echoCtcpRequest(), KviApplication::fillRecentChannelsPopup(), KviKvsCoreFunctions::KVSCF(), KviIrcServerParser::parseChannelHelp(), KviIrcServerParser::parseCtcpReplyPing(), KviIrcServerParser::parseCtcpRequestAction(), KviIrcServerParser::parseLiteralJoin(), KviIrcServerParser::parseLiteralKick(), KviIrcServerParser::parseLiteralMode(), KviIrcServerParser::parseLiteralNotice(), KviIrcServerParser::parseLiteralPart(), KviIrcServerParser::parseLiteralPrivmsg(), KviIrcServerParser::parseLiteralTopic(), KviIrcServerParser::parseNumeric367(), KviIrcServerParser::parseNumeric368(), KviIrcServerParser::parseNumeric742(), KviIrcServerParser::parseNumericCannotSend(), KviIrcServerParser::parseNumericCannotSendColor(), KviIrcServerParser::parseNumericChannelModeIs(), KviIrcServerParser::parseNumericChanUrl(), KviIrcServerParser::parseNumericCreationTime(), KviIrcServerParser::parseNumericEndOfNames(), KviIrcServerParser::parseNumericEndOfQuietList(), KviIrcServerParser::parseNumericEndOfWho(), KviIrcServerParser::parseNumericInvited(), KviIrcServerParser::parseNumericInviting(), KviIrcServerParser::parseNumericNames(), KviIrcServerParser::parseNumericNeedSSL(), KviIrcServerParser::parseNumericNoTopic(), KviIrcServerParser::parseNumericOftcEndOfQuietList(), KviIrcServerParser::parseNumericOftcQuietList(), KviIrcServerParser::parseNumericQuietList(), KviIrcServerParser::parseNumericTopic(), KviIrcServerParser::parseNumericTopicWhoTime(), and KviIrcServerParser::parseNumericWhospcrpl().
KviQueryWindow * KviIrcConnection::findQuery | ( | const QString & | szNick | ) |
Finds the query with the specified nick.
Returns the pointer to the query found or nullptr if there is no such query.
szNick | The nickname of the user |
References KviQString::equalCI(), m_pQueryList, and q.
Referenced by createQuery(), KviKvsCoreFunctions::KVSCF(), loginComplete(), KviIrcServerParser::parseCtcpRequestAction(), KviIrcServerParser::parseLiteralChghost(), KviIrcServerParser::parseLiteralJoin(), KviIrcServerParser::parseLiteralKick(), KviIrcServerParser::parseLiteralNick(), KviIrcServerParser::parseLiteralNotice(), KviIrcServerParser::parseLiteralPart(), KviIrcServerParser::parseLiteralPrivmsg(), KviIrcServerParser::parseLiteralQuit(), KviIrcServerParser::parseNumericWhoisAway(), KviIrcServerParser::parseNumericWhoisServer(), KviIrcServerParser::parseNumericWhoisUser(), and KviIrcServerParser::parseNumericWhospcrpl().
|
protected |
Gather the list of currently joined channels with the relative passwords.
References m_pChannelList.
Referenced by KviIrcContext::connectionTerminated().
|
protected |
Gather the list of currently open query names.
References m_pQueryList, and q.
Referenced by KviIrcContext::connectionTerminated().
int KviIrcConnection::getCommonChannels | ( | const QString & | szNick, |
QString & | szChansBuffer, | ||
bool | bAddEscapeSequences = true ) |
Returns a list of channels bound to the current connection.
This is actually the list of channels that the local user has in common with the specified user. The list is returned as a comma separated string. If bAddEscapeSequences is true, then the string includes special escape sequences for KviIrcView that will make the channel names clickable.
Returns the number of channels found.
szNick | The nickname of the user |
szChansBuffer | The buffer where to store data |
bAddEscapeSequences | Whether to include escape sequences |
References KviQString::appendFormatted(), and m_pChannelList.
Referenced by chan_kvs_fnc_common(), KviIrcServerParser::parseLiteralJoin(), KviIrcServerParser::parseLiteralKick(), KviIrcServerParser::parseLiteralNick(), KviIrcServerParser::parseLiteralPart(), and KviQueryWindow::setTarget().
|
protected |
Called when AUTHENTICATE answer is received.
References encodeText(), KviSASL::externalMethod(), m_pStateData, KviSASL::plainMethod(), KviCString::ptr(), sendFmtData(), and target().
Referenced by KviIrcServerParser::parseLiteralAuthenticate().
|
protected |
Called when CAP LS negotiation fails.
References __tr2qs, KVI_OUT_SYSTEMMESSAGE, loginToIrcServer(), m_pConsole, and m_pStateData.
Referenced by KviIrcServerParser::parseNumericNotRegistered().
|
protected |
Called when CAP ACK answer is received.
References endInitialCapNegotiation(), KVI_OPTION_BOOL, KviOption_boolUseSSLCertificate, link(), m_pStateData, sendFmtData(), and target().
Referenced by KviIrcServerParser::parseLiteralCap().
|
protected |
Called when CAP LS answer is received.
References endInitialCapNegotiation(), link(), m_pStateData, sendFmtData(), serverInfo(), and target().
Referenced by KviIrcServerParser::parseLiteralCap().
|
protected |
Called when CAP NAK answer is received.
References endInitialCapNegotiation().
Referenced by KviIrcServerParser::parseLiteralCap().
|
protected |
Called once in a while (every 5 secs at the moment)
tNow | The current time |
References __tr2qs, _OUTPUT_PARANOIC, KviCString::append(), Connected, console(), encodeText(), KviCString::Format, KVI_OPTION_BOOL, KVI_OUT_VERBOSE, kvi_time_t, KviOption_boolEnableAwayListUpdates, KviLagMeter::lagCheckRegister(), lagMeter(), KviChannelWindow::lastReceivedWhoReply(), m_eState, m_pChannelList, m_pStateData, KviWindow::output(), KviCString::ptr(), sendFmtData(), serverInfo(), KviIrcConnectionStateData::setLastSentChannelWhoRequest(), KviChannelWindow::setSentSyncWhoRequest(), stateData(), and KviWindow::windowName().
|
privateslot |
Called when the hostname lookup is finished.
References __tr2qs, KviError::getDescription(), KVI_OUT_SYSTEMMESSAGE, m_pConsole, m_pLocalhostDns, m_pUserInfo, and KviDnsResolver::Success.
Referenced by userInfoReceived().
void KviIrcConnection::incomingMessage | ( | const char * | pcMessage | ) |
This function is part of the networking stack.
It's called by KviIrcLink OR KviMexLinkFilter when a message is arriving from the server. Needs to be public because subclasses of KviMexLinkFilter may call it.
pcMessage | The message :) |
References context(), g_pServerParser, kvi_unixTime, m, and m_pStatistics.
void KviIrcConnection::incomingMessageNoFilter | ( | const char * | pcMessage | ) |
This function is part of the networking stack.
It's called by KviIrcDataStreamMonitor subclasses when they want to inject some message without getting it filtered again
pcMessage | The message :) |
References g_pServerParser, kvi_unixTime, and m_pStatistics.
|
protected |
Joins a list of channels. The first element of the pair is the channel name, the second element of the pair is the eventual password. May send multiple JOIN messages.
References encodeText(), and sendFmtData().
Referenced by loginComplete().
void KviIrcConnection::keepChannelsOpenAfterDisconnect | ( | ) |
Marks all the currently existing channels as DEAD.
They are preserved across connections. Marking a channel as dead actually removes the ownership of KviChannelWindow from KviIrcConnection and moves it to KviIrcContext (as the contex is preserved across connections).
References __tr2qs, KVI_OUT_SOCKETERROR, m_pChannelList, KviWindow::outputNoFmt(), and KviChannelWindow::setDeadChan().
Referenced by KviIrcContext::connectionTerminated().
void KviIrcConnection::keepQueriesOpenAfterDisconnect | ( | ) |
Marks all the currently open queries as DEAD.
They are kept open after a disconnect. Marking a query as dead removes ownership from this class and gives it to KviIrcContext (which survives disconnects).
References __tr2qs, KVI_OUT_SOCKETERROR, m_pQueryList, and q.
Referenced by KviIrcContext::connectionTerminated().
|
inline |
Returns a pointer to the current KviLagMeter.
The returned pointer is nullptr if lag measurement is disabled for the current connection.
References m_pLagMeter.
Referenced by KviIrcContextDisplay::drawContents(), heartbeat(), KviStatusBarLagIndicator::mouseDoubleClickEvent(), KviIrcServerParser::parseCtcpReplyLagcheck(), KviIrcServerParser::parseLiteralPong(), KviIrcServerParser::parseNumericEndOfWho(), KviIrcConnectionRequestQueue::timerSlot(), KviIrcContextDisplay::tipRequest(), KviStatusBarLagIndicator::tipText(), and KviStatusBarLagIndicator::updateDisplay().
|
inline |
Returns the underlying KviIrcLink object.
The returned pointer is never nullptr.
References KviIrcLink, and m_pLink.
Referenced by context_kvs_fnc_getSSLCertInfo(), dcc_kvs_get_listen_ip_address(), handleInitialCapAck(), handleInitialCapLs(), linkEstablished(), and resolveLocalHost().
|
protected |
This signals that the connection attempt has failed.
iError | The error code |
References KviIrcContext::connectionFailed(), context(), g_pMainWindow, Idle, KVI_INTERNALCOMMAND_IDENT_STOP, m_bIdentdAttached, and m_eState.
|
protected |
Called by KviIrcLink when the socket state changes to Connected.
References Connected, KviIrcContext::connectionEstablished(), context(), kvi_unixTime, link(), loginToIrcServer(), m, m_eState, m_pServerInfo, m_pStateData, m_pStatistics, resolveLocalHost(), sendFmtData(), and target().
|
protected |
Called by KviIrcLink when the socket state changes to Ready.
References KviIrcContext::connectionTerminated(), context(), g_pMainWindow, Idle, KVI_INTERNALCOMMAND_IDENT_STOP, m, m_bIdentdAttached, m_eState, m_pLagMeter, and m_pNotifyListManager.
|
protected |
Called on the first numeric received from server.
szNickName | The nickname to use |
References __tr2qs, _OUTPUT_VERBOSE, KviIrcNetwork::autoJoinChannelList(), KviIrcServer::autoJoinChannelList(), KviIrcServer::clearReconnectInfo(), KviIrcContext::Connected, context(), createQuery(), delayedStartNotifyList(), e, encodeText(), KviIrcUserDataBase::find(), findQuery(), g_pApp, g_pMainWindow, KviIrcServer::initUMode(), joinChannels(), KVI_INTERNALCOMMAND_CHANNELSJOIN_OPEN, KVI_INTERNALCOMMAND_IDENT_STOP, KVI_OPTION_BOOL, KVI_OPTION_STRING, KVI_OUT_IRC, KVI_OUT_SYSTEMMESSAGE, KVI_OUT_VERBOSE, KviEvent_OnIRC, KviOption_boolShowChannelsJoinOnIrc, KviOption_stringDefaultUserMode, KVS_TRIGGER_EVENT_0_HALTED, l, KviIrcContext::loginComplete(), m_bIdentdAttached, m_pConsole, m_pServerInfo, m_pStateData, m_pUserIdentity, m_pUserInfo, KviIrcConnectionTarget::network(), KviIrcNetwork::onLoginCommand(), KviIrcServer::onLoginCommand(), KviCString::ptr(), restartLagMeter(), resurrectDeadQueries(), KviKvsScript::run(), sendFmtData(), KviIrcConnectionTarget::server(), KviQueryWindow::setTarget(), state(), szHost, target(), and userDataBase().
Referenced by KviIrcServerParser::parseNumeric001(), KviIrcServerParser::parseNumeric002(), KviIrcServerParser::parseNumeric003(), KviIrcServerParser::parseNumeric004(), and KviIrcServerParser::parseNumeric005().
|
protected |
Logins to the irc server.
References __tr2qs, _OUTPUT_MUTE, _OUTPUT_VERBOSE, e, encodeText(), KviIrcUserEntry::Female, KviIrcUserDataBase::find(), KviIrcServer::hostName(), KviIdentityProfileSet::instance(), KviIdentityProfileSet::isEmpty(), KviIdentityProfileSet::isEnabled(), KVI_ASSERT, KVI_DEFAULT_USERNAME, KVI_OPTION_BOOL, KVI_OPTION_STRING, KVI_OPTION_UINT, KVI_OUT_SYSTEMMESSAGE, KVI_OUT_VERBOSE, KviOption_boolPrependAvatarInfoToRealname, KviOption_boolPrependGenderInfoToRealname, KviOption_boolPrependNickColorInfoToRealname, KviOption_boolUseSpecifiedSmartColorForOwnNick, KviOption_stringCtcpUserInfoGender, KviOption_stringMyAvatar, KviOption_stringRealname, KviOption_stringUsername, KviOption_uintUserIrcViewOwnBackground, KviOption_uintUserIrcViewOwnForeground, m_pConsole, m_pServerInfo, m_pStateData, m_pUserIdentity, m_pUserInfo, KviIrcServerReconnectInfo::m_szNick, KviIrcServerReconnectInfo::m_szPass, KviIrcUserEntry::Male, KviIrcNetwork::name(), KviIrcConnectionTarget::network(), KviIrcNetwork::onConnectCommand(), KviIrcServer::onConnectCommand(), KviIrcNetwork::password(), KviIrcServer::password(), pickNextLoginNickName(), KviIrcNetwork::realName(), KviIrcServer::realName(), KviIrcServer::reconnectInfo(), KviControlCodes::Reset, KviKvsScript::run(), sendFmtData(), KviIrcConnectionTarget::server(), setupTextCodec(), target(), KviControlCodes::Transparent, KviIrcConnectionStateData::UsedConnectionSpecificNickName, useProfileData(), userDataBase(), useRealName(), userInfo(), KviIrcNetwork::userName(), and KviIrcServer::userName().
Referenced by endInitialCapNegotiation(), handleFailedInitialCapLs(), and linkEstablished().
|
inline |
Returns a pointer to the KviIrcConnectionNetsplitDetectorData object.
It contains data private to the netsplit detector engine. Very similar to KviIrcConnectionStateData but dedicated to netsplit detection. The returned pointer is never nullptr. Include "KviIrcConnectionNetsplitDetectorData.h" as the class is only forwarded here.
References m_pNetsplitDetectorData.
Referenced by KviIrcServerParser::parseLiteralQuit().
|
protected |
Called when NICK is received.
szNewNick | The new nickname for the user |
References g_pApp, g_pMainWindow, m_pConsole, m_pUserInfo, and nickNameChanged().
Referenced by KviIrcServerParser::parseLiteralNick().
|
signal |
|
inline |
Returns a pointer to the current KviNotifyListManager.
The returned pointer is nullptr if notify list management is disabled for the current connection.
References m_pNotifyListManager.
Referenced by KviIrcServerParser::parseNumericIsOn(), KviIrcServerParser::parseNumericUserhost(), and KviIrcServerParser::parseNumericWatch().
unsigned int KviIrcConnection::outputQueueSize | ( | ) |
|
protected |
Picks the next login nickname to be tried. If bForceDefaultIfPrimaryNicknamesEmpty is true then the algorithm will return a default nickname in case the primary setting in the options is empty. If bForceDefaultIfPrimaryNicknamesEmpty is false then the algorithm will try the alternative nicknames instead, then try some random options and finally return an empty string signaling that no suitable choice could be made. bForceDefaultIfPrimaryNicknamesEmpty should be set to true only in loginToIrcServer(), that is, the first time this function is called (otherwise there exists a possibility of infinite nickname loop because of the repeated fallback choice). szBaseNickForRandomChoices will be used for the random alternatives as the first left 7 characters. Upon return szChoiceDescriptionBuffer will contain the textual description of the choice made (network specific, alternative, server specific, global etc...).
References __tr2qs, KviIrcNetwork::alternativeNickName(), KviIrcServer::alternativeNickName(), KviIdentityProfileSet::findNetwork(), KviIdentityProfileSet::instance(), KviIdentityProfileSet::isEmpty(), KviIdentityProfileSet::isEnabled(), KVI_ASSERT, KVI_DEFAULT_NICKNAME1, KVI_OPTION_STRING, KviOption_stringNickname1, KviOption_stringNickname2, KviOption_stringNickname3, KviOption_stringNickname4, m_pStateData, KviIrcNetwork::name(), KviIrcConnectionTarget::network(), KviIdentityProfile::nick(), KviIrcNetwork::nickName(), KviIrcServer::nickName(), KviIrcConnectionTarget::server(), target(), KviIrcConnectionStateData::UsedAlternativeNetworkSpecificNickName, KviIrcConnectionStateData::UsedAlternativeProfileSpecificNickName, KviIrcConnectionStateData::UsedAlternativeServerSpecificNickName, KviIrcConnectionStateData::UsedGlobalNickName1, KviIrcConnectionStateData::UsedGlobalNickName2, KviIrcConnectionStateData::UsedGlobalNickName3, KviIrcConnectionStateData::UsedGlobalNickName4, KviIrcConnectionStateData::UsedManualNickname, KviIrcConnectionStateData::UsedNetworkSpecificNickName, KviIrcConnectionStateData::UsedProfileSpecificNickName, KviIrcConnectionStateData::UsedRandomNickName1, KviIrcConnectionStateData::UsedRandomNickName2, KviIrcConnectionStateData::UsedRandomNickName3, KviIrcConnectionStateData::UsedRandomNickName4, and KviIrcConnectionStateData::UsedServerSpecificNickName.
Referenced by loginToIrcServer(), and KviIrcServerParser::parseLoginNicknameProblem().
|
inline |
Returns the list of the currently open queries.
The returned pointer is never nullptr (the list may be empty though).
References m_pQueryList.
Referenced by KviConsoleWindow::getWindowListTipText(), and KviIrcServerParser::parseLiteralNick().
void KviIrcConnection::registerChannel | ( | KviChannelWindow * | c | ) |
This is called by KviChannelWindow upon creation. You shouldn't need to call it.
FIXME: Could be made protected.
References chanListChanged(), channelRegistered(), g_pApp, KVI_OPTION_BOOL, KviOption_boolLogChannelHistory, m_pChannelList, m_pServerInfo, and KviWindow::windowName().
Referenced by KviChannelWindow::KviChannelWindow(), and KviChannelWindow::setAliveChan().
void KviIrcConnection::registerQuery | ( | KviQueryWindow * | q | ) |
This is called by KviQueryWindow upon creation, you shouldn't need to use it.
FIXME: Could be made protected.
References m_pQueryList, and q.
Referenced by KviQueryWindow::KviQueryWindow(), and KviQueryWindow::setAliveQuery().
|
inline |
Returns a pointer to the current KviIrcConnectionRequestQueue.
References m_pRequestQueue.
Referenced by KviIrcContext::connectionTerminated(), KviIrcServerParser::parseLiteralJoin(), and unregisterChannel().
|
protected |
Resolves the localhost into an IP address.
References __tr2qs, _OUTPUT_MUTE, _OUTPUT_QUIET, KviNetUtils::isValidStringIp(), KVI_OPTION_STRING, KVI_OUT_SYSTEMMESSAGE, KVI_OUT_SYSTEMWARNING, KviOption_stringLocalHostIp, link(), m_pConsole, m_pUserInfo, and target().
Referenced by linkEstablished().
void KviIrcConnection::restartLagMeter | ( | ) |
This function actually restarts the lag meter.
FIXME: Why ?
References KVI_OPTION_BOOL, KviOption_boolUseLagMeterEngine, and m_pLagMeter.
Referenced by loginComplete(), and KviApplication::restartLagMeters().
|
slot |
Called to restart the notify list.
References __tr2qs, _OUTPUT_VERBOSE, KVI_OPTION_BOOL, KVI_OUT_VERBOSE, KviOption_boolUseIntelligentNotifyListManager, KviOption_boolUseNotifyList, KviOption_boolUseWatchListIfAvailable, m_pConsole, m_pNotifyListManager, m_pNotifyListTimer, and serverInfo().
Referenced by delayedStartNotifyList(), endOfMotdReceived(), and KviApplication::restartNotifyLists().
void KviIrcConnection::resurrectDeadQueries | ( | ) |
This is the inverse of keepQueriesOpenAfterDisconnect().
It's meant to be called upon reconnection (as queries don't need a JOIN message to be opened).
References __tr2qs, KVI_OUT_SOCKETMESSAGE, m_pContext, and q.
Referenced by loginComplete().
bool KviIrcConnection::sendData | ( | const char * | pcBuffer, |
int | iBuflen = -1 ) |
Sends the specified text on the connected link (and thus socket).
This function basically works like sprintf(). Please note that you should send only ENCODED text to the server. This is why the accepted parameter is a const char *. IRC is an 8 (I'd say even 7 sometimes) bit protocol.
Please note that you don't actually need to append a CRLF pair to your buffer: the implementation of the networking stack will do it for you. Hovewer you can send multiple IRC commands by separating them by CRLF pairs. Just take care of avoiding a CRLF after the last command you specify.
Returns true on success or false if the data can't be actually enqueued/sent (and this usually means that there is no connection at the moment). Please note that it MAY happen that a send attempt on a correctly connected link causes the link to actually disconnect (or rather "discover" the fact that it's disconnected at OS level).
pcBuffer | The encoded text data to send |
iBuflen | The length of the data: if -1 the length is determined via strlen(). |
References __tr2qs, _OUTPUT_MUTE, context(), KviDataBuffer::data(), KVI_OUT_SOCKETWARNING, KviEvent_OnOutboundTraffic, KVS_TRIGGER_EVENT_1, m, m_pConsole, m_pLink, and KviMemory::move().
Referenced by KviKvsTreeNodeAliasSimpleCommand::execute(), and KviIrcUrl::run().
bool KviIrcConnection::sendFmtData | ( | const char * | pcFmt, |
... ) |
Sends the specified text on the connected link (and thus socket).
This function basically works like sprintf(). Please note that you should send only ENCODED text to the server. This is why the accepted parameter is a const char *. IRC is an 8 (I'd say even 7 sometimes) bit protocol.
Please note that you don't actually need to append a CRLF pair to your buffer: the implementation of the networking stack will do it for you. Hovewer you can send multiple IRC commands by separating them by CRLF pairs. Just take care of avoiding a CRLF after the last command you specify.
Returns true on success or false if the data can't be actually enqueued/sent (and this usually means that there is no connection at the moment). Please note that it MAY happen that a send attempt on a correctly connected link causes the link to actually disconnect (or rather "discover" the fact that it's disconnected at OS level).
pcFmt | The format string to be first sprintf'ed with the variadic params and then sent |
... | The variadic arguments (see man sprintf for an explanation) |
FIXME: change name to sendFormattedData() ?
References __tr2qs, _OUTPUT_MUTE, context(), KviDataBuffer::data(), kvi_irc_vsnprintf(), KVI_OUT_SOCKETWARNING, kvi_va_end, kvi_va_list, kvi_va_start, KviEvent_OnOutboundTraffic, KVS_TRIGGER_EVENT_1, m, m_pConsole, m_pLink, and KviDataBuffer::resize().
Referenced by avatar_kvs_cmd_notify(), avatar_kvs_cmd_query(), KviChannelWindow::closeEvent(), dcc_kvs_cmd_get(), dcc_module_reply_errmsg(), dccModuleParseDccGet(), KviTrayIconWidget::doAway(), endInitialCapNegotiation(), handleAuthenticate(), handleInitialCapAck(), handleInitialCapLs(), DccBroker::handleResumeRequest(), heartbeat(), joinChannels(), KviKvsCoreSimpleCommands::KVSCSC(), KviKvsCoreSimpleCommands::KVSCSC(), linkEstablished(), loginComplete(), loginToIrcServer(), KviIrcServerParser::parseCtcpReplyAvatar(), KviIrcServerParser::parseLiteralInvite(), KviIrcServerParser::parseLiteralKick(), KviIrcServerParser::parseLiteralPing(), KviIrcServerParser::parseLoginNicknameProblem(), KviIrcServerParser::parseNumeric005(), KviIrcServerParser::parseNumericAway(), KviIrcServerParser::parseNumericBackFromAway(), KviIrcServerParser::parseNumericSaslFail(), KviIrcServerParser::parseNumericWhospcrpl(), KviChannelWindow::removeMasks(), KviIrcServerParser::replyCtcp(), DccBroker::rsendExecute(), KviChannelWindow::setAliveChan(), KviChannelWindow::setMode(), KviIrcContext::terminateConnectionRequest(), KviIrcConnectionRequestQueue::timerSlot(), KviChannelWindow::toggleListModeEditor(), and KviChannelWindow::topicSelected().
|
inline |
Returns a pointer to the current global codec for inbound data.
This codec is a global setting and may be overridden by specific windows. The returned pointer may be null if things really went wrong.
References m_pSrvCodec.
|
inline |
Returns a pointer to the KviIrcConnectionServerInfo object.
It contains runtime information about the current server. This includes the current servername, the server capabilities and other stuff that KviConnectionTarget actually doesn't contain (or has only "default" values for). The returned pointer is never nullptr. Include "KviIrcConnectionServerInfo.h" as the class is only forwarded here.
References m_pServerInfo.
Referenced by currentServerName(), KviConsoleWindow::fillStatusString(), handleInitialCapLs(), heartbeat(), KviIrcServerParser::parseChannelMode(), KviIrcServerParser::parseCtcpRequestAction(), KviIrcServerParser::parseLiteralCap(), KviIrcServerParser::parseLiteralJoin(), KviIrcServerParser::parseLiteralNotice(), KviIrcServerParser::parseLiteralPrivmsg(), KviIrcServerParser::parseNumeric004(), KviIrcServerParser::parseNumeric005(), KviIrcServerParser::parseNumeric344(), KviIrcServerParser::parseNumeric345(), KviIrcServerParser::parseNumeric480(), KviIrcServerParser::parseNumeric486(), KviIrcServerParser::parseNumeric728(), KviIrcServerParser::parseNumeric729(), KviIrcServerParser::parseNumericCodePageScheme(), KviIrcServerParser::parseNumericCodePageSet(), KviIrcServerParser::parseNumericNames(), KviIrcServerParser::parseNumericSaslLogin(), KviIrcServerParser::parseUserMode(), restartNotifyList(), KviChannelWindow::serverInfo(), serverInfoReceived(), and KviTopicWidget::switchMode().
|
protected |
Called when RPL_SERVINFO (004) is received and sets the info.
szServerName | The name of the server |
szUserModes | The user modes supported by the server |
szChanModes | The chan modes supported by the server |
References g_pMainWindow, m_pConsole, serverInfo(), KviIrcConnectionServerInfo::setName(), KviIrcConnectionServerInfo::setSupportedChannelModes(), and KviIrcConnectionServerInfo::setSupportedUserModes().
Referenced by KviIrcServerParser::parseNumeric004().
void KviIrcConnection::setEncoding | ( | const QString & | szEncoding | ) |
Sets the global encoding for this connection.
This is a default value and can be overridden by specific windows. This is tipically called upon a successful CODEPAGE change (numerical 222) response from a server; from now on, the server will translate (encode) everything (including IDN hostnames, channel names, messages) using this encoding. So we expect this encoding to be the new default for the server (connection), the console, each other channel and query.
szEncoding | The encoding to use |
References __tr2qs, _OUTPUT_VERBOSE, KviLocale::codecForName(), KviLocale::instance(), KVI_OUT_SYSTEMERROR, KVI_OUT_VERBOSE, m_pChannelList, m_pConsole, m_pQueryList, m_pSrvCodec, m_pTextCodec, and q.
Referenced by KviIrcServerParser::parseNumeric005(), and KviIrcServerParser::parseNumericCodePageSet().
|
private |
Setups the codec for the server.
References KviLocale::codecForName(), KviApplication::defaultSrvCodec(), KviLocale::instance(), m_pConsole, m_pSrvCodec, and m_pTarget.
Referenced by KviIrcConnection().
|
private |
Setups the codec for the text.
References KviLocale::codecForName(), KviApplication::defaultTextCodec(), KviLocale::instance(), m_pTarget, and m_pTextCodec.
Referenced by KviIrcConnection(), and loginToIrcServer().
|
protected |
This starts an asynchronous connection attempt.
You must return control to the Qt core for the connection operations to be initiated
References Connecting, g_pMainWindow, KVI_INTERNALCOMMAND_IDENT_START, KVI_OPTION_BOOL, KviOption_boolUseIdentService, KviOption_boolUseIdentServiceOnlyOnConnect, m_bIdentdAttached, m_eState, and m_pLink.
|
inline |
Returns the current state of the connection.
References m_eState.
Referenced by loginComplete(), KviStatusBarAwayIndicator::mouseDoubleClickEvent(), KviStatusBarLagIndicator::mouseDoubleClickEvent(), KviStatusBarAwayIndicator::tipText(), and KviStatusBarLagIndicator::tipText().
|
inline |
Returns a pointer to the KviIrcConnectionStateData object.
It contains generic connection state data. This includes the current nickname index at login time, flags that signal "micro-states" etc... This data could be part of KviIrcConnection itself but we prefer to keep it in a separate class in order to cleanup the implementation. The returned pointer is never nullptr. Include "KviIrcConnectionStateData.h" as the class is only forwarded here.
References m_pStateData.
Referenced by KviIrcContext::connectionTerminated(), heartbeat(), KviIrcServerParser::parseLiteralCap(), KviIrcServerParser::parseLiteralJoin(), KviIrcServerParser::parseLiteralPrivmsg(), KviIrcServerParser::parseMessage(), KviIrcServerParser::parseNumericCodePageScheme(), KviIrcServerParser::parseNumericEndOfWho(), KviIrcServerParser::parseNumericEndOfWhois(), KviIrcServerParser::parseNumericEndOfWhowas(), KviIrcServerParser::parseNumericNotRegistered(), KviIrcServerParser::parseNumericSaslFail(), KviIrcServerParser::parseNumericSaslLogin(), KviIrcServerParser::parseNumericSaslSuccess(), KviIrcServerParser::parseNumericStartTls(), KviIrcServerParser::parseNumericWhoisActually(), KviIrcServerParser::parseNumericWhoisAuth(), KviIrcServerParser::parseNumericWhoisAway(), KviIrcServerParser::parseNumericWhoisChannels(), KviIrcServerParser::parseNumericWhoisIdle(), KviIrcServerParser::parseNumericWhoisOther(), KviIrcServerParser::parseNumericWhoisRegistered(), KviIrcServerParser::parseNumericWhoisServer(), KviIrcServerParser::parseNumericWhoisUser(), KviIrcServerParser::parseNumericWhowasUser(), KviIrcContext::terminateConnectionRequest(), and KviIrcConnectionRequestQueue::timerSlot().
|
inline |
Returns a pointer to the KviIrcConnectionStatistics object.
It contains runtime statistics about the connection. Very similar to KviIrcConnectionStateData but dedicated to statistics. The returned pointer is never nullptr. Include "KviIrcConnectionStatistics.h" as the class is only forwarded here.
References m_pStatistics.
Referenced by KviStatusBarConnectionTimer::timerEvent().
|
inline |
Returns the target of this connection.
Please note that the target doesn't necessairly contain up-to-date data. You might want to look at serverInfo() instead. The returned pointer is never nullptr.
References m_pTarget.
Referenced by chan_kvs_fnc_getUrl(), KviConsoleWindow::getBaseLogFileName(), handleAuthenticate(), handleInitialCapAck(), handleInitialCapLs(), KviConsoleWindow::isIPv6Connection(), KviIrcLink::KviIrcLink(), linkEstablished(), loginComplete(), loginToIrcServer(), KviIrcServerParser::parseLiteralNotice(), KviIrcServerParser::parseNumericSaslFail(), pickNextLoginNickName(), resolveLocalHost(), KviIrcUrl::run(), and KviConsoleWindow::updateUri().
|
inline |
Returns a pointer to the current global codec for outbound text.
This codec is a global setting and may be overridden by specific windows. The returned pointer may be null if things really went wrong.
References m_pTextCodec.
Referenced by KviWindow::defaultTextCodec().
|
slot |
Called when we unhighlight all channels.
References m_pChannelList, and KviChannelWindow::unhighlight().
|
slot |
void KviIrcConnection::unregisterChannel | ( | KviChannelWindow * | c | ) |
This is called by KviChannelWindow just before destruction. You shouldn't need to call it.
FIXME: Could be made protected.
References chanListChanged(), channelUnregistered(), KviIrcConnectionRequestQueue::dequeueChannel(), m_pChannelList, and requestQueue().
Referenced by KviChannelWindow::setDeadChan(), and KviChannelWindow::~KviChannelWindow().
void KviIrcConnection::unregisterQuery | ( | KviQueryWindow * | q | ) |
This is called by KviQueryWindow just before destruction, you shouldn't need to use it.
FIXME: Could be made protected.
References m_pQueryList, and q.
Referenced by KviQueryWindow::setDeadQuery(), and KviQueryWindow::~KviQueryWindow().
|
protected |
Uses the profiles' data as connection data.
It checks if the identity profiles are enabled and updates the data of the connection if a profile rule matches the network name
pSet | The instance of the network identity profile set |
szNetwork | The name of the network |
References KviIdentityProfileSet::findNetwork(), m_pUserInfo, KviIdentityProfile::realName(), useRealName(), and KviIdentityProfile::userName().
Referenced by loginToIrcServer().
|
inline |
Returns a pointer to the big connection user database.
The database contains ALL the users KVIrc can "see" in this connection. The returned pointer is never nullptr.
References m_pUserDataBase.
Referenced by KviConsoleWindow::applyHighlighting(), avatar_kvs_cmd_notify(), avatar_kvs_cmd_set(), avatar_kvs_cmd_unset(), avatar_kvs_fnc_name(), avatar_kvs_fnc_path(), KviConsoleWindow::avatarChanged(), changeAwayState(), KviConsoleWindow::checkDefaultAvatar(), KviConsoleWindow::currentAvatar(), KviQueryWindow::getInfoLabelText(), KviQueryWindow::getWindowListTipText(), KviIsOnNotifyListManager::handleIsOn(), loginComplete(), loginToIrcServer(), KviConsoleWindow::outputPrivmsg(), KviIrcServerParser::parseCtcpReplyAvatar(), KviIrcServerParser::parseCtcpReplyUserinfo(), KviIrcServerParser::parseCtcpRequest(), KviIrcServerParser::parseCtcpRequestDcc(), KviIrcServerParser::parseLiteralAccount(), KviIrcServerParser::parseLiteralAway(), KviIrcServerParser::parseLiteralChghost(), KviIrcServerParser::parseLiteralInvite(), KviIrcServerParser::parseLiteralJoin(), KviIrcServerParser::parseLiteralKick(), KviIrcServerParser::parseLiteralNick(), KviIrcServerParser::parseLiteralNotice(), KviIrcServerParser::parseLiteralPrivmsg(), KviIrcServerParser::parseNumericWhoisAway(), KviIrcServerParser::parseNumericWhoisServer(), KviIrcServerParser::parseNumericWhoisUser(), KviIrcServerParser::parseNumericWhospcrpl(), KviQueryWindow::setAliveQuery(), KviConsoleWindow::setAvatar(), KviConsoleWindow::setAvatarFromOptions(), KviConsoleWindow::triggerOnHighlight(), and userInfoReceived().
|
protected |
Sets the specified real name in the user information set after evaluating it via KVS engine (so identifiers are substituted). Call this function instead of m_pUserInfo->setRealName().
References KviKvsVariant::asString(), console(), KviQString::escapeKvs(), KviKvsScript::evaluate(), m_pUserInfo, KviQString::PermitFunctions, and KviQString::PermitVariables.
Referenced by loginToIrcServer(), and useProfileData().
|
inline |
Returns a pointer to the KviIrcConnectionUserInfo object.
It contains runtime information about the user. This includes the current nickname, username, flags and other stuff that KviUserIdentity actually doesn't contain (or has only "default" values for). The returned pointer is never nullptr. Include "KviIrcConnectionUserInfo.h" as the class is only forwarded here.
References m_pUserInfo.
Referenced by avatar_kvs_cmd_set(), avatar_kvs_cmd_unset(), changeAwayState(), KviIrcContext::connectionFailed(), KviIrcContext::connectionTerminated(), currentNickName(), currentUserName(), dcc_fill_local_nick_user_host(), KviTrayIconWidget::doAway(), KviIrcContextDisplay::drawContents(), KviTrayIconWidget::fillContextPopup(), KviConsoleWindow::fillStatusString(), loginToIrcServer(), KviStatusBar::mouseDoubleClickEvent(), KviConsoleWindow::outputPrivmsg(), KviChannelWindow::ownAction(), KviQueryWindow::ownAction(), KviChannelWindow::ownMessage(), KviQueryWindow::ownMessage(), KviIrcServerParser::parseChannelMode(), KviIrcServerParser::parseCtcpRequestFinger(), KviIrcServerParser::parseLoginNicknameProblem(), KviUserInput::parseNonCommand(), KviIrcServerParser::parseNumeric001(), KviIrcServerParser::parseNumericBackFromAway(), KviStatusBar::setPermanentMessage(), KviTopicWidget::switchMode(), KviIrcContextDisplay::tipRequest(), KviStatusBarAwayIndicator::tipText(), KviStatusBarAwayIndicator::updateDisplay(), and userInfoReceived().
|
protected |
Called on each JOIN and sets the info.
It's called meaningful almost only on the first time
szUserName | The username |
szHostName | The hostname |
References __tr2qs, _OUTPUT_MUTE, KviDnsResolver::Any, connect(), e, KviQString::equalCS(), KviIrcUserDataBase::find(), hostNameLookupTerminated(), KviNetUtils::isRoutableIpString(), KviNetUtils::isValidStringIp(), KVI_OPTION_BOOL, KVI_OUT_SYSTEMMESSAGE, KVI_OUT_SYSTEMWARNING, KviOption_boolDccBrokenBouncerHack, KviOption_boolDccGuessIpFromServerWhenLocalIsUnroutable, m_pConsole, m_pLocalhostDns, m_pUserInfo, KviIrcConnectionUserInfo::setUserName(), userDataBase(), and userInfo().
Referenced by KviIrcServerParser::parseLiteralJoin(), and KviIrcServerParser::parseNumeric001().
|
signal |
|
friend |
References KviConsoleWindow.
Referenced by console(), and KviConsoleWindow.
|
friend |
References KviIrcContext.
Referenced by context(), KviIrcConnection(), KviIrcContext, and KviIrcServerParser.
|
friend |
References KviIrcLink.
Referenced by KviIrcConnection(), KviIrcLink, and link().
|
friend |
References KviIrcConnection(), KviIrcContext, and KviIrcServerParser.
Referenced by KviIrcServerParser.
|
private |
Referenced by linkAttemptFailed(), linkTerminated(), loginComplete(), start(), and ~KviIrcConnection().
Referenced by heartbeat(), linkAttemptFailed(), linkEstablished(), linkTerminated(), start(), and state().
|
private |
Referenced by antiCtcpFloodData(), KviIrcConnection(), and ~KviIrcConnection().
|
private |
Referenced by asyncWhoisData(), KviIrcConnection(), and ~KviIrcConnection().
|
private |
|
private |
Referenced by changeAwayState(), changeUserMode(), console(), createChannel(), createQuery(), handleFailedInitialCapLs(), hostNameLookupTerminated(), KviIrcConnection(), loginComplete(), loginToIrcServer(), nickChange(), resolveLocalHost(), restartNotifyList(), sendData(), sendFmtData(), serverInfoReceived(), setEncoding(), setupSrvCodec(), and userInfoReceived().
|
private |
Referenced by context(), createChannel(), createQuery(), KviIrcConnection(), and resurrectDeadQueries().
|
private |
Referenced by lagMeter(), linkTerminated(), restartLagMeter(), and ~KviIrcConnection().
|
private |
Referenced by abort(), clearOutputQueue(), KviIrcConnection(), link(), outputQueueSize(), sendData(), sendFmtData(), start(), and ~KviIrcConnection().
|
private |
Referenced by hostNameLookupTerminated(), userInfoReceived(), and ~KviIrcConnection().
|
private |
Referenced by KviIrcConnection(), netsplitDetectorData(), and ~KviIrcConnection().
|
private |
Referenced by linkTerminated(), notifyListManager(), restartNotifyList(), and ~KviIrcConnection().
|
private |
Referenced by delayedStartNotifyList(), endOfMotdReceived(), restartNotifyList(), and ~KviIrcConnection().
|
private |
|
private |
Referenced by KviIrcConnection(), requestQueue(), and ~KviIrcConnection().
|
private |
|
private |
Referenced by decodeText(), encodeText(), serverCodec(), setEncoding(), and setupSrvCodec().
|
private |
|
private |
Referenced by incomingMessage(), incomingMessageNoFilter(), KviIrcConnection(), linkEstablished(), and statistics().
|
private |
Referenced by KviIrcConnection(), setupSrvCodec(), setupTextCodec(), target(), and ~KviIrcConnection().
|
private |
Referenced by setEncoding(), setupTextCodec(), and textCodec().
|
private |
Referenced by KviIrcConnection(), userDataBase(), and ~KviIrcConnection().
|
private |
Referenced by KviIrcConnection(), loginComplete(), loginToIrcServer(), and ~KviIrcConnection().
|
private |