Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Netsplit Class Reference

#include </tmp/quassel/src/core/netsplit.h>

Collaboration diagram for Netsplit:

Signals

void netsplitJoin (Network *net, const QString &channel, const QStringList &users, const QStringList &modes, const QString &quitMessage)
 A bulk-join of netsplitted users timed out.
void earlyJoin (Network *net, const QString &channel, const QStringList &users, const QStringList &modes)
 A (probably bulk-) join of netsplitted users.
void netsplitQuit (Network *net, const QString &channel, const QStringList &users, const QString &quitMessage)
 A bulk-quit of netsplitted users timed out.
void finished ()
 The Netsplit is considered finished.

Public Member Functions

 Netsplit (Network *network, QObject *parent=0)
Networknetwork () const
void userQuit (const QString &sender, const QStringList &channels, const QString &msg)
 Add a user to the netsplit.
bool userJoined (const QString &sender, const QString &channel)
 Remove a user from the netsplit.
bool userAlreadyJoined (const QString &sender, const QString &channel)
 Check if user has joined since netsplit.
void addMode (const QString &sender, const QString &channel, const QString &mode)
 Add mode to user.

Static Public Member Functions

static bool isNetsplit (const QString &quitMessage)
 Check if a string matches the criteria for a netsplit.

Private Slots

void joinTimeout ()
void quitTimeout ()

Private Attributes

Network_network
QString _quitMsg
QHash< QString, QPair
< QStringList, QStringList > > 
_joins
QHash< QString, QStringList > _quits
QHash< QString, QStringList > _quitsWithMessageSent
bool _sentQuit
QTimer _joinTimer
QTimer _quitTimer
QTimer _discardTimer
int _joinCounter
int _quitCounter

Detailed Description

Definition at line 31 of file netsplit.h.

Constructor & Destructor Documentation

Netsplit ( Network network,
QObject *  parent = 0 
)

Definition at line 27 of file netsplit.cpp.

References _discardTimer, _joinTimer, _quitTimer, finished(), joinTimeout(), and quitTimeout().

Member Function Documentation

Network* network ( ) const
inline

Definition at line 37 of file netsplit.h.

References _network.

Referenced by CoreSessionEventProcessor::handleNetsplitFinished(), joinTimeout(), and quitTimeout().

void userQuit ( const QString &  sender,
const QStringList &  channels,
const QString &  msg 
)

Add a user to the netsplit.

Call this method if you noticed a netsplit.

Note
This method doesn't check if it really is a netsplit.
Check with isNetsplit(const QString &quitMessage) before calling it!
Parameters
senderThe sender string of the quitting user
channelsThe channels that user shared with us
msgThe quit message

Definition at line 45 of file netsplit.cpp.

References _quitCounter, _quitMsg, _quits, and _quitTimer.

Referenced by CoreSessionEventProcessor::processIrcEventQuit().

bool userJoined ( const QString &  sender,
const QString &  channel 
)

Remove a user from the netsplit.

Call this method if a user joined after a netsplit occured.

Parameters
senderThe sender string of the joined user
channelThe channel that user shares with us
Returns
true if user was found in the netsplit

Definition at line 58 of file netsplit.cpp.

References _joinCounter, _joins, _joinTimer, _quits, and nickFromMask().

Referenced by CoreSessionEventProcessor::processIrcEventJoin().

bool userAlreadyJoined ( const QString &  sender,
const QString &  channel 
)

Check if user has joined since netsplit.

This method shows if a user has already joined after being hit by netsplit

Note
The method doesn't check if the user was recorded in the netsplit!
Parameters
senderThe sender string of the user
channelThe channel the user shares with us
Returns
true if user joined after a netsplit

Definition at line 93 of file netsplit.cpp.

References _joins.

Referenced by CoreSessionEventProcessor::processIrcEventMode().

void addMode ( const QString &  sender,
const QString &  channel,
const QString &  mode 
)

Add mode to user.

Use this method to buffer userspecific channel modes until netsplitJoin is emitted.

Parameters
senderThe sender string of the user
channelThe channel the user shares with us
Returns
true if user joined after a netsplit

Definition at line 101 of file netsplit.cpp.

References _joins.

Referenced by CoreSessionEventProcessor::processIrcEventMode().

bool isNetsplit ( const QString &  quitMessage)
static

Check if a string matches the criteria for a netsplit.

Parameters
quitMessageThe message to be checked
Returns
true if the message is a netsplit

Definition at line 112 of file netsplit.cpp.

Referenced by CoreSessionEventProcessor::processIrcEventQuit().

void netsplitJoin ( Network net,
const QString &  channel,
const QStringList &  users,
const QStringList &  modes,
const QString &  quitMessage 
)
signal

A bulk-join of netsplitted users timed out.

Whenever the internal join-timer times out, we consider the bulk-join to be finished and emit that signal for every channel. This is the end of a netsplit.

Parameters
netThe network
channelThe IRC channel
usersA list of all users that joined that channel
modesA list of all modes the users got set after joining again
quitMessageThe Quitmessage and thus the servers that got split

Referenced by joinTimeout().

void earlyJoin ( Network net,
const QString &  channel,
const QStringList &  users,
const QStringList &  modes 
)
signal

A (probably bulk-) join of netsplitted users.

If users hit by the split joined before the netsplit is considered over, join the users with a normal join.

Parameters
netThe network
channelThe IRC channel
usersA list of all users that joined that channel
modesA list of all modes the users got set after joining again

Referenced by joinTimeout().

void netsplitQuit ( Network net,
const QString &  channel,
const QStringList &  users,
const QString &  quitMessage 
)
signal

A bulk-quit of netsplitted users timed out.

Whenever the internal quit-timer times out, we consider the bulk-quit to be finished and emit that signal for every channel.

Parameters
netThe network
channelThe IRC channel
usersA list of all users that quitted in that channel
quitMessageThe Quitmessage and thus the servers that got split

Referenced by quitTimeout().

void finished ( )
signal

The Netsplit is considered finished.

This signal is emitted right after all netsplitJoin signals have been sent or whenever the internal timer signals a timeout. Simply delete the object and remove it from structures when you receive that signal.

Referenced by joinTimeout(), and Netsplit().

void joinTimeout ( )
privateslot
void quitTimeout ( )
privateslot

Definition at line 168 of file netsplit.cpp.

References _quitMsg, _quits, _quitsWithMessageSent, _sentQuit, netsplitQuit(), and network().

Referenced by joinTimeout(), and Netsplit().

Member Data Documentation

Network* _network
private

Definition at line 127 of file netsplit.h.

Referenced by network().

QString _quitMsg
private

Definition at line 128 of file netsplit.h.

Referenced by joinTimeout(), quitTimeout(), and userQuit().

QHash<QString, QPair<QStringList, QStringList> > _joins
private

Definition at line 131 of file netsplit.h.

Referenced by addMode(), joinTimeout(), userAlreadyJoined(), and userJoined().

QHash<QString, QStringList> _quits
private

Definition at line 132 of file netsplit.h.

Referenced by quitTimeout(), userJoined(), and userQuit().

QHash<QString, QStringList> _quitsWithMessageSent
private

Definition at line 133 of file netsplit.h.

Referenced by quitTimeout().

bool _sentQuit
private

Definition at line 134 of file netsplit.h.

Referenced by joinTimeout(), and quitTimeout().

QTimer _joinTimer
private

Definition at line 135 of file netsplit.h.

Referenced by joinTimeout(), Netsplit(), and userJoined().

QTimer _quitTimer
private

Definition at line 136 of file netsplit.h.

Referenced by joinTimeout(), Netsplit(), and userQuit().

QTimer _discardTimer
private

Definition at line 137 of file netsplit.h.

Referenced by joinTimeout(), and Netsplit().

int _joinCounter
private

Definition at line 138 of file netsplit.h.

Referenced by joinTimeout(), and userJoined().

int _quitCounter
private

Definition at line 139 of file netsplit.h.

Referenced by joinTimeout(), and userQuit().


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