Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/kvirc/kernel/KviIrcConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,17 +402,20 @@ void KviIrcConnection::enableStartTlsSupport(bool bEnable)
#endif // COMPILE_SSL_SUPPORT

const static QStringList ourSupportedCaps {
// "sasl", // checked dynamically
"znc.in/server-time-iso",
"server-time",
"multi-prefix",
"away-notify",
"account-notify",
"away-notify",
"batch",
"cap-notify",
"chghost",
"draft/chathistory",
"extended-join",
"message-tags",
"multi-prefix",
// "sasl", // checked dynamically
"server-time",
"userhost-in-names",
"chghost",
"znc.in/self-message",
"cap-notify"
"znc.in/server-time-iso",
};

void KviIrcConnection::handleInitialCapLs()
Expand Down
5 changes: 5 additions & 0 deletions src/kvirc/kernel/KviIrcConnectionStateData.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class KVIRC_API KviIrcConnectionStateData
QStringList m_lEnabledCaps; // the CAPs currently enabled
bool m_bIdentifyMsgCapabilityEnabled = false; // do we have the msg-identity CAP enabled ?
QString m_szSentSaslMethod;
QStringList m_lBatchReferenceTags; // list of reference tags of currently active BATCH transactions
public:
///
/// Sets the current login nickname state
Expand Down Expand Up @@ -152,6 +153,10 @@ class KVIRC_API KviIrcConnectionStateData
bool isInsideInitialCapReq() const { return m_bInsideInitialCapReq; }
void setInsideInitialCapReq(bool bInside) { m_bInsideInitialCapReq = bInside; }

const QStringList & batchReferenceTags() const { return m_lBatchReferenceTags; }
void addBatchReferenceTags(const QString &tag) { if(!m_lBatchReferenceTags.contains(tag)) m_lBatchReferenceTags.append(tag); }
void removeBatchReferenceTags(const QString &tag) { m_lBatchReferenceTags.removeAll(tag); }

bool sentQuit() const { return m_bSentQuit; }
void setSentQuit() { m_bSentQuit = true; }

Expand Down
1 change: 1 addition & 0 deletions src/kvirc/kernel/KviOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@ KviMessageTypeSettingsOption g_msgtypeOptionsTable[KVI_NUM_MSGTYPE_OPTIONS] = {
MSGTYPE_OPTION("OwnAction", __tr_no_lookup("Own action"), KviIconManager::OwnAction, KVI_MSGTYPE_LEVEL_1),
MSGTYPE_OPTION("OwnActionCrypted", __tr_no_lookup("Own encrypted action"), KviIconManager::OwnActionCrypted, KVI_MSGTYPE_LEVEL_1),
MSGTYPE_OPTION("TopicCrypted", __tr_no_lookup("Encrypted topic message"), KviIconManager::TopicCrypted, KVI_MSGTYPE_LEVEL_3),
MSGTYPE_OPTION("Batch", __tr_no_lookup("Batch transaction message"), KviIconManager::ServerInfo, KVI_MSGTYPE_LEVEL_1),
};

static const char * options_section_table[KVI_NUM_OPTION_SECT_FLAGS] = {
Expand Down
2 changes: 1 addition & 1 deletion src/kvirc/kernel/KviOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ namespace KviIdentdOutputMode
#define KVI_MSGTYPE_OPTIONS_PREFIX "msgtype"
#define KVI_MSGTYPE_OPTIONS_PREFIX_LEN 7

#define KVI_NUM_MSGTYPE_OPTIONS 149
#define KVI_NUM_MSGTYPE_OPTIONS 150

#define KVI_MIRCCOLOR_OPTIONS_PREFIX "mirccolor"
#define KVI_MIRCCOLOR_OPTIONS_PREFIX_LEN 9
Expand Down
3 changes: 2 additions & 1 deletion src/kvirc/kernel/kvi_out.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@
#define KVI_OUT_OWNACTION 146
#define KVI_OUT_OWNACTIONCRYPTED 147
#define KVI_OUT_TOPICCRYPTED 148
//#define KVI_NUM_MSGTYPE_OPTIONS 149
#define KVI_OUT_BATCH 149
//#define KVI_NUM_MSGTYPE_OPTIONS 150
// UPDATE THE TOTAL COUNT IN KviOptions.h !!!!

#endif //_KVI_OPTIONS_H_
25 changes: 25 additions & 0 deletions src/kvirc/kvs/event/KviKvsEventTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4295,4 +4295,29 @@ KviKvsEvent KviKvsEventManager::m_appEventTable[KVI_KVS_NUM_APP_EVENTS] = {
"$0 = Server\n"
"$1 = Command\n"
"$2 = Protocols"),

/*
@doc: onbatch
@type:
event
@title:
OnBatch
@short:
Received a batch begin/end of transaction message from the IRCd
@parameters:
$0 = Server
$1 = Mode
$2 = Reference tag
$3 = Additional parameters
@window:
Console window
@description:
Triggered when a BATCH message was received from the server
*/

EVENT("OnBatch",
"$0 = Server\n"
"$1 = Mode\n"
"$2 = Reference tag\n"
"$3 = Additional parameters"),
};
3 changes: 2 additions & 1 deletion src/kvirc/kvs/event/KviKvsEventTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#define KviEvent_OnInputBarPaste 146
#define KviEvent_OnBroadcastNotice 148
#define KviEvent_OnCap 157
#define KviEvent_OnBatch 158

// Connection
/**
Expand Down Expand Up @@ -381,6 +382,6 @@
#define KviEvent_OnQueryNickDefaultActionRequest 144

/** \def KVI_KVS_NUM_APP_EVENTS Defines the number of events */
#define KVI_KVS_NUM_APP_EVENTS 158
#define KVI_KVS_NUM_APP_EVENTS 159

#endif //_KVI_KVS_EVENTTABLE_H_
1 change: 1 addition & 0 deletions src/kvirc/sparser/KviIrcServerParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class KVIRC_API KviIrcServerParser : public QObject
void parseLiteralCap(KviIrcMessage * msg);
void parseLiteralAuthenticate(KviIrcMessage * msg);
void parseLiteralAway(KviIrcMessage * msg);
void parseLiteralBatch(KviIrcMessage * msg);

void parseCtcpRequest(KviCtcpMessage * msg);
void parseCtcpReply(KviCtcpMessage * msg);
Expand Down
44 changes: 44 additions & 0 deletions src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2689,3 +2689,47 @@ void KviIrcServerParser::parseLiteralAway(KviIrcMessage * msg)
if(KVS_TRIGGER_EVENT_4_HALTED(KviEvent_OnAway, console, szNick, szUser, szHost, awayMsg))
msg->setHaltOutput();
}

void KviIrcServerParser::parseLiteralBatch(KviIrcMessage * msg)
{
// BATCH
// :prefix BATCH <+|-><reference_tag> [*]

// + means start of batch, - meand end of batch
// all batch messages will contain the message tag @batch=<reference_tag>
// multiple batches can be nested and / or interleaved

QString szPrefix = msg->connection()->decodeText(msg->safePrefix());
QString szRefenceTag = msg->connection()->decodeText(msg->safeParam(0));
QChar szMode;
if(!szRefenceTag.isEmpty()) {
szMode = szRefenceTag.at(0);
szRefenceTag = szRefenceTag.remove(0, 1);
}

KviCString szParms;
for(int i = 1; i < msg->paramCount(); ++i)
{
if(szParms.hasData())
szParms.append(' ');
szParms.append(msg->params()[i]);
}
QString szParams = msg->connection()->decodeText(szParms);

if(KVS_TRIGGER_EVENT_4_HALTED(KviEvent_OnBatch, msg->console(), szPrefix, szMode, szRefenceTag, szParams))
msg->setHaltOutput();

if(szMode == QStringLiteral("+"))
{
msg->connection()->stateData()->addBatchReferenceTags(szRefenceTag);
if(!msg->haltOutput())
msg->console()->output(KVI_OUT_BATCH, __tr2qs("Received batch transation %Q begin: %Q"), &szRefenceTag, &szParams);
}

if(szMode == QStringLiteral("-"))
{
msg->connection()->stateData()->removeBatchReferenceTags(szRefenceTag);
if(!msg->haltOutput())
msg->console()->output(KVI_OUT_BATCH, __tr2qs("Received batch transation %Q end: %Q"), &szRefenceTag, &szParams);
}
}
1 change: 1 addition & 0 deletions src/kvirc/sparser/KviIrcServerParser_tables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ KviLiteralMessageParseStruct KviIrcServerParser::m_literalParseProcTable[] = {
{ "ACCOUNT" , PTM(parseLiteralAccount) },
{ "AUTHENTICATE" , PTM(parseLiteralAuthenticate) },
{ "AWAY" , PTM(parseLiteralAway) },
{ "BATCH" , PTM(parseLiteralBatch) },
{ "CAP" , PTM(parseLiteralCap) },
{ "CHGHOST" , PTM(parseLiteralChghost) },
{ "ERROR" , PTM(parseLiteralError) },
Expand Down
Loading