mirror of https://github.com/SeanOMik/znc-push.git
Issue #198: Implement dictionary string expansion
This commit is contained in:
parent
3a09f6c1fc
commit
df891c0c69
21
notifo.cpp
21
notifo.cpp
|
@ -137,6 +137,27 @@ class CNotifoMod : public CModule
|
|||
notifo_auth = auth.Base64Encode_n();
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs string expansion on a set of keywords.
|
||||
* Given an initial string and a dictionary of string replacments,
|
||||
* iterate over the dictionary, expanding keywords one-by-one.
|
||||
*
|
||||
* @param content String contents
|
||||
* @param replace Dictionary of string replacements
|
||||
* @return Result of string replacements
|
||||
*/
|
||||
CString expand(const CString& content, MCString& replace)
|
||||
{
|
||||
CString result = content.c_str();
|
||||
|
||||
for(MCString::iterator i = replace.begin(); i != replace.end(); i++)
|
||||
{
|
||||
result.Replace(i->first, i->second);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to the currently-configured Notifo account.
|
||||
* Requires (and assumes) that the user has already configured their
|
||||
|
|
Loading…
Reference in New Issue