summaryrefslogtreecommitdiff
path: root/utilities.cpp
diff options
context:
space:
mode:
authorSergey (Elzor) Bolhovskoy <elzor@foobar2000.ru>2010-04-09 18:36:59 +0600
committerSergey (Elzor) Bolhovskoy <elzor@foobar2000.ru>2010-04-09 18:36:59 +0600
commit3556a322f43327213a4331ceb2a8cd0b1981742f (patch)
tree787eebef181bb31ef4ab408529ac7c4b01ca236b /utilities.cpp
parent0ca67c83159c2001074b8ff303cc795daebe6ef1 (diff)
parent6ea93234f4190fec5234f79855455949626d0805 (diff)
Merge branch 'stopspam_mod' into stopspam_mod_elzor
Diffstat (limited to 'utilities.cpp')
-rw-r--r--utilities.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/utilities.cpp b/utilities.cpp
index 4d3b3cf..bf61929 100644
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -144,12 +144,12 @@ tstring variables_parse(tstring const &tstrFormat, HANDLE hContact){
return tstrFormat;
}
-// case-insensitive _tcsstr
+// case-insensitive _tcscmp
//by nullbie as i remember...
#define NEWTSTR_MALLOC(A) (A==NULL)?NULL:_tcscpy((TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(A)+1)),A)
const int Stricmp(const TCHAR *str, const TCHAR *substr)
{
- int i;
+ int i = 0;
TCHAR *str_up = NEWTSTR_MALLOC(str);
TCHAR *substr_up = NEWTSTR_MALLOC(substr);
@@ -164,3 +164,20 @@ const int Stricmp(const TCHAR *str, const TCHAR *substr)
return i;
}
+const int Stristr(const TCHAR *str, const TCHAR *substr)
+{
+ int i = 0;
+ TCHAR *str_up = NEWTSTR_MALLOC(str);
+ TCHAR *substr_up = NEWTSTR_MALLOC(substr);
+
+ CharUpperBuff(str_up, lstrlen(str_up));
+ CharUpperBuff(substr_up, lstrlen(substr_up));
+
+ if(_tcsstr (str_up, substr_up))
+ i = 1;
+
+ mir_free(str_up);
+ mir_free(substr_up);
+
+ return i;
+}