summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/mir_buffer.h81
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__