summaryrefslogtreecommitdiff
path: root/plugins/AvatarHistory
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/AvatarHistory')
-rw-r--r--plugins/AvatarHistory/AvatarHistory_10.vcxproj1
-rw-r--r--plugins/AvatarHistory/AvatarHistory_10.vcxproj.filters3
-rw-r--r--plugins/AvatarHistory/AvatarHistory_11.vcxproj1
-rw-r--r--plugins/AvatarHistory/AvatarHistory_11.vcxproj.filters3
-rw-r--r--plugins/AvatarHistory/src/AvatarDlg.cpp388
-rw-r--r--plugins/AvatarHistory/src/AvatarHistory.cpp822
-rw-r--r--plugins/AvatarHistory/src/AvatarHistory.h14
-rw-r--r--plugins/AvatarHistory/src/Version.h24
-rw-r--r--plugins/AvatarHistory/src/options.cpp264
-rw-r--r--plugins/AvatarHistory/src/popup.cpp4
10 files changed, 462 insertions, 1062 deletions
diff --git a/plugins/AvatarHistory/AvatarHistory_10.vcxproj b/plugins/AvatarHistory/AvatarHistory_10.vcxproj
index 64135143d8..639d158fc3 100644
--- a/plugins/AvatarHistory/AvatarHistory_10.vcxproj
+++ b/plugins/AvatarHistory/AvatarHistory_10.vcxproj
@@ -199,6 +199,7 @@
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\popup.cpp" />
<ClCompile Include="src\AvatarHistory.cpp" />
+ <ClCompile Include="src\utils.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\AvatarHistory.h" />
diff --git a/plugins/AvatarHistory/AvatarHistory_10.vcxproj.filters b/plugins/AvatarHistory/AvatarHistory_10.vcxproj.filters
index 876c924e34..3402336acd 100644
--- a/plugins/AvatarHistory/AvatarHistory_10.vcxproj.filters
+++ b/plugins/AvatarHistory/AvatarHistory_10.vcxproj.filters
@@ -36,6 +36,9 @@
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\AvatarHistory.h">
diff --git a/plugins/AvatarHistory/AvatarHistory_11.vcxproj b/plugins/AvatarHistory/AvatarHistory_11.vcxproj
index de5a00c540..0f27d9cef4 100644
--- a/plugins/AvatarHistory/AvatarHistory_11.vcxproj
+++ b/plugins/AvatarHistory/AvatarHistory_11.vcxproj
@@ -203,6 +203,7 @@
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\popup.cpp" />
<ClCompile Include="src\AvatarHistory.cpp" />
+ <ClCompile Include="src\utils.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\AvatarHistory.h" />
diff --git a/plugins/AvatarHistory/AvatarHistory_11.vcxproj.filters b/plugins/AvatarHistory/AvatarHistory_11.vcxproj.filters
index 876c924e34..3402336acd 100644
--- a/plugins/AvatarHistory/AvatarHistory_11.vcxproj.filters
+++ b/plugins/AvatarHistory/AvatarHistory_11.vcxproj.filters
@@ -36,6 +36,9 @@
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\AvatarHistory.h">
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp
index 435b8fea6f..8e1d256892 100644
--- a/plugins/AvatarHistory/src/AvatarDlg.cpp
+++ b/plugins/AvatarHistory/src/AvatarDlg.cpp
@@ -50,7 +50,7 @@ class ListEntry
public:
ListEntry()
{
- dbe = NULL;
+ hDbEvent = NULL;
filename = NULL;
filelink = NULL;
}
@@ -61,7 +61,7 @@ public:
mir_free(filelink);
}
- HANDLE dbe;
+ HANDLE hDbEvent;
TCHAR *filename;
TCHAR *filelink;
};
@@ -121,19 +121,20 @@ void EnableDisableControls(HWND hwnd)
static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
- switch(uMsg)
- {
- case WM_INITDIALOG:
+ HWND hwndList = GetDlgItem(hwnd, IDC_AVATARLIST);
+
+ switch(uMsg) {
+ case WM_INITDIALOG:
{
AvatarDialogData *data = (struct AvatarDialogData*) lParam;
- SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) createDefaultOverlayedIcon(TRUE));
- SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) createDefaultOverlayedIcon(FALSE));
+ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)createDefaultOverlayedIcon(TRUE));
+ SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)createDefaultOverlayedIcon(FALSE));
if (db_get_b(NULL, MODULE_NAME, "LogToHistory", AVH_DEF_LOGTOHISTORY))
- FillAvatarListFromDB(GetDlgItem(hwnd, IDC_AVATARLIST), data->hContact);
+ FillAvatarListFromDB(hwndList, data->hContact);
else if (opts.log_per_contact_folders)
- FillAvatarListFromFolder(GetDlgItem(hwnd, IDC_AVATARLIST), data->hContact);
- TCHAR *displayName = (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM) data->hContact,GCDNF_TCHAR);
- if(displayName)
+ FillAvatarListFromFolder(hwndList, data->hContact);
+ TCHAR *displayName = (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)data->hContact,GCDNF_TCHAR);
+ if (displayName)
{
TCHAR title[MAX_PATH];
mir_sntprintf(title,MAX_PATH,TranslateT("Avatar History for %s"),displayName);
@@ -152,67 +153,62 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l
EnableDisableControls(hwnd);
free(data);
data = NULL;
- break;
}
- case WM_CLOSE:
+ break;
+
+ case WM_CLOSE:
+ CleanupAvatarPic(hwnd);
+ EndDialog(hwnd, 0);
+ return TRUE;
+
+ case WM_DESTROY:
+ Utils_SaveWindowPosition(hwnd,NULL,MODULE_NAME,"AvatarHistoryDialog");
+ WindowList_Remove(hAvatarWindowsList,hwnd);
+ DestroyIcon((HICON)SendMessage(hwnd, WM_SETICON, ICON_BIG, 0));
+ DestroyIcon((HICON)SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0));
{
- CleanupAvatarPic(hwnd);
- EndDialog(hwnd, 0);
- return TRUE;
- }
- case WM_DESTROY:
- {
- Utils_SaveWindowPosition(hwnd,NULL,MODULE_NAME,"AvatarHistoryDialog");
- WindowList_Remove(hAvatarWindowsList,hwnd);
- DestroyIcon((HICON)SendMessage(hwnd, WM_SETICON, ICON_BIG, 0));
- DestroyIcon((HICON)SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0));
- HWND list = GetDlgItem(hwnd, IDC_AVATARLIST);
- int count = SendMessage(list, LB_GETCOUNT, 0, 0);
+ int count = SendMessage(hwndList, LB_GETCOUNT, 0, 0);
for(int i = 0; i < count; i++)
- delete (ListEntry *) SendMessage(list, LB_GETITEMDATA, i, 0);
- break;
+ delete (ListEntry*)SendMessage(hwndList, LB_GETITEMDATA, i, 0);
}
- case WM_CONTEXTMENU:
+ break;
+
+ case WM_CONTEXTMENU:
{
- HWND list = GetDlgItem(hwnd, IDC_AVATARLIST);
HWND pic = GetDlgItem(hwnd, IDC_AVATAR);
int pos;
- if ((HANDLE) wParam == list)
- {
+ if ((HANDLE)wParam == hwndList) {
POINT p;
p.x = LOWORD(lParam);
p.y = HIWORD(lParam);
- ScreenToClient(list, &p);
+ ScreenToClient(hwndList, &p);
- pos = SendMessage(list, LB_ITEMFROMPOINT, 0, MAKELONG(p.x, p.y));
+ pos = SendMessage(hwndList, LB_ITEMFROMPOINT, 0, MAKELONG(p.x, p.y));
if (HIWORD(pos))
break;
pos = LOWORD(pos);
- int count = SendMessage(list, LB_GETCOUNT, 0, 0);
+ int count = SendMessage(hwndList, LB_GETCOUNT, 0, 0);
if (pos >= count)
break;
- SendMessage(list, LB_SETCURSEL, pos, 0);
+ SendMessage(hwndList, LB_SETCURSEL, pos, 0);
EnableDisableControls(hwnd);
}
- else if ((HANDLE) wParam == pic)
- {
- pos = SendMessage(list, LB_GETCURSEL, 0, 0);
+ else if ((HANDLE) wParam == pic) {
+ pos = SendMessage(hwndList, LB_GETCURSEL, 0, 0);
if (pos == LB_ERR)
break;
}
- else
- break;
+ else break;
HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
HMENU submenu = GetSubMenu(menu, 0);
TranslateMenu(submenu);
- if (!UpdateAvatarPic(hwnd))
- {
+ if (!UpdateAvatarPic(hwnd)) {
RemoveMenu(submenu, 2, MF_BYPOSITION);
RemoveMenu(submenu, 0, MF_BYPOSITION);
}
@@ -220,173 +216,155 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l
POINT p;
p.x = LOWORD(lParam);
p.y = HIWORD(lParam);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, p.x, p.y, 0, list, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, p.x, p.y, 0, hwndList, NULL);
DestroyMenu(menu);
- switch(ret)
- {
- case ID_AVATARLISTPOPUP_SAVEAS:
+ switch(ret) {
+ case ID_AVATARLISTPOPUP_SAVEAS:
{
HANDLE hContact = (HANDLE) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- ListEntry *le = (ListEntry*) SendMessage(list, LB_GETITEMDATA, pos, 0);
+ ListEntry *le = (ListEntry*) SendMessage(hwndList, LB_GETITEMDATA, pos, 0);
ShowSaveDialog(hwnd, le->filename, hContact);
- break;
}
- case ID_AVATARLISTPOPUP_DELETE:
+ break;
+
+ case ID_AVATARLISTPOPUP_DELETE:
{
- ListEntry *le = (ListEntry*) SendMessage(list, LB_GETITEMDATA, pos, 0);
+ ListEntry *le = (ListEntry*) SendMessage(hwndList, LB_GETITEMDATA, pos, 0);
BOOL blDelete;
- if(le->dbe)
+ if (le->hDbEvent)
blDelete = MessageBox(hwnd, TranslateT("Are you sure you wish to delete this history entry?\nOnly the entry in history will be deleted, bitmap file will be kept!"),
- TranslateT("Delete avatar log?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;
+ TranslateT("Delete avatar log?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;
else
blDelete = MessageBox(hwnd, TranslateT("Are you sure you wish to delete this avatar shortcut?\nOnly shortcut will be deleted, bitmap file will be kept!"),
- TranslateT("Delete avatar log?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;
-
- if (blDelete)
- {
+ TranslateT("Delete avatar log?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;
+
+ if (blDelete) {
HANDLE hContact = (HANDLE) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if(le->dbe)
- CallService(MS_DB_EVENT_DELETE, (WPARAM) hContact, (LPARAM) le->dbe);
+ if (le->hDbEvent)
+ CallService(MS_DB_EVENT_DELETE, (WPARAM)hContact, (LPARAM)le->hDbEvent);
else
DeleteFile(le->filelink);
delete le;
- SendMessage(list, LB_DELETESTRING, pos, 0);
+ SendMessage(hwndList, LB_DELETESTRING, pos, 0);
- int count = SendMessage(list, LB_GETCOUNT, 0, 0);
- if (count > 0)
- {
+ int count = SendMessage(hwndList, LB_GETCOUNT, 0, 0);
+ if (count > 0) {
if (pos >= count)
pos = count -1;
- SendMessage(list, LB_SETCURSEL, pos, 0);
+ SendMessage(hwndList, LB_SETCURSEL, pos, 0);
}
UpdateAvatarPic(hwnd);
EnableDisableControls(hwnd);
}
- break;
}
- case ID_AVATARLISTPOPUP_DELETE_BOTH:
- {
- ListEntry *le = (ListEntry*) SendMessage(list, LB_GETITEMDATA, pos, 0);
+ break;
- BOOL blDelete;
+ case ID_AVATARLISTPOPUP_DELETE_BOTH:
+ ListEntry *le = (ListEntry*) SendMessage(hwndList, LB_GETITEMDATA, pos, 0);
- if(le->dbe)
- blDelete = MessageBox(hwnd, TranslateT("Are you sure you wish to delete this archived avatar?\nThis will delete the history entry and the bitmap file.\nWARNING:This can affect more than one entry in history!"),
- TranslateT("Delete avatar?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;
- else
- blDelete = MessageBox(hwnd, TranslateT("Are you sure you wish to delete this archived avatar?\nThis will delete the shortcut and the bitmap file.\nWARNING:This can affect more than one shortcut!"),
- TranslateT("Delete avatar?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;
+ BOOL blDelete;
- if (blDelete)
- {
- HANDLE hContact = (HANDLE) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (le->hDbEvent)
+ blDelete = MessageBox(hwnd, TranslateT("Are you sure you wish to delete this archived avatar?\nThis will delete the history entry and the bitmap file.\nWARNING:This can affect more than one entry in history!"),
+ TranslateT("Delete avatar?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;
+ else
+ blDelete = MessageBox(hwnd, TranslateT("Are you sure you wish to delete this archived avatar?\nThis will delete the shortcut and the bitmap file.\nWARNING:This can affect more than one shortcut!"),
+ TranslateT("Delete avatar?"), MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2|MB_SETFOREGROUND|MB_TOPMOST) == IDYES;
- DeleteFile(le->filename);
+ if (blDelete) {
+ HANDLE hContact = (HANDLE) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if(le->dbe)
- CallService(MS_DB_EVENT_DELETE, (WPARAM) hContact, (LPARAM) le->dbe);
- else
- DeleteFile(le->filelink);
+ DeleteFile(le->filename);
- delete le;
+ if (le->hDbEvent)
+ CallService(MS_DB_EVENT_DELETE, (WPARAM)hContact, (LPARAM)le->hDbEvent);
+ else
+ DeleteFile(le->filelink);
- SendMessage(list, LB_DELETESTRING, pos, 0);
+ delete le;
- int count = SendMessage(list, LB_GETCOUNT, 0, 0);
- if (count > 0)
- {
- if (pos >= count)
- pos = count -1;
- SendMessage(list, LB_SETCURSEL, pos, 0);
- }
+ SendMessage(hwndList, LB_DELETESTRING, pos, 0);
- UpdateAvatarPic(hwnd);
- EnableDisableControls(hwnd);
+ int count = SendMessage(hwndList, LB_GETCOUNT, 0, 0);
+ if (count > 0) {
+ if (pos >= count)
+ pos = count -1;
+ SendMessage(hwndList, LB_SETCURSEL, pos, 0);
}
- break;
+
+ UpdateAvatarPic(hwnd);
+ EnableDisableControls(hwnd);
}
}
- break;
}
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDOK:
- if(HIWORD(wParam) == BN_CLICKED)
- {
- HANDLE hContact = (HANDLE) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ break;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDOK:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ HANDLE hContact = (HANDLE) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ db_set_b(hContact, MODULE_NAME, "AvatarPopups", (BYTE) IsDlgButtonChecked(hwnd, IDC_POPUPUSER));
+ db_set_b(hContact, MODULE_NAME, "LogToDisk", (BYTE) IsDlgButtonChecked(hwnd, IDC_LOGUSER));
+ db_set_b(hContact, MODULE_NAME, "LogToHistory", (BYTE) IsDlgButtonChecked(hwnd, IDC_HISTORYUSER));
+
+ CleanupAvatarPic(hwnd);
+ EndDialog(hwnd, 0);
+ return TRUE;
+ }
+ break;
- db_set_b(hContact, MODULE_NAME, "AvatarPopups", (BYTE) IsDlgButtonChecked(hwnd, IDC_POPUPUSER));
- db_set_b(hContact, MODULE_NAME, "LogToDisk", (BYTE) IsDlgButtonChecked(hwnd, IDC_LOGUSER));
- db_set_b(hContact, MODULE_NAME, "LogToHistory", (BYTE) IsDlgButtonChecked(hwnd, IDC_HISTORYUSER));
+ case IDC_AVATARLIST:
+ if (HIWORD(wParam) == LBN_SELCHANGE) {
+ UpdateAvatarPic(hwnd);
+ EnableDisableControls(hwnd);
+ return TRUE;
+ }
+ break;
- CleanupAvatarPic(hwnd);
- EndDialog(hwnd, 0);
- return TRUE;
- }
- break;
- case IDC_AVATARLIST:
- if(HIWORD(wParam) == LBN_SELCHANGE)
- {
- UpdateAvatarPic(hwnd);
- EnableDisableControls(hwnd);
- return TRUE;
- }
- break;
- case IDC_OPENFOLDER:
- if(HIWORD(wParam) == BN_CLICKED)
- {
- if (opts.log_per_contact_folders)
- {
- TCHAR avfolder[MAX_PATH];
- HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- GetContactFolder(avfolder, hContact);
- ShellExecute(NULL, db_get_b(NULL, MODULE_NAME, "OpenFolderMethod", 0) ? _T("explore") : _T("open"), avfolder, NULL, NULL, SW_SHOWNORMAL);
- return TRUE;
- }
- }
- break;
- case IDC_NEXT:
- if(HIWORD(wParam) == BN_CLICKED)
- {
- HWND list = GetDlgItem(hwnd, IDC_AVATARLIST);
- SendMessage(list, LB_SETCURSEL, SendMessage(list, LB_GETCURSEL, 0, 0) +1, 0);
- UpdateAvatarPic(hwnd);
- EnableDisableControls(hwnd);
- return TRUE;
- }
- break;
- case IDC_BACK:
- if(HIWORD(wParam) == BN_CLICKED)
- {
- HWND list = GetDlgItem(hwnd, IDC_AVATARLIST);
- int cursel = SendMessage(list, LB_GETCURSEL, 0, 0);
- if (cursel == LB_ERR)
- SendMessage(list, LB_SETCURSEL, SendMessage(list, LB_GETCOUNT, 0, 0) -1, 0);
- else
- SendMessage(list, LB_SETCURSEL, cursel -1, 0);
- UpdateAvatarPic(hwnd);
- EnableDisableControls(hwnd);
- return TRUE;
- }
- break;
+ case IDC_OPENFOLDER:
+ if (HIWORD(wParam) == BN_CLICKED && opts.log_per_contact_folders) {
+ TCHAR avfolder[MAX_PATH];
+ HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ GetContactFolder(avfolder, hContact);
+ ShellExecute(NULL, db_get_b(NULL, MODULE_NAME, "OpenFolderMethod", 0) ? _T("explore") : _T("open"), avfolder, NULL, NULL, SW_SHOWNORMAL);
+ return TRUE;
+ }
+ break;
+
+ case IDC_NEXT:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ SendMessage(hwndList, LB_SETCURSEL, SendMessage(hwndList, LB_GETCURSEL, 0, 0) +1, 0);
+ UpdateAvatarPic(hwnd);
+ EnableDisableControls(hwnd);
+ return TRUE;
}
break;
+
+ case IDC_BACK:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ int cursel = SendMessage(hwndList, LB_GETCURSEL, 0, 0);
+ if (cursel == LB_ERR)
+ SendMessage(hwndList, LB_SETCURSEL, SendMessage(hwndList, LB_GETCOUNT, 0, 0) -1, 0);
+ else
+ SendMessage(hwndList, LB_SETCURSEL, cursel -1, 0);
+ UpdateAvatarPic(hwnd);
+ EnableDisableControls(hwnd);
+ return TRUE;
+ }
}
+ break;
}
return FALSE;
}
-
-
int FillAvatarListFromFolder(HWND list, HANDLE hContact)
{
int max_pos = 0;
@@ -402,7 +380,7 @@ int FillAvatarListFromFolder(HWND list, HANDLE hContact)
do
{
- if(finddata.cFileName[0] != '.')
+ if (finddata.cFileName[0] != '.')
{
mir_sntprintf(lnk, MAX_PATH, _T("%s\\%s"), dir, finddata.cFileName);
if (ResolveShortcut(lnk, path))
@@ -415,65 +393,49 @@ int FillAvatarListFromFolder(HWND list, HANDLE hContact)
TCHAR *p = _tcschr(finddata.cFileName, _T('.'));
if (p != NULL)
p[0] = _T('\0');
- max_pos = SendMessage(list, LB_ADDSTRING, 0, (LPARAM) finddata.cFileName);
- SendMessage(list, LB_SETITEMDATA, max_pos, (LPARAM) le);
+ max_pos = SendMessage(list, LB_ADDSTRING, 0, (LPARAM)finddata.cFileName);
+ SendMessage(list, LB_SETITEMDATA, max_pos, (LPARAM)le);
}
}
- } while(FindNextFile(hFind, &finddata));
+ }
+ while(FindNextFile(hFind, &finddata));
FindClose(hFind);
SendMessage(list, LB_SETCURSEL, max_pos, 0); // Set to first item
return 0;
}
-
-
-
+
int FillAvatarListFromDB(HWND list, HANDLE hContact)
{
int max_pos = 0;
BYTE blob[2048];
- HANDLE dbe = (HANDLE) CallService(MS_DB_EVENT_FINDFIRST, (WPARAM) hContact, 0);
- while(dbe != NULL)
- {
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
+ for (HANDLE hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRST, (WPARAM)hContact, 0);
+ hDbEvent != NULL;
+ hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0)) {
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.cbBlob = sizeof(blob);
dbei.pBlob = blob;
- if (CallService(MS_DB_EVENT_GET, (WPARAM) dbe, (LPARAM) &dbei) == 0
- && dbei.eventType == EVENTTYPE_AVATAR_CHANGE)
- {
-
- // Get last char from blob
- int i = dbei.cbBlob - 2;
- for(; i >= 0 && dbei.pBlob[i] != 0; i--) ;
-
- if (i != (int) dbei.cbBlob - 2 && i >= 0)
- {
- // Oki, found one
-
- // Get time
- TCHAR date[64];
- DBTIMETOSTRINGT tts = {0};
- tts.szFormat = _T("d s");
- tts.szDest = date;
- tts.cbDest = sizeof(date);
- CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM) dbei.timestamp, (LPARAM) &tts);
-
- // Get file in disk
- char path[MAX_PATH] = "";
- PathToAbsolute((char*)&dbei.pBlob[i+1], path);
- TCHAR *filename = mir_a2t(path);
-
- // Add to list
- ListEntry *le = new ListEntry();
- le->dbe = dbe;
- le->filename = filename;
-
- max_pos = SendMessage(list,LB_ADDSTRING, 0, (LPARAM) date);
- SendMessage(list, LB_SETITEMDATA, max_pos, (LPARAM) le);
- }
- }
-
- dbe = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) dbe, 0);
+ if ( CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei) != 0) continue;
+ if (dbei.eventType != EVENTTYPE_AVATAR_CHANGE) continue;
+
+ // Get time
+ TCHAR date[64];
+ DBTIMETOSTRINGT tts = {0};
+ tts.szFormat = _T("d s");
+ tts.szDest = date;
+ tts.cbDest = sizeof(date);
+ CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)dbei.timestamp, (LPARAM)&tts);
+
+ // Get file in disk
+ TCHAR path[MAX_PATH];
+ mir_ptr<TCHAR> tszStoredPath(mir_utf8decodeT((char*)dbei.pBlob));
+ PathToAbsoluteT(tszStoredPath, path);
+
+ // Add to list
+ ListEntry *le = new ListEntry();
+ le->hDbEvent = hDbEvent;
+ le->filename = mir_tstrdup(path);
+ max_pos = SendMessage(list,LB_ADDSTRING, 0, (LPARAM)date);
+ SendMessage(list, LB_SETITEMDATA, max_pos, (LPARAM)le);
}
SendMessage(list, LB_SETCURSEL, max_pos, 0); // Set to first item
@@ -488,14 +450,14 @@ BOOL UpdateAvatarPic(HWND hwnd)
HWND list = GetDlgItem(hwnd, IDC_AVATARLIST);
TCHAR *filename = GetCurrentSelFile(list);
- if(!filename)
+ if (!filename)
{
SetDlgItemText(hwnd,IDC_AVATARPATH,TranslateT("avatar path is null."));
return 0;
}
SetDlgItemText(hwnd,IDC_AVATARPATH,filename);
- HBITMAP avpic = (HBITMAP) CallService(MS_IMG_LOAD, (WPARAM) filename, IMGL_TCHAR);
+ HBITMAP avpic = (HBITMAP) CallService(MS_IMG_LOAD, (WPARAM)filename, IMGL_TCHAR);
BOOL found_image = (avpic != NULL);
@@ -513,7 +475,7 @@ int CleanupAvatarPic(HWND hwnd)
return -1;
HBITMAP avpic = (HBITMAP)SendMessage(hwndpic, STM_GETIMAGE, 0, 0);
- if(avpic)
+ if (avpic)
DeleteObject(avpic);
return 0;
}
@@ -527,7 +489,7 @@ int PreBuildContactMenu(WPARAM wParam,LPARAM lParam)
if (!ProtocolEnabled(proto))
clmi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hMenu, (LPARAM) &clmi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenu, (LPARAM)&clmi);
return 0;
}
@@ -581,7 +543,7 @@ int ShowSaveDialog(HWND hwnd, TCHAR* fn, HANDLE hContact)
ofn.lpstrFile = file;
TCHAR *displayName = (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR);
- if(displayName)
+ if (displayName)
{
TCHAR title[MAX_PATH];
mir_sntprintf(title,sizeof(title),TranslateT("Save Avatar for %s"),displayName);
@@ -594,7 +556,7 @@ int ShowSaveDialog(HWND hwnd, TCHAR* fn, HANDLE hContact)
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_DONTADDTORECENT;
ofn.lpstrDefExt = _tcsrchr(fn, '.')+1;
- if(ret)
+ if (ret)
{
ofn.lpstrInitialDir = dbvInitDir.ptszVal;
DBFreeVariant(&dbvInitDir);
@@ -603,7 +565,7 @@ int ShowSaveDialog(HWND hwnd, TCHAR* fn, HANDLE hContact)
{
ofn.lpstrInitialDir = _T(".");
}
- if(GetSaveFileName(&ofn))
+ if (GetSaveFileName(&ofn))
{
CopyFile(fn, file, FALSE);
DBWriteContactSettingTString(hContact,MODULE_NAME,"SavedAvatarFolder",file);
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp
index 27b6c3b579..5248c3f1a1 100644
--- a/plugins/AvatarHistory/src/AvatarHistory.cpp
+++ b/plugins/AvatarHistory/src/AvatarHistory.cpp
@@ -36,25 +36,14 @@ TCHAR basedir[MAX_PATH];
int hLangpack = 0;
HANDLE hAvatarWindowsList = NULL;
-static int ModulesLoaded(WPARAM wParam, LPARAM lParam);
-static int PreShutdown(WPARAM wParam, LPARAM lParam);
-static int AvatarChanged(WPARAM wParam, LPARAM lParam);
int OptInit(WPARAM wParam,LPARAM lParam);
-TCHAR * GetHistoryFolder(TCHAR *fn);
-TCHAR * GetProtocolFolder(TCHAR *fn, char *proto);
-TCHAR * GetOldStyleAvatarName(TCHAR *fn, HANDLE hContact);
+TCHAR* GetHistoryFolder(TCHAR *fn);
+TCHAR* GetProtocolFolder(TCHAR *fn, char *proto);
+TCHAR* GetOldStyleAvatarName(TCHAR *fn, HANDLE hContact);
void InitMenuItem();
-void * GetHistoryEventText(HANDLE hContact, HANDLE hDbEvent, DBEVENTINFO *dbe, int format);
-
-// Services
-static INT_PTR IsEnabled(WPARAM wParam, LPARAM lParam);
-static INT_PTR GetCachedAvatar(WPARAM wParam, LPARAM lParam);
-TCHAR * GetCachedAvatar(char *proto, TCHAR *hash);
-BOOL CreateShortcut(TCHAR *file, TCHAR *shortcut);
-
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -69,297 +58,40 @@ PLUGININFOEX pluginInfo = {
{0xdbe8c990, 0x7aa0, 0x458d, {0xba, 0xb7, 0x33, 0xeb, 0x7, 0x23, 0x8e, 0x71}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfo;
}
-static INT_PTR CALLBACK FirstRunDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
-{
- switch(uMsg)
- {
- case WM_INITDIALOG:
- {
- SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) createDefaultOverlayedIcon(TRUE));
- SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) createDefaultOverlayedIcon(FALSE));
- TranslateDialogDefault(hwnd);
-
- CheckDlgButton(hwnd, IDC_MIR_PROTO, BST_CHECKED);
- break;
- }
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDOK:
- {
- int ret = 0;
-
- if (IsDlgButtonChecked(hwnd, IDC_MIR_SAME))
- ret = IDC_MIR_SAME;
- else if (IsDlgButtonChecked(hwnd, IDC_MIR_PROTO))
- ret = IDC_MIR_PROTO;
- else if (IsDlgButtonChecked(hwnd, IDC_MIR_SHORT))
- ret = IDC_MIR_SHORT;
- else if (IsDlgButtonChecked(hwnd, IDC_SHORT))
- ret = IDC_SHORT;
- else if (IsDlgButtonChecked(hwnd, IDC_DUP))
- ret = IDC_DUP;
-
- EndDialog(hwnd, ret);
- return TRUE;
- }
- }
- break;
- }
- case WM_CLOSE:
- {
- EndDialog(hwnd, 0);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-extern "C" __declspec(dllexport) int Load(void)
-{
- mir_getLP(&pluginInfo);
-
- // Is first run?
- if (DBGetContactSettingByte(NULL, MODULE_NAME, "FirstRun", 1))
- {
- // Show dialog
- int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), NULL, FirstRunDlgProc, 0);
- if (ret == 0)
- return -1;
-
- // Write settings
-
- DBWriteContactSettingByte(NULL, MODULE_NAME, "LogToDisk", 1);
-
- if (ret == IDC_MIR_SAME)
- DBWriteContactSettingByte(NULL, MODULE_NAME, "LogKeepSameFolder", 1);
- else
- DBWriteContactSettingByte(NULL, MODULE_NAME, "LogKeepSameFolder", 0);
-
- if (ret == IDC_MIR_SHORT || ret == IDC_SHORT || ret == IDC_DUP)
- DBWriteContactSettingByte(NULL, MODULE_NAME, "LogPerContactFolders", 1);
- else
- DBWriteContactSettingByte(NULL, MODULE_NAME, "LogPerContactFolders", 0);
-
- if (ret == IDC_DUP)
- DBWriteContactSettingByte(NULL, MODULE_NAME, "StoreAsHash", 0);
- else
- DBWriteContactSettingByte(NULL, MODULE_NAME, "StoreAsHash", 1);
-
- if (ret == IDC_MIR_SAME || ret == IDC_MIR_PROTO || ret == IDC_MIR_SHORT)
- DBWriteContactSettingByte(NULL, MODULE_NAME, "LogToHistory", 1);
- else
- DBWriteContactSettingByte(NULL, MODULE_NAME, "LogToHistory", 0);
-
- DBWriteContactSettingByte(NULL, MODULE_NAME, "FirstRun", 0);
- }
-
- LoadOptions();
-
- HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
- HookEvent(ME_OPT_INITIALISE, OptInit);
- HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged);
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);
-
- CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled);
- CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);
-
- if(CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath) != 0)
- _tcscpy(profilePath, _T(".")); // Failed, use current dir
-
- SkinAddNewSoundExT("avatar_changed",LPGENT("Avatar History"),LPGENT("Contact changed avatar"));
- SkinAddNewSoundExT("avatar_removed",LPGENT("Avatar History"),LPGENT("Contact removed avatar"));
-
- hAvatarWindowsList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
-
- SetupIcoLib();
- InitMenuItem();
-
- return 0;
-}
-
-static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
-{
- mir_sntprintf(basedir, MAX_REGS(basedir), _T("%s\\Avatars History"), profilePath);
-
- hFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatar History"),
- PROFILE_PATHT _T("\\") CURRENT_PROFILET _T("\\Avatars History"));
-
- InitPopups();
-
- if (ServiceExists(MS_MC_GETPROTOCOLNAME))
- metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
-
- if (DBGetContactSettingByte(NULL, MODULE_NAME, "LogToHistory", AVH_DEF_LOGTOHISTORY)) {
- char *templates[] = { "Avatar change\nchanged his/her avatar", "Avatar removal\nremoved his/her avatar" };
- HICON hIcon = createDefaultOverlayedIcon(FALSE);
- HistoryEvents_RegisterWithTemplates(MODULE_NAME, "avatarchange", "Avatar change", EVENTTYPE_AVATAR_CHANGE, hIcon,
- HISTORYEVENTS_FORMAT_CHAR | HISTORYEVENTS_FORMAT_WCHAR | HISTORYEVENTS_FORMAT_RICH_TEXT,
- HISTORYEVENTS_FLAG_SHOW_IM_SRMM | HISTORYEVENTS_FLAG_EXPECT_CONTACT_NAME_BEFORE,
- GetHistoryEventText, templates, MAX_REGS(templates));
- DestroyIcon(hIcon);
- }
-
- HookEvent(ME_AV_CONTACTAVATARCHANGED, AvatarChanged);
-
- return 0;
-}
-
-static int PreShutdown(WPARAM wParam, LPARAM lParam)
-{
- WindowList_Broadcast(hAvatarWindowsList,WM_CLOSE,0,0);
- return 0;
-}
-
-BOOL ProtocolEnabled(const char *proto)
-{
- if (proto == NULL)
- return FALSE;
-
- char setting[256];
- mir_snprintf(setting, sizeof(setting), "%sEnabled", proto);
- return (BOOL) DBGetContactSettingByte(NULL, MODULE_NAME, setting, TRUE);
-}
-
-BOOL ContactEnabled(HANDLE hContact, char *setting, int def)
-{
- if (hContact == NULL)
- return FALSE;
+/////////////////////////////////////////////////////////////////////////////////////////
- char *proto = GetContactProto(hContact);
- if (!ProtocolEnabled(proto))
- return FALSE;
-
- BYTE globpref = db_get_b(NULL, MODULE_NAME, setting, def);
- BYTE userpref = db_get_b(hContact, MODULE_NAME, setting, BST_INDETERMINATE);
-
- return (globpref && userpref == BST_INDETERMINATE) || userpref == BST_CHECKED;
-}
-
-// Returns true if the unicode buffer only contains 7-bit characters.
-BOOL IsUnicodeAscii(const WCHAR * pBuffer, int nSize)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
- BOOL bResult = TRUE;
- int nIndex;
-
- for (nIndex = 0; nIndex < nSize; nIndex++) {
- if (pBuffer[nIndex] > 0x7F) {
- bResult = FALSE;
- break;
- }
- }
- return bResult;
-}
-
-void ConvertToFilename(TCHAR *str, size_t size) {
- for(size_t i = 0; i < size && str[i] != '\0'; i++) {
- switch(str[i]) {
- case '/':
- case '\\':
- case ':':
- case '*':
- case '?':
- case '"':
- case '<':
- case '>':
- case '|':
- //case '.':
- str[i] = '_';
- }
- }
-}
-
-void ErrorExit(HANDLE hContact,LPTSTR lpszFunction)
-{
- // Retrieve the system error message for the last-error code
-
- LPVOID lpMsgBuf;
- LPVOID lpDisplayBuf;
- DWORD dw = GetLastError();
-
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- dw,
- MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN),
- (LPTSTR) &lpMsgBuf,
- 0, NULL );
-
- // Display the error message and exit the process
-
- lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
- (lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)lpszFunction) + 40) * sizeof(TCHAR));
- StringCchPrintf((LPTSTR)lpDisplayBuf,
- LocalSize(lpDisplayBuf) / sizeof(TCHAR),
- TEXT("%s failed with error %d: %s"),
- lpszFunction, dw, lpMsgBuf);
- ShowDebugPopup(hContact,TEXT("Error"), (LPCTSTR)lpDisplayBuf);
-
- LocalFree(lpMsgBuf);
- LocalFree(lpDisplayBuf);
+ hInst = hinstDLL;
+ return TRUE;
}
-#define CS "%S"
+/////////////////////////////////////////////////////////////////////////////////////////
+// services
-TCHAR * GetExtension(TCHAR *file)
+static INT_PTR GetCachedAvatar(WPARAM wParam, LPARAM lParam)
{
- if(file == NULL) return _T("");
- TCHAR *ext = _tcsrchr(file, _T('.'));
- if (ext != NULL)
- ext++;
- else
- ext = _T("");
-
- return ext;
+ TCHAR hash[128];
+ lstrcpyn(hash, (TCHAR *) lParam, sizeof(hash));
+ ConvertToFilename(hash, sizeof(hash));
+ return (INT_PTR) GetCachedAvatar((char *) wParam, hash);
}
-
-void CreateOldStyleShortcut(HANDLE hContact, TCHAR *history_filename)
+static INT_PTR IsEnabled(WPARAM wParam, LPARAM lParam)
{
- TCHAR shortcut[MAX_PATH] = _T("");
-
- GetOldStyleAvatarName(shortcut, hContact);
-
- mir_sntprintf(shortcut, MAX_REGS(shortcut), _T("%s.%s.lnk"), shortcut,
- GetExtension(history_filename));
-
- if (!CreateShortcut(history_filename, shortcut))
- {
- ShowPopup(hContact, TranslateT("Avatar History: Unable to create shortcut"), shortcut);
- }
- else
- {
- ShowDebugPopup(hContact, TranslateT("AVH Debug: Shortcut created successfully"), shortcut);
- }
+ HANDLE hContact = (HANDLE) wParam;
+ return ContactEnabled(hContact, "LogToDisk", AVH_DEF_LOGTODISK)
+ || ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS)
+ || ContactEnabled(hContact, "LogToHistory", AVH_DEF_LOGTOHISTORY);
}
-
-BOOL CopyImageFile(TCHAR *old_file, TCHAR *new_file)
-{
- TCHAR *ext = GetExtension(old_file);
- mir_sntprintf(new_file, MAX_PATH, _T("%s.%s"), new_file, ext);
-
- BOOL ret = CopyFile(old_file, new_file, TRUE);
- if(!ret)
- ErrorExit(NULL,_T("CopyImageFile"));
- return !ret;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// events
// fired when the contacts avatar changes
// wParam = hContact
@@ -370,36 +102,26 @@ BOOL CopyImageFile(TCHAR *old_file, TCHAR *new_file)
//
// It is also possible that this event passes 0 as wParam (hContact), in which case,
// a protocol picture (pseudo - avatar) has been changed.
+
static int AvatarChanged(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
- CONTACTAVATARCHANGEDNOTIFICATION* avatar = (CONTACTAVATARCHANGEDNOTIFICATION*)lParam;
-
if (hContact == NULL)
- {
- ShowDebugPopup(NULL, TranslateT("AVH Debug"), TranslateT("Invalid contact/avatar... skipping"));
return 0;
- }
char *proto = GetContactProto((HANDLE)wParam);
if (proto == NULL)
- {
- ShowDebugPopup(hContact, TranslateT("AVH Debug"), TranslateT("Invalid protocol... skipping"));
return 0;
- }
- else if (metacontacts_proto != NULL && strcmp(metacontacts_proto, proto) == 0)
- {
- ShowDebugPopup(hContact, TranslateT("AVH Debug"), TranslateT("Ignoring metacontacts notification"));
+
+ if (metacontacts_proto != NULL && strcmp(metacontacts_proto, proto) == 0)
return 0;
- }
DBVARIANT dbvOldHash = {0};
bool ret = (DBGetContactSettingTString(hContact,MODULE_NAME,"AvatarHash",&dbvOldHash) == 0);
- if (avatar == NULL)
- {
- if (!ret || !_tcscmp(dbvOldHash.ptszVal, _T("-")))
- {
+ CONTACTAVATARCHANGEDNOTIFICATION* avatar = (CONTACTAVATARCHANGEDNOTIFICATION*)lParam;
+ if (avatar == NULL) {
+ if (!ret || !_tcscmp(dbvOldHash.ptszVal, _T("-"))) {
//avoid duplicate "removed avatar" notifications
//do not notify on an empty profile
ShowDebugPopup(hContact, TranslateT("AVH Debug"), TranslateT("Removed avatar, no avatar before...skipping"));
@@ -413,14 +135,9 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)
if (ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) && opts.popup_show_removed)
ShowPopup(hContact, NULL, opts.popup_removed);
-
- if (ContactEnabled(hContact, "LogToHistory", AVH_DEF_LOGTOHISTORY))
- HistoryEvents_AddToHistorySimple(hContact, EVENTTYPE_AVATAR_CHANGE, 1, DBEF_READ);
}
- else
- {
- if(ret && !_tcscmp(dbvOldHash.ptszVal, avatar->hash))
- {
+ else {
+ if (ret && !_tcscmp(dbvOldHash.ptszVal, avatar->hash)) {
// same avatar hash, skipping
ShowDebugPopup(hContact, TranslateT("AVH Debug"), TranslateT("Hashes are the same... skipping"));
DBFreeVariant(&dbvOldHash);
@@ -431,24 +148,19 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)
TCHAR history_filename[MAX_PATH] = _T("");
- if (ContactEnabled(hContact, "LogToDisk", AVH_DEF_LOGTODISK))
- {
- if (!opts.log_store_as_hash)
- {
- if (opts.log_per_contact_folders)
- {
+ if (ContactEnabled(hContact, "LogToDisk", AVH_DEF_LOGTODISK)) {
+ if (!opts.log_store_as_hash) {
+ if (opts.log_per_contact_folders) {
GetOldStyleAvatarName(history_filename, hContact);
if (CopyImageFile(avatar->filename, history_filename))
ShowPopup(hContact, TranslateT("Avatar History: Unable to save avatar"), history_filename);
else
ShowDebugPopup(hContact, TranslateT("AVH Debug: File copied successfully"), history_filename);
- if (ServiceExists(MS_MC_GETMETACONTACT))
- {
+ if (ServiceExists(MS_MC_GETMETACONTACT)) {
HANDLE hMetaContact = (HANDLE) CallService(MS_MC_GETMETACONTACT, wParam, 0);
- if (hMetaContact != NULL && ContactEnabled(hMetaContact, "LogToDisk", AVH_DEF_LOGTOHISTORY))
- {
+ if (hMetaContact != NULL && ContactEnabled(hMetaContact, "LogToDisk", AVH_DEF_LOGTOHISTORY)) {
TCHAR filename[MAX_PATH] = _T("");
GetOldStyleAvatarName(filename, hMetaContact);
@@ -460,8 +172,7 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)
}
}
}
- else
- {
+ else {
// See if we already have the avatar
TCHAR hash[128];
lstrcpyn(hash, avatar->hash, sizeof(hash));
@@ -469,13 +180,11 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)
TCHAR *file = GetCachedAvatar(proto, hash);
- if (file != NULL)
- {
+ if (file != NULL) {
lstrcpyn(history_filename, file, MAX_REGS(history_filename));
mir_free(file);
}
- else
- {
+ else {
if (opts.log_keep_same_folder)
GetHistoryFolder(history_filename);
else
@@ -490,12 +199,10 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)
ShowDebugPopup(hContact, TranslateT("AVH Debug: File copied successfully"), history_filename);
}
- if (opts.log_per_contact_folders)
- {
+ if (opts.log_per_contact_folders) {
CreateOldStyleShortcut(hContact, history_filename);
- if (ServiceExists(MS_MC_GETMETACONTACT))
- {
+ if (ServiceExists(MS_MC_GETMETACONTACT)) {
HANDLE hMetaContact = (HANDLE) CallService(MS_MC_GETMETACONTACT, wParam, 0);
if (hMetaContact != NULL && ContactEnabled(hMetaContact, "LogToDisk", AVH_DEF_LOGTOHISTORY))
@@ -505,402 +212,159 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)
}
}
-
if (ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) && opts.popup_show_changed)
ShowPopup(hContact, NULL, opts.popup_changed);
- if (ContactEnabled(hContact, "LogToHistory", AVH_DEF_LOGTOHISTORY))
- {
- TCHAR rel_path[MAX_PATH] = _T("");
+ if (ContactEnabled(hContact, "LogToHistory", AVH_DEF_LOGTOHISTORY)) {
+ TCHAR rel_path[MAX_PATH];
PathToRelativeT(history_filename, rel_path);
- char *blob = mir_utf8encodeT(rel_path);
- int flags = DBEF_READ | DBEF_UTF;
- if(ServiceExists(MS_HISTORYEVENTS_ADD_TO_HISTORY))
- {
- HistoryEvents_AddToHistoryEx(hContact, EVENTTYPE_AVATAR_CHANGE, 0, NULL, 0, (PBYTE) blob, (int) strlen(blob) + 1, flags);
- }
- else
- {
- DBEVENTINFO AvatarEvent = { 0 };
- AvatarEvent.cbSize = sizeof(AvatarEvent);
- AvatarEvent.szModule = GetContactProto(hContact);
- AvatarEvent.flags = flags;
- AvatarEvent.timestamp = (DWORD) time(NULL);
- AvatarEvent.eventType = EVENTTYPE_AVATAR_CHANGE;
- AvatarEvent.cbBlob = (DWORD) strlen(blob) + 1;
- AvatarEvent.pBlob = (PBYTE) blob;
- CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&AvatarEvent);
- }
- mir_free(blob);
+ mir_ptr<char> blob( mir_utf8encodeT(rel_path));
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.szModule = GetContactProto(hContact);
+ dbei.flags = DBEF_READ | DBEF_UTF;
+ dbei.timestamp = (DWORD) time(NULL);
+ dbei.eventType = EVENTTYPE_AVATAR_CHANGE;
+ dbei.cbBlob = (DWORD) strlen(blob) + 1;
+ dbei.pBlob = (PBYTE)(char*)blob;
+ CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&dbei);
}
}
return 0;
}
-extern "C" __declspec(dllexport) int Unload(void)
+static int PreShutdown(WPARAM wParam, LPARAM lParam)
{
+ WindowList_Broadcast(hAvatarWindowsList,WM_CLOSE,0,0);
return 0;
}
-
-static INT_PTR IsEnabled(WPARAM wParam, LPARAM lParam)
+static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact = (HANDLE) wParam;
- return ContactEnabled(hContact, "LogToDisk", AVH_DEF_LOGTODISK)
- || ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS)
- || ContactEnabled(hContact, "LogToHistory", AVH_DEF_LOGTOHISTORY);
-}
-
+ mir_sntprintf(basedir, MAX_REGS(basedir), _T("%s\\Avatars History"), profilePath);
-/*
-Get cached avatar
+ hFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatar History"),
+ PROFILE_PATHT _T("\\") CURRENT_PROFILET _T("\\Avatars History"));
-wParam: (char *) protocol name
-lParam: (TCHAR *) hash
-return: (TCHAR *) NULL if none is found or the path to the avatar. You need to free this string
- with mir_free.
-*/
-static INT_PTR GetCachedAvatar(WPARAM wParam, LPARAM lParam)
-{
- TCHAR hash[128];
- lstrcpyn(hash, (TCHAR *) lParam, sizeof(hash));
- ConvertToFilename(hash, sizeof(hash));
- return (INT_PTR) GetCachedAvatar((char *) wParam, hash);
-}
+ InitPopups();
-TCHAR * GetCachedAvatar(char *proto, TCHAR *hash)
-{
- TCHAR *ret = NULL;
- TCHAR file[1024] = _T("");
- TCHAR search[1024] = _T("");
- if (opts.log_keep_same_folder)
- GetHistoryFolder(file);
- else
- GetProtocolFolder(file, proto);
-
- mir_sntprintf(search, MAX_REGS(search), _T("%s\\%s.*"), file, hash);
-
- WIN32_FIND_DATA finddata;
- HANDLE hFind = FindFirstFile(search, &finddata);
- if (hFind == INVALID_HANDLE_VALUE)
- return NULL;
-
- do
- {
- size_t len = lstrlen(finddata.cFileName);
- if (len > 4
- && (!lstrcmpi(&finddata.cFileName[len-4], _T(".png"))
- || !lstrcmpi(&finddata.cFileName[len-4], _T(".bmp"))
- || !lstrcmpi(&finddata.cFileName[len-4], _T(".gif"))
- || !lstrcmpi(&finddata.cFileName[len-4], _T(".jpg"))
- || !lstrcmpi(&finddata.cFileName[len-5], _T(".jpeg"))))
- {
- mir_sntprintf(file, MAX_REGS(file), _T("%s\\%s"), file, finddata.cFileName);
- ret = mir_tstrdup(file);
- break;
- }
- } while(FindNextFile(hFind, &finddata));
- FindClose(hFind);
+ if (ServiceExists(MS_MC_GETPROTOCOLNAME))
+ metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
- return ret;
+ HookEvent(ME_AV_CONTACTAVATARCHANGED, AvatarChanged);
+ return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
-int GetUIDFromHContact(HANDLE contact, TCHAR* uinout, size_t uinout_len)
+static INT_PTR CALLBACK FirstRunDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
- CONTACTINFO cinfo;
-
- ZeroMemory(&cinfo,sizeof(CONTACTINFO));
- cinfo.cbSize = sizeof(CONTACTINFO);
- cinfo.hContact = contact;
- cinfo.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
-
- bool found = true;
- if(CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&cinfo)==0)
- {
- if(cinfo.type == CNFT_ASCIIZ)
- {
- lstrcpyn(uinout, cinfo.pszVal, uinout_len);
- // It is up to us to free the string
- // The catch? We need to use Miranda's free(), not our CRT's :)
- mir_free(cinfo.pszVal);
- }
- else if(cinfo.type == CNFT_DWORD)
- {
- _itot(cinfo.dVal,uinout,10);
- }
- else if(cinfo.type == CNFT_WORD)
- {
- _itot(cinfo.wVal,uinout,10);
+ switch(uMsg) {
+ case WM_INITDIALOG:
+ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)createDefaultOverlayedIcon(TRUE));
+ SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)createDefaultOverlayedIcon(FALSE));
+ TranslateDialogDefault(hwnd);
+
+ CheckDlgButton(hwnd, IDC_MIR_PROTO, BST_CHECKED);
+ break;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDOK:
+ {
+ int ret = 0;
+
+ if (IsDlgButtonChecked(hwnd, IDC_MIR_SAME))
+ ret = IDC_MIR_SAME;
+ else if (IsDlgButtonChecked(hwnd, IDC_MIR_PROTO))
+ ret = IDC_MIR_PROTO;
+ else if (IsDlgButtonChecked(hwnd, IDC_MIR_SHORT))
+ ret = IDC_MIR_SHORT;
+ else if (IsDlgButtonChecked(hwnd, IDC_SHORT))
+ ret = IDC_SHORT;
+ else if (IsDlgButtonChecked(hwnd, IDC_DUP))
+ ret = IDC_DUP;
+
+ EndDialog(hwnd, ret);
+ return TRUE;
+ }
}
- else found = false;
- }
- else found = false;
+ break;
- if (!found)
- {
- lstrcpyn(uinout, TranslateT("Unknown UIN"),uinout_len);
+ case WM_CLOSE:
+ EndDialog(hwnd, 0);
+ return TRUE;
}
- return 0;
-}
-
-
-TCHAR * GetHistoryFolder(TCHAR *fn)
-{
- if (fn == NULL) return NULL;
- FoldersGetCustomPathT(hFolder, fn, MAX_PATH, basedir);
- if(!CreateDirectory(fn, NULL))
- ErrorExit(NULL,_T("GetHistoryFolder"));
-
- return fn;
-}
-
-
-TCHAR * GetProtocolFolder(TCHAR *fn, char *proto)
-{
- GetHistoryFolder(fn);
-
- if (proto == NULL)
- proto = Translate("Unknown Protocol");
- mir_sntprintf(fn, MAX_PATH, _T("%s\\") _T(CS), fn, proto);
- if(!CreateDirectory(fn, NULL))
- ErrorExit(NULL,_T("CreateDirectory"));
-
- return fn;
-}
-
-
-TCHAR * GetContactFolder(TCHAR *fn, HANDLE hContact)
-{
- TCHAR uin[MAX_PATH];
-
- char *proto = GetContactProto(hContact);
- GetProtocolFolder(fn, proto);
-
- GetUIDFromHContact(hContact, uin, MAX_REGS(uin));
- mir_sntprintf(fn, MAX_PATH, _T("%s\\%s"), fn, uin);
- if(!CreateDirectory(fn, NULL))
- ErrorExit(hContact,_T("CreateDirectory"));
- ConvertToFilename(uin, sizeof(uin)); //added so that weather id's like "yw/CI0000" work
-
-#ifdef DBGPOPUPS
- TCHAR log[1024];
- mir_sntprintf(log, MAX_REGS(log), _T("Path: %s\nProto: ") _T(CS) _T("\nUIN: %s"), fn, proto, uin);
- ShowPopup(hContact, _T("AVH Debug: GetContactFolder"), log);
-#endif
-
- return fn;
-}
-
-TCHAR * GetOldStyleAvatarName(TCHAR *fn, HANDLE hContact)
-{
- GetContactFolder(fn, hContact);
-
- SYSTEMTIME curtime;
- GetLocalTime(&curtime);
- mir_sntprintf(fn, MAX_PATH,
- _T("%s\\%04d-%02d-%02d %02dh%02dm%02ds"), fn,
- curtime.wYear, curtime.wMonth, curtime.wDay,
- curtime.wHour, curtime.wMinute, curtime.wSecond);
- ShowDebugPopup(hContact,TranslateT("AVH Debug: GetOldStyleAvatarName"),fn);
- return fn;
+ return FALSE;
}
-BOOL CreateShortcut(TCHAR *file, TCHAR *shortcut)
+extern "C" __declspec(dllexport) int Load(void)
{
- CoInitialize(NULL);
-
- IShellLink* psl = NULL;
-
- HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **) &psl);
-
- if (SUCCEEDED(hr))
- {
- psl->SetPath(file);
-
- IPersistFile* ppf = NULL;
- hr = psl->QueryInterface(IID_IPersistFile, (void **) &ppf);
-
- if (SUCCEEDED(hr))
- {
-
- hr = ppf->Save(shortcut, TRUE);
-
- ppf->Release();
- }
-
- psl->Release();
- }
-
- if(FAILED(hr))
- ErrorExit(NULL,_T("CreateShortcut"));
- return SUCCEEDED(hr);
-}
-
+ mir_getLP(&pluginInfo);
-BOOL ResolveShortcut(TCHAR *shortcut, TCHAR *file)
-{
CoInitialize(NULL);
- IShellLink* psl = NULL;
-
- HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **) &psl);
-
- if (SUCCEEDED(hr))
- {
- IPersistFile* ppf = NULL;
- hr = psl->QueryInterface(IID_IPersistFile, (void **) &ppf);
+ // Is first run?
+ if ( db_get_b(NULL, MODULE_NAME, "FirstRun", 1)) {
+ // Show dialog
+ int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), NULL, FirstRunDlgProc, 0);
+ if (ret == 0)
+ return -1;
- if (SUCCEEDED(hr))
- {
- hr = ppf->Load(shortcut, STGM_READ);
+ // Write settings
- if (SUCCEEDED(hr))
- {
- hr = psl->Resolve(NULL, SLR_UPDATE);
+ db_set_b(NULL, MODULE_NAME, "LogToDisk", 1);
- if (SUCCEEDED(hr))
- {
- WIN32_FIND_DATA wfd;
- hr = psl->GetPath(file, MAX_PATH, &wfd, SLGP_RAWPATH);
- }
- }
+ if (ret == IDC_MIR_SAME)
+ db_set_b(NULL, MODULE_NAME, "LogKeepSameFolder", 1);
+ else
+ db_set_b(NULL, MODULE_NAME, "LogKeepSameFolder", 0);
- ppf->Release();
- }
- psl->Release();
- }
+ if (ret == IDC_MIR_SHORT || ret == IDC_SHORT || ret == IDC_DUP)
+ db_set_b(NULL, MODULE_NAME, "LogPerContactFolders", 1);
+ else
+ db_set_b(NULL, MODULE_NAME, "LogPerContactFolders", 0);
- if(FAILED(hr))
- ErrorExit(NULL,_T("CreateShortcut"));
- return SUCCEEDED(hr);
-}
+ if (ret == IDC_DUP)
+ db_set_b(NULL, MODULE_NAME, "StoreAsHash", 0);
+ else
+ db_set_b(NULL, MODULE_NAME, "StoreAsHash", 1);
+ if (ret == IDC_MIR_SAME || ret == IDC_MIR_PROTO || ret == IDC_MIR_SHORT)
+ db_set_b(NULL, MODULE_NAME, "LogToHistory", 1);
+ else
+ db_set_b(NULL, MODULE_NAME, "LogToHistory", 0);
-template<class T>
-void ConvertToRTF(Buffer<char> *buffer, T *line)
-{
- buffer->append("{\\uc1 ", 6);
-
- for (; *line; line++)
- {
- if (*line == (T)'\r' && line[1] == (T)'\n') {
- buffer->append("\\line ", 6);
- line++;
- }
- else if (*line == (T)'\n') {
- buffer->append("\\line ", 6);
- }
- else if (*line == (T)'\t') {
- buffer->append("\\tab ", 5);
- }
- else if (*line == (T)'\\' || *line == (T)'{' || *line == (T)'}') {
- buffer->append('\\');
- buffer->append((char) *line);
- }
- else if (*line < 128) {
- buffer->append((char) *line);
- }
- else
- buffer->appendPrintf("\\u%d ?", *line);
+ db_set_b(NULL, MODULE_NAME, "FirstRun", 0);
}
- buffer->append('}');
-}
-
-
-void GetRTFFor(Buffer<char> *buffer, HBITMAP hBitmap)
-{
- BITMAP bmp;
- GetObject(hBitmap, sizeof(bmp), &bmp);
-
- DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
- BYTE *p = (BYTE *) malloc(dwLen);
- if (p == NULL)
- return;
-
- dwLen = GetBitmapBits(hBitmap, dwLen, p);
-
- buffer->appendPrintf("{\\pict\\wbitmap0\\wbmbitspixel%u\\wbmplanes%u\\wbmwidthbytes%u\\picw%u\\pich%u ",
- bmp.bmBitsPixel, bmp.bmPlanes, bmp.bmWidthBytes, bmp.bmWidth, bmp.bmHeight);
-
- for (DWORD i = 0; i < dwLen; i++)
- buffer->appendPrintf("%02X", p[i]);
-
- buffer->append('}');
-
+ LoadOptions();
-/*
- BITMAPINFOHEADER bih = { 0 };
- HDC hdc = GetDC(NULL);
- GetDIBits(hdc, hBitmap, 0, bmp.bmHeight, p, (BITMAPINFO *) & bih, DIB_RGB_COLORS);
+ HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
+ HookEvent(ME_OPT_INITIALISE, OptInit);
+ HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);
- buffer->appendPrintf("{\\pict\\wbitmap0\\wbmbitspixel%u\\wbmplanes%u\\wbmwidthbytes%u\\picw%u\\pich%u ",
- bmp.bmBitsPixel, bmp.bmPlanes, bmp.bmWidthBytes, bmp.bmWidth, bmp.bmHeight);
+ CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled);
+ CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);
- DWORD i;
- for (i = 0; i < sizeof(BITMAPINFOHEADER); i++)
- buffer->appendPrintf("%02X", ((PBYTE) & bih)[i]);
+ if (CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath) != 0)
+ _tcscpy(profilePath, _T(".")); // Failed, use current dir
- for (i = 0; i < dwLen; i++)
- buffer->appendPrintf("%02X", p[i]);
+ SkinAddNewSoundExT("avatar_changed",LPGENT("Avatar History"),LPGENT("Contact changed avatar"));
+ SkinAddNewSoundExT("avatar_removed",LPGENT("Avatar History"),LPGENT("Contact removed avatar"));
- buffer->append('}');
-*/
+ hAvatarWindowsList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
- free(p);
+ SetupIcoLib();
+ InitMenuItem();
+ return 0;
}
-
-void * GetHistoryEventText(HANDLE hContact, HANDLE hDbEvent, DBEVENTINFO *dbe, int format)
+extern "C" __declspec(dllexport) int Unload(void)
{
- void *ret;
-
- if (format & HISTORYEVENTS_FORMAT_CHAR)
- {
- ret = DbGetEventTextA(dbe, CP_ACP);
- }
- else if (format & HISTORYEVENTS_FORMAT_WCHAR)
- {
- ret = DbGetEventTextW(dbe, CP_ACP);
- }
- else if (format & HISTORYEVENTS_FORMAT_RICH_TEXT)
- {
- Buffer<char> buffer;
-
- TCHAR *tmp = DbGetEventTextT(dbe, CP_ACP);
- ConvertToRTF(&buffer, tmp);
- mir_free(tmp);
-
- // Load the image
- size_t i;
- for(i = dbe->cbBlob-2; i > 0 && dbe->pBlob[i] != 0; i--) ;
- i++;
-
- if (dbe->pBlob[i] != 0)
- {
- TCHAR absFile[MAX_PATH] = _T("");
- PathToAbsoluteT((TCHAR*)&dbe->pBlob[i], absFile);
- if(absFile != NULL)
- {
- HBITMAP hBmp = (HBITMAP) CallService(MS_IMG_LOAD, (WPARAM) absFile, IMGL_TCHAR);
-
- if (hBmp != NULL)
- {
- buffer.append("\\line ", 7);
- GetRTFFor(&buffer, hBmp);
- DeleteObject(hBmp);
- }
- }
- }
-
- buffer.append(' ');
- buffer.pack();
- ret = buffer.detach();
- }
-
- return ret;
+ return 0;
}
-
diff --git a/plugins/AvatarHistory/src/AvatarHistory.h b/plugins/AvatarHistory/src/AvatarHistory.h
index d58525e618..504549f28b 100644
--- a/plugins/AvatarHistory/src/AvatarHistory.h
+++ b/plugins/AvatarHistory/src/AvatarHistory.h
@@ -25,15 +25,14 @@
#include <m_history.h>
#include <m_imgsrvc.h>
#include <m_icolib.h>
+#include <win2k.h>
#include <m_folders.h>
#include <m_metacontacts.h>
#include "m_avatarhist.h"
-#include "m_historyevents.h"
#include "resource.h"
#include "Version.h"
-#include "../utils/mir_buffer.h"
// Globals
extern HINSTANCE hInst;
@@ -69,6 +68,17 @@ int IcoLibIconsChanged(WPARAM wParam,LPARAM lParam);
int OpenAvatarDialog(HANDLE hContact, char* fn);
+// utils
+
+TCHAR* GetCachedAvatar(char *proto, TCHAR *hash);
+BOOL ProtocolEnabled(const char *proto);
+BOOL ContactEnabled(HANDLE hContact, char *setting, int def);
+BOOL CopyImageFile(TCHAR *old_file, TCHAR *new_file);
+void ConvertToFilename(TCHAR *str, size_t size);
+
+void CreateOldStyleShortcut(HANDLE hContact, TCHAR *history_filename);
+BOOL CreateShortcut(TCHAR *file, TCHAR *shortcut);
+
#define MAX_REGS(_A_) ( sizeof(_A_) / sizeof(_A_[0]) )
#define POPUP_ACTION_DONOTHING 0
diff --git a/plugins/AvatarHistory/src/Version.h b/plugins/AvatarHistory/src/Version.h
index fa7310396f..33ed48790f 100644
--- a/plugins/AvatarHistory/src/Version.h
+++ b/plugins/AvatarHistory/src/Version.h
@@ -1,14 +1,14 @@
-#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 0
-#define __RELEASE_NUM 3
-#define __BUILD_NUM 3
+#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 1
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 1
-#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
+#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
-#define __PLUGIN_NAME "Avatar history"
-#define __FILENAME "AvatarHistory.dll"
-#define __DESCRIPTION "This plugin keeps backups of all your contacts' avatar changes and/or shows popups."
-#define __AUTHOR "Matthew Wild (MattJ), Ricardo Pescuma Domenecci"
-#define __AUTHOREMAIL "mwild1@gmail.com"
-#define __AUTHORWEB "http://miranda-ng.org/"
-#define __COPYRIGHT "© 2006-2012 Matthew Wild, Ricardo Pescuma Domenecci"
+#define __PLUGIN_NAME "Avatar history"
+#define __FILENAME "AvatarHistory.dll"
+#define __DESCRIPTION "This plugin keeps backups of all your contacts' avatar changes and/or shows popups."
+#define __AUTHOR "Matthew Wild (MattJ), Ricardo Pescuma Domenecci"
+#define __AUTHOREMAIL "mwild1@gmail.com"
+#define __AUTHORWEB "http://miranda-ng.org/"
+#define __COPYRIGHT "© 2006-2012 Matthew Wild, Ricardo Pescuma Domenecci"
diff --git a/plugins/AvatarHistory/src/options.cpp b/plugins/AvatarHistory/src/options.cpp
index 71cdc2da32..a8d605e1f5 100644
--- a/plugins/AvatarHistory/src/options.cpp
+++ b/plugins/AvatarHistory/src/options.cpp
@@ -21,98 +21,44 @@ Avatar History Plugin
#include "AvatarHistory.h"
#include "../utils/mir_options.h"
-
-
-// Prototypes /////////////////////////////////////////////////////////////////////////////////////
-
Options opts;
-
-static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
+// Prototypes /////////////////////////////////////////////////////////////////////////////////////
static OptPageControl optionsControls[] = {
- { NULL, CONTROL_PROTOCOL_LIST, IDC_PROTOCOLS, "%sEnabled", TRUE }
+ { NULL, CONTROL_PROTOCOL_LIST, IDC_PROTOCOLS, "%sEnabled", TRUE }
};
-
static OptPageControl popupsControls[] = {
- { NULL, CONTROL_CHECKBOX, IDC_POPUPS, "AvatarPopups", AVH_DEF_AVPOPUPS },
- { &opts.popup_bkg_color, CONTROL_COLOR, IDC_BGCOLOR, "PopupsBgColor", AVH_DEF_POPUPBG },
- { &opts.popup_text_color, CONTROL_COLOR, IDC_TEXTCOLOR, "PopupsTextColor", AVH_DEF_POPUPFG },
- { &opts.popup_use_win_colors, CONTROL_CHECKBOX, IDC_WINCOLORS, "PopupsWinColors", FALSE },
- { &opts.popup_use_default_colors, CONTROL_CHECKBOX, IDC_DEFAULTCOLORS, "PopupsDefaultColors", AVH_DEF_DEFPOPUPS },
- { &opts.popup_delay_type, CONTROL_RADIO, IDC_DELAYFROMPU, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_DEFAULT },
- { NULL, CONTROL_RADIO, IDC_DELAYCUSTOM, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_CUSTOM },
- { NULL, CONTROL_RADIO, IDC_DELAYPERMANENT, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_PERMANENT },
- { &opts.popup_timeout, CONTROL_SPIN, IDC_DELAY, "PopupsTimeout", 10, IDC_DELAY_SPIN, (WORD) 1, (WORD) 255 },
- { &opts.popup_right_click_action, CONTROL_COMBO, IDC_RIGHT_ACTION, "PopupsRightClick", POPUP_ACTION_CLOSEPOPUP },
- { &opts.popup_left_click_action, CONTROL_COMBO, IDC_LEFT_ACTION, "PopupsLeftClick", POPUP_ACTION_OPENAVATARHISTORY },
- { &opts.popup_show_changed, CONTROL_CHECKBOX, IDC_CHANGED_L, "PopupsShowChanged", TRUE },
- { &opts.popup_changed, CONTROL_TEXT, IDC_CHANGED, "PopupsTextChanged", (ULONG_PTR) DEFAULT_TEMPLATE_CHANGED },
- { &opts.popup_show_removed, CONTROL_CHECKBOX, IDC_REMOVED_L, "PopupsShowRemoved", TRUE },
- { &opts.popup_removed, CONTROL_TEXT, IDC_REMOVED, "PopupsTextRemoved", (ULONG_PTR) DEFAULT_TEMPLATE_REMOVED }
+ { NULL, CONTROL_CHECKBOX, IDC_POPUPS, "AvatarPopups", AVH_DEF_AVPOPUPS },
+ { &opts.popup_bkg_color, CONTROL_COLOR, IDC_BGCOLOR, "PopupsBgColor", AVH_DEF_POPUPBG },
+ { &opts.popup_text_color, CONTROL_COLOR, IDC_TEXTCOLOR, "PopupsTextColor", AVH_DEF_POPUPFG },
+ { &opts.popup_use_win_colors, CONTROL_CHECKBOX, IDC_WINCOLORS, "PopupsWinColors", FALSE },
+ { &opts.popup_use_default_colors, CONTROL_CHECKBOX, IDC_DEFAULTCOLORS, "PopupsDefaultColors", AVH_DEF_DEFPOPUPS },
+ { &opts.popup_delay_type, CONTROL_RADIO, IDC_DELAYFROMPU, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_DEFAULT },
+ { NULL, CONTROL_RADIO, IDC_DELAYCUSTOM, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_CUSTOM },
+ { NULL, CONTROL_RADIO, IDC_DELAYPERMANENT, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_PERMANENT },
+ { &opts.popup_timeout, CONTROL_SPIN, IDC_DELAY, "PopupsTimeout", 10, IDC_DELAY_SPIN, (WORD) 1, (WORD) 255 },
+ { &opts.popup_right_click_action, CONTROL_COMBO, IDC_RIGHT_ACTION, "PopupsRightClick", POPUP_ACTION_CLOSEPOPUP },
+ { &opts.popup_left_click_action, CONTROL_COMBO, IDC_LEFT_ACTION, "PopupsLeftClick", POPUP_ACTION_OPENAVATARHISTORY },
+ { &opts.popup_show_changed, CONTROL_CHECKBOX, IDC_CHANGED_L, "PopupsShowChanged", TRUE },
+ { &opts.popup_changed, CONTROL_TEXT, IDC_CHANGED, "PopupsTextChanged", (ULONG_PTR) DEFAULT_TEMPLATE_CHANGED },
+ { &opts.popup_show_removed, CONTROL_CHECKBOX, IDC_REMOVED_L, "PopupsShowRemoved", TRUE },
+ { &opts.popup_removed, CONTROL_TEXT, IDC_REMOVED, "PopupsTextRemoved", (ULONG_PTR) DEFAULT_TEMPLATE_REMOVED }
};
-
-// Functions //////////////////////////////////////////////////////////////////////////////////////
-
-
-int OptInit(WPARAM wParam,LPARAM lParam)
-{
- OPTIONSDIALOGPAGE odp;
-
- ZeroMemory(&odp,sizeof(odp));
- odp.cbSize=sizeof(odp);
- odp.position=0;
- odp.hInstance=hInst;
- odp.ptszGroup = LPGENT("History"); // group to put your item under
- odp.ptszTitle = LPGENT("Avatar"); // name of the item
- odp.pfnDlgProc = OptionsDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
- odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- Options_AddPage(wParam, &odp);
-
- if(ServiceExists(MS_POPUP_ADDPOPUPT))
- {
- ZeroMemory(&odp,sizeof(odp));
- odp.cbSize=sizeof(odp);
- odp.position=0;
- odp.hInstance=hInst;
- odp.ptszGroup = LPGENT("PopUps");
- odp.ptszTitle = LPGENT("Avatar Change");
- odp.pfnDlgProc = PopupsDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPS);
- odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- Options_AddPage(wParam, &odp);
- }
-
- return 0;
-}
-
-
-void LoadOptions()
-{
- LoadOpts(optionsControls, MAX_REGS(optionsControls), MODULE_NAME);
- LoadOpts(popupsControls, MAX_REGS(popupsControls), MODULE_NAME);
-
- opts.log_per_contact_folders = DBGetContactSettingByte(NULL, MODULE_NAME, "LogPerContactFolders", 0);
- opts.log_keep_same_folder = DBGetContactSettingByte(NULL, MODULE_NAME, "LogKeepSameFolder", 0);
- opts.log_store_as_hash = DBGetContactSettingByte(NULL, MODULE_NAME, "StoreAsHash", 1);
-}
-
+// Options dialog procedure ///////////////////////////////////////////////////////////////////////
static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
return SaveOptsDlgProc(optionsControls, MAX_REGS(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
+// Popup options dialog procedure /////////////////////////////////////////////////////////////////
static void PopupsEnableDisableCtrls(HWND hwndDlg)
{
BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_POPUPS);
-
EnableWindow(GetDlgItem(hwndDlg, IDC_COLOURS_G), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_BGCOLOR_L), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_TEXTCOLOR_L), enabled);
@@ -127,97 +73,107 @@ static void PopupsEnableDisableCtrls(HWND hwndDlg)
EnableWindow(GetDlgItem(hwndDlg, IDC_LEFT_ACTION), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_PREV), enabled);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BGCOLOR), enabled &&
- !IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) &&
- !IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS));
- EnableWindow(GetDlgItem(hwndDlg, IDC_TEXTCOLOR), enabled &&
- !IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) &&
- !IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS));
- EnableWindow(GetDlgItem(hwndDlg, IDC_DEFAULTCOLORS), enabled &&
- !IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS));
- EnableWindow(GetDlgItem(hwndDlg, IDC_WINCOLORS), enabled &&
- !IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), enabled &&
- IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BGCOLOR), enabled && !IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TEXTCOLOR), enabled && !IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DEFAULTCOLORS), enabled && !IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_WINCOLORS), enabled && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), enabled && IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM));
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGED_L), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVED_L), enabled);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGED), enabled &&
- IsDlgButtonChecked(hwndDlg, IDC_CHANGED_L));
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVED), enabled &&
- IsDlgButtonChecked(hwndDlg, IDC_REMOVED_L));
-
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGED), enabled && IsDlgButtonChecked(hwndDlg, IDC_CHANGED_L));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVED), enabled && IsDlgButtonChecked(hwndDlg, IDC_REMOVED_L));
}
-
static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM) TranslateT("Do nothing"));
- SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM) TranslateT("Close popup"));
- SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM) TranslateT("Show avatar history"));
- SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM) TranslateT("Show contact history"));
-
- SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM) TranslateT("Do nothing"));
- SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM) TranslateT("Close popup"));
- SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM) TranslateT("Show avatar history"));
- SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM) TranslateT("Show contact history"));
-
- // Needs to be called here in this case
- BOOL ret = SaveOptsDlgProc(popupsControls, MAX_REGS(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
-
- PopupsEnableDisableCtrls(hwndDlg);
-
- return ret;
- }
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_POPUPS:
- case IDC_WINCOLORS:
- case IDC_DEFAULTCOLORS:
- case IDC_DELAYFROMPU:
- case IDC_DELAYPERMANENT:
- case IDC_DELAYCUSTOM:
- case IDC_CHANGED_L:
- case IDC_REMOVED_L:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- PopupsEnableDisableCtrls(hwndDlg);
-
- break;
- }
- case IDC_PREV:
- {
- Options op = opts;
-
- if (IsDlgButtonChecked(hwndDlg, IDC_DELAYFROMPU))
- op.popup_delay_type = POPUP_DELAY_DEFAULT;
- else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM))
- op.popup_delay_type = POPUP_DELAY_CUSTOM;
- else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT))
- op.popup_delay_type = POPUP_DELAY_PERMANENT;
-
- op.popup_timeout = GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE);
- op.popup_bkg_color = SendDlgItemMessage(hwndDlg,IDC_BGCOLOR,CPM_GETCOLOUR,0,0);
- op.popup_text_color = SendDlgItemMessage(hwndDlg,IDC_TEXTCOLOR,CPM_GETCOLOUR,0,0);
- op.popup_use_win_colors = IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) != 0;
- op.popup_use_default_colors = IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS) != 0;
-
- HANDLE hContact = db_find_first();
- ShowTestPopup(hContact,TranslateT("Test Contact"), TranslateT("Test description"), &op);
-
- break;
- }
- }
+ switch (msg) {
+ case WM_INITDIALOG:
+ SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Do nothing"));
+ SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Close popup"));
+ SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Show avatar history"));
+ SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Show contact history"));
+
+ SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Do nothing"));
+ SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Close popup"));
+ SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Show avatar history"));
+ SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Show contact history"));
+
+ // Needs to be called here in this case
+ SaveOptsDlgProc(popupsControls, MAX_REGS(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ PopupsEnableDisableCtrls(hwndDlg);
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_POPUPS:
+ case IDC_WINCOLORS:
+ case IDC_DEFAULTCOLORS:
+ case IDC_DELAYFROMPU:
+ case IDC_DELAYPERMANENT:
+ case IDC_DELAYCUSTOM:
+ case IDC_CHANGED_L:
+ case IDC_REMOVED_L:
+ if (HIWORD(wParam) == BN_CLICKED)
+ PopupsEnableDisableCtrls(hwndDlg);
+ break;
+
+ case IDC_PREV:
+ Options op = opts;
+ if (IsDlgButtonChecked(hwndDlg, IDC_DELAYFROMPU))
+ op.popup_delay_type = POPUP_DELAY_DEFAULT;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM))
+ op.popup_delay_type = POPUP_DELAY_CUSTOM;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT))
+ op.popup_delay_type = POPUP_DELAY_PERMANENT;
+
+ op.popup_timeout = GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE);
+ op.popup_bkg_color = SendDlgItemMessage(hwndDlg,IDC_BGCOLOR,CPM_GETCOLOUR,0,0);
+ op.popup_text_color = SendDlgItemMessage(hwndDlg,IDC_TEXTCOLOR,CPM_GETCOLOUR,0,0);
+ op.popup_use_win_colors = IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) != 0;
+ op.popup_use_default_colors = IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS) != 0;
+
+ HANDLE hContact = db_find_first();
+ ShowTestPopup(hContact,TranslateT("Test Contact"), TranslateT("Test description"), &op);
break;
}
}
return SaveOptsDlgProc(popupsControls, MAX_REGS(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
+
+// Functions //////////////////////////////////////////////////////////////////////////////////////
+
+int OptInit(WPARAM wParam, LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.hInstance = hInst;
+ odp.ptszGroup = LPGENT("History"); // group to put your item under
+ odp.ptszTitle = LPGENT("Avatar"); // name of the item
+ odp.pfnDlgProc = OptionsDlgProc;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ Options_AddPage(wParam, &odp);
+
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ odp.ptszGroup = LPGENT("PopUps");
+ odp.ptszTitle = LPGENT("Avatar Change");
+ odp.pfnDlgProc = PopupsDlgProc;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPS);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ Options_AddPage(wParam, &odp);
+ }
+
+ return 0;
+}
+
+void LoadOptions()
+{
+ LoadOpts(optionsControls, MAX_REGS(optionsControls), MODULE_NAME);
+ LoadOpts(popupsControls, MAX_REGS(popupsControls), MODULE_NAME);
+
+ opts.log_per_contact_folders = db_get_b(NULL, MODULE_NAME, "LogPerContactFolders", 0);
+ opts.log_keep_same_folder = db_get_b(NULL, MODULE_NAME, "LogKeepSameFolder", 0);
+ opts.log_store_as_hash = db_get_b(NULL, MODULE_NAME, "StoreAsHash", 1);
+}
diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp
index a27917de43..8338eabcf4 100644
--- a/plugins/AvatarHistory/src/popup.cpp
+++ b/plugins/AvatarHistory/src/popup.cpp
@@ -78,7 +78,7 @@ void ShowPopup(HANDLE hContact, const TCHAR *title, const TCHAR *description)
void ShowDebugPopup(HANDLE hContact, const TCHAR *title, const TCHAR *description)
{
- if(DBGetContactSettingByte(NULL,MODULE_NAME,"Debug",0))
+ if (db_get_b(NULL,MODULE_NAME,"Debug",0))
{
ShowPopup(hContact,title,description);
}
@@ -95,7 +95,7 @@ PopupDataType;
void ShowPopupEx(HANDLE hContact, const TCHAR *title, const TCHAR *description,
void *plugin_data, int type, const Options *op)
{
- if(ServiceExists(MS_POPUP_ADDPOPUPT))
+ if (ServiceExists(MS_POPUP_ADDPOPUPT))
{
// Make popup
POPUPDATAT ppd = {0};