summaryrefslogtreecommitdiff
path: root/plugins/SmileyAdd/src/services.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SmileyAdd/src/services.cpp')
-rw-r--r--plugins/SmileyAdd/src/services.cpp124
1 files changed, 69 insertions, 55 deletions
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp
index 4adb1cab94..adf533896b 100644
--- a/plugins/SmileyAdd/src/services.cpp
+++ b/plugins/SmileyAdd/src/services.cpp
@@ -22,7 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
LIST<void> menuHandleArray(5);
-//implementation of service functions
+/////////////////////////////////////////////////////////////////////////////////////////
+// Service functions
SmileyPackType* FindSmileyPack(const char *proto, MCONTACT hContact, SmileyPackCType **smlc)
{
@@ -80,6 +81,8 @@ SmileyPackType* FindSmileyPack(const char *proto, MCONTACT hContact, SmileyPackC
return g_SmileyCategories.GetSmileyPack(categoryName);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR ReplaceSmileysCommand(WPARAM, LPARAM lParam)
{
SMADD_RICHEDIT3 *smre = (SMADD_RICHEDIT3*)lParam;
@@ -102,6 +105,8 @@ INT_PTR ReplaceSmileysCommand(WPARAM, LPARAM lParam)
return TRUE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static int GetInfoCommandE(SMADD_INFO2 *smre, bool retDup)
{
if (smre == nullptr) return FALSE;
@@ -137,7 +142,7 @@ INT_PTR GetInfoCommand2(WPARAM, LPARAM lParam)
return GetInfoCommandE((SMADD_INFO2*)lParam, true);
}
-
+/////////////////////////////////////////////////////////////////////////////////////////
INT_PTR ParseTextBatch(WPARAM, LPARAM lParam)
{
@@ -185,12 +190,16 @@ INT_PTR ParseTextBatch(WPARAM, LPARAM lParam)
return (INT_PTR)res;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR FreeTextBatch(WPARAM, LPARAM lParam)
{
delete[](SMADD_BATCHPARSERES*)lParam;
return TRUE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR RegisterPack(WPARAM, LPARAM lParam)
{
SMADD_REGCAT *smre = (SMADD_REGCAT*)lParam;
@@ -206,6 +215,8 @@ INT_PTR RegisterPack(WPARAM, LPARAM lParam)
return TRUE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR CustomCatMenu(WPARAM hContact, LPARAM lParam)
{
if (lParam != 0) {
@@ -227,6 +238,60 @@ INT_PTR CustomCatMenu(WPARAM hContact, LPARAM lParam)
return TRUE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+INT_PTR ReloadPack(WPARAM, LPARAM lParam)
+{
+ if (lParam) {
+ SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(_A2T((char *)lParam));
+ if (smc != nullptr)
+ smc->Load();
+ }
+ else {
+ g_SmileyCategories.ClearAll();
+ g_SmileyCategories.AddAllProtocolsAsCategory();
+ g_SmileyCategories.ClearAndLoadAll();
+ }
+
+ NotifyEventHooks(g_hevOptionsChanged, 0, 0);
+ return 0;
+}
+
+INT_PTR LoadContactSmileys(WPARAM, LPARAM lParam)
+{
+ SMADD_CONT *cont = (SMADD_CONT *)lParam;
+
+ switch (cont->type) {
+ case 0:
+ g_SmileyPackCStore.AddSmileyPack(cont->pszModule, cont->path);
+ NotifyEventHooks(g_hevOptionsChanged, (WPARAM)cont->pszModule, 0);
+ break;
+
+ case 1:
+ g_SmileyPackCStore.AddSmiley(cont->pszModule, cont->path);
+ NotifyEventHooks(g_hevOptionsChanged, (WPARAM)cont->pszModule, 0);
+ break;
+
+ case 2:
+ WIN32_FIND_DATAW findData;
+ CMStringW wszPath(cont->path);
+ HANDLE hFind = FindFirstFileW(wszPath, &findData);
+ if (hFind != INVALID_HANDLE_VALUE) {
+ int idx = wszPath.ReverseFind('\\');
+ if (idx != -1)
+ wszPath.Truncate(idx + 1);
+
+ do {
+ if (!mir_wstrcmp(findData.cFileName, L".") || !mir_wstrcmp(findData.cFileName, L"."))
+ continue;
+
+ CMStringW wszFileName = wszPath + findData.cFileName;
+ g_SmileyPackCStore.AddSmiley(cont->pszModule, wszFileName);
+ } while (FindNextFileW(hFind, &findData));
+ }
+ }
+ return 0;
+}
int RebuildContactMenu(WPARAM wParam, LPARAM)
{
@@ -301,58 +366,8 @@ int RebuildContactMenu(WPARAM wParam, LPARAM)
return 0;
}
-INT_PTR ReloadPack(WPARAM, LPARAM lParam)
-{
- if (lParam) {
- SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(_A2T((char *)lParam));
- if (smc != nullptr)
- smc->Load();
- }
- else {
- g_SmileyCategories.ClearAll();
- g_SmileyCategories.AddAllProtocolsAsCategory();
- g_SmileyCategories.ClearAndLoadAll();
- }
-
- NotifyEventHooks(g_hevOptionsChanged, 0, 0);
- return 0;
-}
-
-INT_PTR LoadContactSmileys(WPARAM, LPARAM lParam)
-{
- SMADD_CONT *cont = (SMADD_CONT*)lParam;
-
- switch (cont->type) {
- case 0:
- g_SmileyPackCStore.AddSmileyPack(cont->pszModule, cont->path);
- NotifyEventHooks(g_hevOptionsChanged, (WPARAM)cont->pszModule, 0);
- break;
-
- case 1:
- g_SmileyPackCStore.AddSmiley(cont->pszModule, cont->path);
- NotifyEventHooks(g_hevOptionsChanged, (WPARAM)cont->pszModule, 0);
- break;
-
- case 2:
- WIN32_FIND_DATAW findData;
- CMStringW wszPath(cont->path);
- HANDLE hFind = FindFirstFileW(wszPath, &findData);
- if (hFind != INVALID_HANDLE_VALUE) {
- int idx = wszPath.ReverseFind('\\');
- if (idx != -1)
- wszPath.Truncate(idx+1);
-
- do {
- if (!mir_wstrcmp(findData.cFileName, L".") || !mir_wstrcmp(findData.cFileName, L"."))
- continue;
-
- CMStringW wszFileName = wszPath + findData.cFileName;
- g_SmileyPackCStore.AddSmiley(cont->pszModule, wszFileName);
- } while (FindNextFileW(hFind, &findData));
- }
- }
- return 0;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Events
int AccountListChanged(WPARAM wParam, LPARAM lParam)
{
@@ -412,7 +427,6 @@ int DbSettingChanged(WPARAM hContact, LPARAM lParam)
return 0;
}
-
int ReloadColour(WPARAM, LPARAM)
{
opt.SelWndBkgClr = db_get_dw(0, "SmileyAdd", "SelWndBkgClr", GetSysColor(COLOR_WINDOW));