IRCRequestParser Class Reference

Parses request and interprets them in a way that emulates mIRC (or any even slightly sane IRC client for that matter). More...

#include <ircrequestparser.h>

+ Inheritance diagram for IRCRequestParser:

Public Types

enum  IRCRequestParseResult {
  Ok, ErrorMessageTooLong, ErrorMessageEmpty, ErrorInputNotPrependedWithSlash,
  ErrorInputInsufficientParameters, ErrorChatWindowOnly, QuitCommand
}
 

Signals

void echoPrivmsg (const QString &recipient, const QString &content)
 Echoes back all PRIVMSG commands. More...
 
void query (const QString &who)
 Emitted when "/query" alias is used. More...
 

Public Member Functions

const QString & output () const
 
IRCRequestParseResult parse (IRCAdapterBase *pAdapter, QString input)
 Parses input string and returns it through output string. Additional information is passed through return value. More...
 

Detailed Description

Parses request and interprets them in a way that emulates mIRC (or any even slightly sane IRC client for that matter).

The above statement means that a non-RFC compliant request form that users grew accustomed to will be understood correctly by this parser and converted to RFC 1459 compliant form.

For example:

  • If RFC command begins with '/' character this character will be always trimmed. If command doesn't begin with '/' character error will be returned. Example: "/who <nickname>" will be converted to "who <nickname>"
  • ':' characters will be inserted into some commands. Example: "/part #channel I am leaving!" to "part #channel :I am leaving!"

For more information refer to parse() method.

Definition at line 53 of file ircrequestparser.h.

Member Function Documentation

void IRCRequestParser::echoPrivmsg ( const QString &  recipient,
const QString &  content 
)
signal

Echoes back all PRIVMSG commands.

Parameters
recipientRecipient of the message. This is extracted directly from the privmsg request.
messageContentContent of the message.
IRCRequestParser::IRCRequestParseResult IRCRequestParser::parse ( IRCAdapterBase pAdapter,
QString  input 
)

Parses input string and returns it through output string. Additional information is passed through return value.

Parameters
pAdapterAdapter that sends the message.
inputInput message in common format. See IRCRequestParser description.
Returns
This method will:
  • Check if message fits in the RFC 1459 max message length. If not ErrorMessageTooLong is returned.
  • Return ErrorMessageEmpty if input is empty or consists only of whitespace.
  • Check if input starts with '/' character. If not ErrorInputNotPrependedWithSlash is returned.
  • Return ErrorInputInsufficientParameters if parsed command expects more parameters to work correctly.
  • ErrorChatWindowOnly is returned if command applies only to chat windows.
  • QuitCommand is returned if "/quit" command is used.
  • Ok is returned if it is ok to send the output message. Parsed message can be extracted through output() accessor.

Definition at line 64 of file ircrequestparser.cpp.

void IRCRequestParser::query ( const QString &  who)
signal

Emitted when "/query" alias is used.

This signal will only be emitted if the query parameter specifies a valid user name.

Parameters
whoA clean nickname.

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