summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/chat
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-01 08:57:57 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-01 08:57:57 +0000
commit7c16f0bc7af13884de18712d9b66c7e7218d51c0 (patch)
tree635025a379c7e61567a11aab1cc4986c9186d93f /plugins/TabSRMM/src/chat
parentf2e1635b5b50ebe64a7bde2b68654034aa2eecdb (diff)
own exception dialog removed from tabSRMM
git-svn-id: http://svn.miranda-ng.org/main/trunk@7981 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/chat')
-rw-r--r--plugins/TabSRMM/src/chat/muchighlight.cpp97
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp9
2 files changed, 44 insertions, 62 deletions
diff --git a/plugins/TabSRMM/src/chat/muchighlight.cpp b/plugins/TabSRMM/src/chat/muchighlight.cpp
index 3b62c76969..796a8b5a88 100644
--- a/plugins/TabSRMM/src/chat/muchighlight.cpp
+++ b/plugins/TabSRMM/src/chat/muchighlight.cpp
@@ -65,13 +65,8 @@ void CMUCHighlight::init()
m_dwFlags = M.GetByte(CHAT_MODULE, "HighlightEnabled", MATCH_TEXT);
m_fHighlightMe = (M.GetByte(CHAT_MODULE, "HighlightMe", 1) ? true : false);
- __try {
- tokenize(m_TextPatternString, m_TextPatterns, m_iTextPatterns);
- tokenize(m_NickPatternString, m_NickPatterns, m_iNickPatterns);
- }
- __except(CGlobals::Ex_ShowDialog(GetExceptionInformation(), __FILE__, __LINE__, L"MUC_HLT_TOKENIZER", false)) {
- m_Valid = false;
- }
+ tokenize(m_TextPatternString, m_TextPatterns, m_iTextPatterns);
+ tokenize(m_NickPatternString, m_NickPatterns, m_iNickPatterns);
}
void CMUCHighlight::tokenize(TCHAR *tszString, TCHAR**& patterns, UINT& nr)
@@ -126,70 +121,60 @@ int CMUCHighlight::match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dwF
if (pgce == 0 || m_Valid == false)
return 0;
- __try {
- if ((m_dwFlags & MATCH_TEXT) && (dwFlags & MATCH_TEXT) && (m_fHighlightMe || m_iTextPatterns > 0) && psi != 0) {
- TCHAR *p = NEWTSTR_ALLOCA(pci->RemoveFormatting(pgce->ptszText));
- CharLower(p);
+ if ((m_dwFlags & MATCH_TEXT) && (dwFlags & MATCH_TEXT) && (m_fHighlightMe || m_iTextPatterns > 0) && psi != 0) {
+ TCHAR *p = NEWTSTR_ALLOCA(pci->RemoveFormatting(pgce->ptszText));
+ CharLower(p);
- TCHAR *tszMe = ((psi && psi->pMe) ? NEWTSTR_ALLOCA(psi->pMe->pszNick) : 0);
- if (tszMe)
- CharLower(tszMe);
+ TCHAR *tszMe = ((psi && psi->pMe) ? NEWTSTR_ALLOCA(psi->pMe->pszNick) : 0);
+ if (tszMe)
+ CharLower(tszMe);
- if (m_fHighlightMe && tszMe) {
- result = wcsstr(p, tszMe) ? MATCH_TEXT : 0;
- if (0 == m_iTextPatterns)
- goto skip_textpatterns;
- }
+ if (m_fHighlightMe && tszMe) {
+ result = wcsstr(p, tszMe) ? MATCH_TEXT : 0;
+ if (0 == m_iTextPatterns)
+ goto skip_textpatterns;
+ }
- while (p && !result) {
- while (*p && (*p == ' ' || *p == ',' || *p == '.' || *p == ':' || *p == ';' || *p == '?' || *p == '!'))
- p++;
+ while (p && !result) {
+ while (*p && (*p == ' ' || *p == ',' || *p == '.' || *p == ':' || *p == ';' || *p == '?' || *p == '!'))
+ p++;
- if (*p == 0)
- break;
+ if (*p == 0)
+ break;
- TCHAR *p1 = p;
- while (*p1 && *p1 != ' ' && *p1 != ',' && *p1 != '.' && *p1 != ':' && *p1 != ';' && *p1 != '?' && *p1 != '!')
- p1++;
+ TCHAR *p1 = p;
+ while (*p1 && *p1 != ' ' && *p1 != ',' && *p1 != '.' && *p1 != ':' && *p1 != ';' && *p1 != '?' && *p1 != '!')
+ p1++;
- if (*p1)
- *p1 = 0;
- else
- p1 = 0;
+ if (*p1)
+ *p1 = 0;
+ else
+ p1 = 0;
- for (UINT i = 0; i < m_iTextPatterns && !result; i++)
- result = wildcmpt(p, m_TextPatterns[i]) ? MATCH_TEXT : 0;
+ for (UINT i = 0; i < m_iTextPatterns && !result; i++)
+ result = wildcmpt(p, m_TextPatterns[i]) ? MATCH_TEXT : 0;
- if (p1) {
- *p1 = ' ';
- p = p1 + 1;
- }
- else p = 0;
+ if (p1) {
+ *p1 = ' ';
+ p = p1 + 1;
}
+ else p = 0;
}
+ }
skip_textpatterns:
- /*
- * optinally, match the nickname against the list of nicks to highlight
- */
- if ((m_dwFlags & MATCH_NICKNAME) && (dwFlags & MATCH_NICKNAME) && pgce->ptszNick && m_iNickPatterns > 0) {
- for (UINT i = 0; i < m_iNickPatterns && !nResult; i++) {
- if (pgce->ptszNick)
- nResult = wildcmpt(pgce->ptszNick, m_NickPatterns[i]) ? MATCH_NICKNAME : 0;
- if ((m_dwFlags & MATCH_UIN) && pgce->ptszUserInfo)
- nResult = wildcmpt(pgce->ptszUserInfo, m_NickPatterns[i]) ? MATCH_NICKNAME : 0;
- }
+ // optionally, match the nickname against the list of nicks to highlight
+ if ((m_dwFlags & MATCH_NICKNAME) && (dwFlags & MATCH_NICKNAME) && pgce->ptszNick && m_iNickPatterns > 0) {
+ for (UINT i = 0; i < m_iNickPatterns && !nResult; i++) {
+ if (pgce->ptszNick)
+ nResult = wildcmpt(pgce->ptszNick, m_NickPatterns[i]) ? MATCH_NICKNAME : 0;
+ if ((m_dwFlags & MATCH_UIN) && pgce->ptszUserInfo)
+ nResult = wildcmpt(pgce->ptszUserInfo, m_NickPatterns[i]) ? MATCH_NICKNAME : 0;
}
-
- return(result | nResult);
}
- __except (CGlobals::Ex_ShowDialog(GetExceptionInformation(), __FILE__, __LINE__, L"MUC_HIGHLIGHT_EXCEPTION", false))
- {
- m_Valid = false;
- return 0;
- }
- return 0;
+
+ return(result | nResult);
}
/**
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 92dc53fd9b..622b0b86ad 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -521,7 +521,7 @@ static bool TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si)
bool isTopic = false, isRoom = false;
TCHAR *pszName = NULL;
- TCHAR *pszText = (TCHAR*)Utils::safeMirCalloc((iLen + 10) * sizeof(TCHAR));
+ TCHAR *pszText = (TCHAR*)mir_calloc((iLen + 10) * sizeof(TCHAR));
gt.flags = GT_DEFAULT;
gt.cb = (iLen + 9) * sizeof(TCHAR);
@@ -555,10 +555,7 @@ LBL_SkipEnd:
isTopic = TRUE;
}
if (dat->szSearchQuery == NULL) {
- size_t len = (end - start) + 1;
- dat->szSearchQuery = (TCHAR*)Utils::safeMirAlloc(sizeof(TCHAR) * len);
- wcsncpy(dat->szSearchQuery, pszText + start, len);
- dat->szSearchQuery[len - 1] = 0;
+ dat->szSearchQuery = mir_tstrndup(pszText + start, end - start);
dat->szSearchResult = mir_tstrdup(dat->szSearchQuery);
dat->lastSession = NULL;
}
@@ -578,7 +575,7 @@ LBL_SkipEnd:
if (end != start) {
ptrT szReplace;
if (!isRoom && !isTopic && g_Settings.bAddColonToAutoComplete && start == 0) {
- szReplace = (TCHAR*)Utils::safeMirAlloc((wcslen(pszName) + 4) * sizeof(TCHAR));
+ szReplace = (TCHAR*)mir_alloc((wcslen(pszName) + 4) * sizeof(TCHAR));
wcscpy(szReplace, pszName);
wcscat(szReplace, L": ");
pszName = szReplace;