X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fircdecoder.h;h=fcafcfea5499f94a734fda7cb013da73c709beff;hb=632dd02da3a825f1e38730d73f3a2be518a99689;hp=e4515ec94a56f7562a810671e222d26f9329f772;hpb=53e50ab66a5b3fa00282545ebc22ce3433ecf42b;p=quassel.git diff --git a/src/common/ircdecoder.h b/src/common/ircdecoder.h index e4515ec9..fcafcfea 100644 --- a/src/common/ircdecoder.h +++ b/src/common/ircdecoder.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2019 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -39,6 +39,24 @@ public: * @param parameters[out] Parsed list of parameters */ static void parseMessage(const std::function& decode, const QByteArray& raw, QHash& tags, QString& prefix, QString& command, QList& parameters); + + /** + * Extracts a space-delimited fragment from an IRC message + * @param raw Raw Message + * @param start Current index into the message, will be advanced automatically + * @param end End of fragment, if already known. Default is -1, in which case it will be set to the next whitespace + * character or the end of the string + * @param prefix Required prefix. Default is 0. If set, this only parses a fragment if it starts with the given prefix. + * @return Fragment + */ + static QByteArray extractFragment(const QByteArray& raw, int& start, int end = -1, char prefix = 0); + + /** + * Skips empty parts in the message + * @param raw Raw Message + * @param start Current index into the message, will be advanced automatically + */ + static void skipEmptyParts(const QByteArray& raw, int& start); private: /** * Parses an encoded IRCv3 message tag value