diff options
author | George Hazan <george.hazan@gmail.com> | 2016-10-04 16:34:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-10-04 16:34:10 +0000 |
commit | bc6043665be0b4d98b578bdd668c79203bc837f5 (patch) | |
tree | 64fe1eb9e100361d9efe782ae103ae3362227e86 /utils | |
parent | a0d490df77bd12fcc1d645b10bb2f7855e971d2e (diff) |
code reordering (local code moved into ListeningTo)
git-svn-id: http://svn.miranda-ng.org/main/trunk@17350 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'utils')
-rw-r--r-- | utils/mir_buffer.h | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/utils/mir_buffer.h b/utils/mir_buffer.h index 3adc17fd4c..f8cfd41fa4 100644 --- a/utils/mir_buffer.h +++ b/utils/mir_buffer.h @@ -434,85 +434,4 @@ class Buffer size_t size; }; - -static void ReplaceVars(Buffer<wchar_t> *buffer, MCONTACT hContact, wchar_t **variables, int numVariables) -{ - if (buffer->len < 3) - return; - - if (numVariables < 0) - return; - - for(size_t i = buffer->len - 1; i > 0; i--) - { - if (buffer->str[i] == '%') - { - // Find previous - size_t j; - for(j = i - 1; j > 0 && ((buffer->str[j] >= 'a' && buffer->str[j] <= 'z') - || (buffer->str[j] >= 'A' && buffer->str[j] <= 'Z') - || buffer->str[j] == '-' - || buffer->str[j] == '_'); j--) ; - - if (buffer->str[j] == '%') - { - size_t foundLen = i - j + 1; - if (foundLen == 9 && wcsncmp(&buffer->str[j], L"%contact%", 9) == 0) - { - buffer->replace(j, i + 1, pcli->pfnGetContactDisplayName(hContact, 0)); - } - else if (foundLen == 6 && wcsncmp(&buffer->str[j], L"%date%", 6) == 0) - { - wchar_t tmp[128]; - TimeZone_ToStringT(time(NULL), L"d s", tmp, _countof(tmp)); - buffer->replace(j, i + 1, tmp); - } - else - { - for(int k = 0; k < numVariables; k += 2) - { - size_t len = mir_wstrlen(variables[k]); - if (foundLen == len + 2 && wcsncmp(&buffer->str[j]+1, variables[k], len) == 0) - { - buffer->replace(j, i + 1, variables[k + 1]); - break; - } - } - } - } - - i = j; - if (i == 0) - break; - } - else if (buffer->str[i] == '\\' && i+1 <= buffer->len-1 && buffer->str[i+1] == 'n') - { - buffer->str[i] = '\r'; - buffer->str[i+1] = '\n'; - } - } -} - - -static void ReplaceTemplate(Buffer<wchar_t> *out, MCONTACT hContact, wchar_t *templ, wchar_t **vars, int numVars) -{ - - if (ServiceExists(MS_VARS_FORMATSTRING)) - { - wchar_t *tmp = variables_parse_ex(templ, NULL, hContact, vars, numVars); - if (tmp != NULL) - { - out->append(tmp); - mir_free(tmp); - out->pack(); - return; - } - } - - out->append(templ); - ReplaceVars(out, hContact, vars, numVars); - out->pack(); -} - - #endif // __MIR_BUFFER_H__ |