diff options
Diffstat (limited to 'protocols/MRA')
-rw-r--r-- | protocols/MRA/Mra_10.vcxproj | 1 | ||||
-rw-r--r-- | protocols/MRA/Mra_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | protocols/MRA/Mra_11.vcxproj | 1 | ||||
-rw-r--r-- | protocols/MRA/Mra_11.vcxproj.filters | 3 | ||||
-rw-r--r-- | protocols/MRA/src/Mra.cpp | 59 | ||||
-rw-r--r-- | protocols/MRA/src/Mra.h | 43 | ||||
-rw-r--r-- | protocols/MRA/src/MraAdvancedSearch.cpp | 4 | ||||
-rw-r--r-- | protocols/MRA/src/MraConstans.h | 64 | ||||
-rw-r--r-- | protocols/MRA/src/MraIcons.cpp | 191 | ||||
-rw-r--r-- | protocols/MRA/src/MraPopUp.cpp | 6 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.cpp | 13 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.h | 11 | ||||
-rw-r--r-- | protocols/MRA/src/MraSelectEMail.cpp | 2 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_functions.cpp | 8 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_menus.cpp | 416 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_options.cpp | 2 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_svcs.cpp | 333 | ||||
-rw-r--r-- | protocols/MRA/src/version.h | 2 |
19 files changed, 569 insertions, 595 deletions
diff --git a/protocols/MRA/Mra_10.vcxproj b/protocols/MRA/Mra_10.vcxproj index 876028ed3c..aa10e41743 100644 --- a/protocols/MRA/Mra_10.vcxproj +++ b/protocols/MRA/Mra_10.vcxproj @@ -184,6 +184,7 @@ </ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="src\Mra_menus.cpp" />
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
diff --git a/protocols/MRA/Mra_10.vcxproj.filters b/protocols/MRA/Mra_10.vcxproj.filters index ad6ed0fe95..78ea889321 100644 --- a/protocols/MRA/Mra_10.vcxproj.filters +++ b/protocols/MRA/Mra_10.vcxproj.filters @@ -78,6 +78,9 @@ <ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\Mra_menus.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Mra.h">
diff --git a/protocols/MRA/Mra_11.vcxproj b/protocols/MRA/Mra_11.vcxproj index 58099eed05..2946db3a60 100644 --- a/protocols/MRA/Mra_11.vcxproj +++ b/protocols/MRA/Mra_11.vcxproj @@ -188,6 +188,7 @@ </ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="src\Mra_menus.cpp" />
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
diff --git a/protocols/MRA/Mra_11.vcxproj.filters b/protocols/MRA/Mra_11.vcxproj.filters index ad6ed0fe95..78ea889321 100644 --- a/protocols/MRA/Mra_11.vcxproj.filters +++ b/protocols/MRA/Mra_11.vcxproj.filters @@ -78,6 +78,9 @@ <ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\Mra_menus.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Mra.h">
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index ca07b67f0a..73328b2a45 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -2,7 +2,6 @@ LIST<CMraProto> g_Instances(1, PtrKeySortT);
-MRA_SETTINGS masMraSettings;
CLIST_INTERFACE *pcli;
int hLangpack;
@@ -20,21 +19,31 @@ PLUGININFOEX pluginInfoEx = { { 0xe7c48bab, 0x8ace, 0x4cb3, { 0x84, 0x46, 0xd4, 0xb7, 0x34, 0x81, 0xf4, 0x97 } }
};
+HANDLE g_hHeap;
+HINSTANCE g_hInstance;
+HMODULE g_hDLLXStatusIcons;
+HICON g_hMainIcon;
+
+DWORD g_dwGlobalPluginRunning;
+bool g_bChatExist;
+
+size_t g_dwMirWorkDirPathLen;
+WCHAR g_szMirWorkDirPath[MAX_FILEPATH];
+
void IconsLoad();
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID Reserved)
{
switch (dwReason) {
case DLL_PROCESS_ATTACH:
- bzero(&masMraSettings, sizeof(masMraSettings));
- masMraSettings.hInstance = hInstance;
- masMraSettings.hHeap = HeapCreate(0, 0, 0);
+ g_hInstance = hInstance;
+ g_hHeap = HeapCreate(0, 0, 0);
DisableThreadLibraryCalls(hInstance);
break;
case DLL_PROCESS_DETACH:
- HeapDestroy(masMraSettings.hHeap);
- masMraSettings.hHeap = NULL;
+ HeapDestroy(g_hHeap);
+ g_hHeap = NULL;
}
return TRUE;
@@ -67,13 +76,13 @@ static int mraProtoUninit(CMraProto *ppro) static int OnModulesLoaded(WPARAM, LPARAM)
{
- masMraSettings.dwGlobalPluginRunning = TRUE;
+ g_dwGlobalPluginRunning = TRUE;
return 0;
}
static int OnPreShutdown(WPARAM, LPARAM)
{
- masMraSettings.dwGlobalPluginRunning = FALSE;
+ g_dwGlobalPluginRunning = FALSE;
return 0;
}
@@ -83,34 +92,6 @@ extern "C" __declspec(dllexport) int Load(void) mir_getCLI();
IconsLoad();
-
- TCHAR szBuff[MAX_FILEPATH];
- LPSTR lpszFullFileName = (LPSTR)szBuff;
-
- // load libs
- if (GetModuleFileName(NULL, szBuff, MAX_FILEPATH)) {
- LPWSTR lpwszFileName;
- masMraSettings.dwMirWorkDirPathLen = GetFullPathName(szBuff, MAX_FILEPATH, masMraSettings.szMirWorkDirPath, &lpwszFileName);
- if (masMraSettings.dwMirWorkDirPathLen) {
- masMraSettings.dwMirWorkDirPathLen -= lstrlenW(lpwszFileName);
- masMraSettings.szMirWorkDirPath[masMraSettings.dwMirWorkDirPathLen] = 0;
-
- // load xstatus icons lib
- size_t dwBuffLen;
- DWORD dwErrorCode = FindFile(masMraSettings.szMirWorkDirPath, (DWORD)masMraSettings.dwMirWorkDirPathLen, _T("xstatus_MRA.dll"), -1, szBuff, SIZEOF(szBuff), (DWORD*)&dwBuffLen);
- if (dwErrorCode == NO_ERROR) {
- masMraSettings.hDLLXStatusIcons = LoadLibraryEx(szBuff, NULL, 0);
- if (masMraSettings.hDLLXStatusIcons) {
- dwBuffLen = LoadString(masMraSettings.hDLLXStatusIcons, IDS_IDENTIFY, szBuff, MAX_FILEPATH);
- if (dwBuffLen == 0 || _tcsnicmp(_T("# Custom Status Icons #"), szBuff, 23)) {
- FreeLibrary(masMraSettings.hDLLXStatusIcons);
- masMraSettings.hDLLXStatusIcons = NULL;
- }
- }
- }
- }
- }
-
InitXStatusIcons();
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
@@ -128,9 +109,9 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
DestroyXStatusIcons();
- if (masMraSettings.hDLLXStatusIcons) {
- FreeLibrary(masMraSettings.hDLLXStatusIcons);
- masMraSettings.hDLLXStatusIcons = NULL;
+ if (g_hDLLXStatusIcons) {
+ FreeLibrary(g_hDLLXStatusIcons);
+ g_hDLLXStatusIcons = NULL;
}
g_Instances.destroy();
diff --git a/protocols/MRA/src/Mra.h b/protocols/MRA/src/Mra.h index b5ef8016e5..770a0e18bb 100644 --- a/protocols/MRA/src/Mra.h +++ b/protocols/MRA/src/Mra.h @@ -160,26 +160,9 @@ BOOL DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszVal #include "MraConstans.h"
#include "MraProto.h"
-// структура содержащая информацию по построению меню или расширеных иконок
-struct GUI_DISPLAY_ITEM
-{
- LPSTR lpszName; // имя сервиса, оно же имя в иколибе
- LPWSTR lpwszDescr; // текстовое описание отображаемое юзеру
- LONG defIcon; // иконка из ресурсов
- CMraProto::MyServiceFunc lpFunc; // функция вызываемая меню
- HANDLE hIconHandle;
-};
-
-// структура содержащая информацию о сервисах/функциях
-struct SERVICE_ITEM
-{
- LPSTR lpszName; // имя сервиса, оно же имя в иколибе
- CMraProto::MyServiceFunc lpFunc; // функция вызываемая
-};
-
-extern GUI_DISPLAY_ITEM gdiMenuItems[];
-extern GUI_DISPLAY_ITEM gdiContactMenuItems[];
-extern GUI_DISPLAY_ITEM gdiExtraStatusIconsItems[];
+extern IconItem gdiMenuItems[];
+extern IconItem gdiContactMenuItems[];
+extern IconItem gdiExtraStatusIconsItems[];
#include "proto.h"
#include "MraMRIMProxy.h"
@@ -194,20 +177,16 @@ extern GUI_DISPLAY_ITEM gdiExtraStatusIconsItems[]; /////////////////////////////////////////////////////////////////////////////////////////
// plugin options
-struct MRA_SETTINGS
-{
- HANDLE hHeap;
- HINSTANCE hInstance;
- HMODULE hDLLXStatusIcons;
-
- DWORD dwGlobalPluginRunning;
- bool bChatExist;
+extern HANDLE g_hHeap;
+extern HINSTANCE g_hInstance;
+extern HMODULE g_hDLLXStatusIcons;
+extern HICON g_hMainIcon;
- size_t dwMirWorkDirPathLen;
- WCHAR szMirWorkDirPath[MAX_FILEPATH];
-};
+extern DWORD g_dwGlobalPluginRunning;
+extern bool g_bChatExist;
-extern MRA_SETTINGS masMraSettings;
+extern size_t g_dwMirWorkDirPathLen;
+extern WCHAR g_szMirWorkDirPath[MAX_FILEPATH];
/////////////////////////////////////////////////////////////////////////////////////////
// External variables
diff --git a/protocols/MRA/src/MraAdvancedSearch.cpp b/protocols/MRA/src/MraAdvancedSearch.cpp index dc39725dfa..6c62bca48f 100644 --- a/protocols/MRA/src/MraAdvancedSearch.cpp +++ b/protocols/MRA/src/MraAdvancedSearch.cpp @@ -336,8 +336,8 @@ HWND CMraProto::SearchAdvanced(HWND hWndDlg) HWND CMraProto::CreateExtendedSearchUI(HWND owner)
{
- if (masMraSettings.hInstance && owner)
- return CreateDialogParam(masMraSettings.hInstance, MAKEINTRESOURCE(IDD_MRAADVANCEDSEARCH), owner, AdvancedSearchDlgProc, (LPARAM)this);
+ if (g_hInstance && owner)
+ return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MRAADVANCEDSEARCH), owner, AdvancedSearchDlgProc, (LPARAM)this);
return NULL;
}
diff --git a/protocols/MRA/src/MraConstans.h b/protocols/MRA/src/MraConstans.h index c4169375bb..9dac17aa59 100644 --- a/protocols/MRA/src/MraConstans.h +++ b/protocols/MRA/src/MraConstans.h @@ -44,33 +44,27 @@ static const LPSTR lpcszMailRuDomains[] = #define MRA_ALARM_MESSAGE LPGENT("Your contact wakes you")
#define MRA_GOTO_INBOX "/GotoInbox"
-#define MRA_GOTO_INBOX_STR LPGENT("Display &Inbox")
+#define MRA_GOTO_INBOX_STR LPGEN("Display &Inbox")
#define MRA_SHOW_INBOX_STATUS "/ShowInboxStatus"
-#define MRA_SHOW_INBOX_STATUS_STR LPGENT("Display &Inbox status")
+#define MRA_SHOW_INBOX_STATUS_STR LPGEN("Display &Inbox status")
#define MRA_EDIT_PROFILE "/EditProfile"
-#define MRA_EDIT_PROFILE_STR LPGENT("Edit &Profile")
-#define MRA_MY_ALBUM "/MyAlbum"
-#define MRA_MY_ALBUM_STR LPGENT("My Album")
-#define MRA_MY_BLOG "/MyBlog"
-#define MRA_MY_BLOG_STR LPGENT("My Blog")
-#define MRA_MY_BLOGSTATUS "/MyBlogStatus"
-#define MRA_MY_BLOGSTATUS_STR LPGENT("My Blog Status")
-#define MRA_MY_VIDEO "/MyVideo"
-#define MRA_MY_VIDEO_STR LPGENT("My Video")
-#define MRA_MY_ANSWERS "/MyAnswers"
-#define MRA_MY_ANSWERS_STR LPGENT("My Answers")
-#define MRA_MY_WORLD "/MyWorld"
-#define MRA_MY_WORLD_STR LPGENT("My World")
+#define MRA_EDIT_PROFILE_STR LPGEN("Edit &Profile")
+#define MRA_MY_ALBUM_STR LPGEN("My Album")
+#define MRA_MY_BLOG_STR LPGEN("My Blog")
+#define MRA_MY_BLOGSTATUS_STR LPGEN("My Blog Status")
+#define MRA_MY_VIDEO_STR LPGEN("My Video")
+#define MRA_MY_ANSWERS_STR LPGEN("My Answers")
+#define MRA_MY_WORLD_STR LPGEN("My World")
#define MRA_ZHUKI "/Zhuki"
-#define MRA_ZHUKI_STR LPGENT("Zhuki")
+#define MRA_ZHUKI_STR LPGEN("Zhuki")
#define MRA_WEB_SEARCH "/WebSearch"
-#define MRA_WEB_SEARCH_STR LPGENT("Web search")
+#define MRA_WEB_SEARCH_STR LPGEN("Web search")
#define MRA_UPD_ALL_USERS_INFO "/UpdateAllUsersInfo"
-#define MRA_UPD_ALL_USERS_INFO_STR LPGENT("Update all users info")
+#define MRA_UPD_ALL_USERS_INFO_STR LPGEN("Update all users info")
#define MRA_CHK_USERS_AVATARS "/CheckUpdatesUsersAvatars"
-#define MRA_CHK_USERS_AVATARS_STR LPGENT("Check users avatars updates")
+#define MRA_CHK_USERS_AVATARS_STR LPGEN("Check users avatars updates")
#define MRA_REQ_AUTH_FOR_ALL "/ReqAuthForAll"
-#define MRA_REQ_AUTH_FOR_ALL_STR LPGENT("Request authorization for all")
+#define MRA_REQ_AUTH_FOR_ALL_STR LPGEN("Request authorization for all")
#define MRA_MPOP_AUTH_URL "http://swa.mail.ru/cgi-bin/auth?Login=%s&agent=%s&page=%s"
@@ -95,40 +89,40 @@ static const LPSTR lpcszMailRuDomains[] = // wParam = (WPARAM)hContact
#define MRA_REQ_AUTH "/ReqAuth"
-#define MRA_REQ_AUTH_STR LPGENT("Request authorization")
+#define MRA_REQ_AUTH_STR LPGEN("Request authorization")
#define MRA_GRANT_AUTH "/GrantAuth"
-#define MRA_GRANT_AUTH_STR LPGENT("Grant authorization")
+#define MRA_GRANT_AUTH_STR LPGEN("Grant authorization")
#define MRA_SEND_POSTCARD "/SendPostcard"
-#define MRA_SEND_POSTCARD_STR LPGENT("&Send postcard")
+#define MRA_SEND_POSTCARD_STR LPGEN("&Send postcard")
#define MRA_VIEW_ALBUM "/ViewAlbum"
-#define MRA_VIEW_ALBUM_STR LPGENT("&View Album")
+#define MRA_VIEW_ALBUM_STR LPGEN("&View Album")
#define MRA_READ_BLOG "/ReadBlog"
-#define MRA_READ_BLOG_STR LPGENT("&Read Blog")
+#define MRA_READ_BLOG_STR LPGEN("&Read Blog")
#define MRA_REPLY_BLOG_STATUS "/ReplyBlogStatus"
-#define MRA_REPLY_BLOG_STATUS_STR LPGENT("Reply Blog Status")
+#define MRA_REPLY_BLOG_STATUS_STR LPGEN("Reply Blog Status")
#define MRA_VIEW_VIDEO "/ViewVideo"
-#define MRA_VIEW_VIDEO_STR LPGENT("View Video")
+#define MRA_VIEW_VIDEO_STR LPGEN("View Video")
#define MRA_ANSWERS "/Answers"
-#define MRA_ANSWERS_STR LPGENT("Answers")
+#define MRA_ANSWERS_STR LPGEN("Answers")
#define MRA_WORLD "/World"
-#define MRA_WORLD_STR LPGENT("World")
-#define MRA_SENDNUDGE_STR LPGENT("Send &Nudge")
+#define MRA_WORLD_STR LPGEN("World")
+#define MRA_SENDNUDGE_STR LPGEN("Send &Nudge")
#define ADV_ICON_DELETED 0
#define ADV_ICON_DELETED_ID "ADV_ICON_DELETED"
-#define ADV_ICON_DELETED_STR LPGENT("Mail box deleted")
+#define ADV_ICON_DELETED_STR LPGEN("Mail box deleted")
#define ADV_ICON_NOT_ON_SERVER 1
#define ADV_ICON_NOT_ON_SERVER_ID "ADV_ICON_NOT_ON_SERVER"
-#define ADV_ICON_NOT_ON_SERVER_STR LPGENT("Contact not on server")
+#define ADV_ICON_NOT_ON_SERVER_STR LPGEN("Contact not on server")
#define ADV_ICON_NOT_AUTHORIZED 2
#define ADV_ICON_NOT_AUTHORIZED_ID "ADV_ICON_NOT_AUTHORIZED"
-#define ADV_ICON_NOT_AUTHORIZED_STR LPGENT("Not authorized")
+#define ADV_ICON_NOT_AUTHORIZED_STR LPGEN("Not authorized")
#define ADV_ICON_PHONE 3
#define ADV_ICON_PHONE_ID "ADV_ICON_PHONE"
-#define ADV_ICON_PHONE_STR LPGENT("Phone/SMS only contact")
+#define ADV_ICON_PHONE_STR LPGEN("Phone/SMS only contact")
#define ADV_ICON_BLOGSTATUS 4
#define ADV_ICON_BLOGSTATUS_ID "ADV_ICON_BLOGSTATUS"
-#define ADV_ICON_BLOGSTATUS_STR LPGENT("Blog status message")
+#define ADV_ICON_BLOGSTATUS_STR LPGEN("Blog status message")
#define MRA_SOUND_NEW_EMAIL LPGEN("New E-mail available in Inbox")
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index 9917c681e5..3df65987a3 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -3,75 +3,49 @@ HANDLE hXStatusAdvancedStatusIcons[MRA_XSTATUS_COUNT+4];
-GUI_DISPLAY_ITEM gdiMenuItems[] =
+IconItem gdiMenuItems[MAIN_MENU_ITEMS_COUNT] =
{
- { MRA_GOTO_INBOX, MRA_GOTO_INBOX_STR, IDI_INBOX, &CMraProto::MraGotoInbox },
- { MRA_SHOW_INBOX_STATUS, MRA_SHOW_INBOX_STATUS_STR, IDI_MAIL_NOTIFY, &CMraProto::MraShowInboxStatus },
- { MRA_EDIT_PROFILE, MRA_EDIT_PROFILE_STR, IDI_PROFILE, &CMraProto::MraEditProfile },
- { MRA_MY_ALBUM, MRA_MY_ALBUM_STR, IDI_MRA_PHOTO, &CMraProto::MraViewAlbum },
- { MRA_MY_BLOG, MRA_MY_BLOG_STR, IDI_MRA_BLOGS, &CMraProto::MraReadBlog },
- { MRA_MY_BLOGSTATUS, MRA_MY_BLOGSTATUS_STR, IDI_BLOGSTATUS, &CMraProto::MraReplyBlogStatus },
- { MRA_MY_VIDEO, MRA_MY_VIDEO_STR, IDI_MRA_VIDEO, &CMraProto::MraViewVideo },
- { MRA_MY_ANSWERS, MRA_MY_ANSWERS_STR, IDI_MRA_ANSWERS, &CMraProto::MraAnswers },
- { MRA_MY_WORLD, MRA_MY_WORLD_STR, IDI_MRA_WORLD, &CMraProto::MraWorld },
- { MRA_ZHUKI, MRA_ZHUKI_STR, IDI_MRA_ZHUKI, &CMraProto::MraZhuki },
- { MRA_WEB_SEARCH, MRA_WEB_SEARCH_STR, IDI_MRA_WEB_SEARCH, &CMraProto::MraWebSearch },
- { MRA_UPD_ALL_USERS_INFO, MRA_UPD_ALL_USERS_INFO_STR, IDI_PROFILE, &CMraProto::MraUpdateAllUsersInfo },
- { MRA_CHK_USERS_AVATARS, MRA_CHK_USERS_AVATARS_STR, IDI_PROFILE, &CMraProto::MraCheckUpdatesUsersAvt },
- { MRA_REQ_AUTH_FOR_ALL, MRA_REQ_AUTH_FOR_ALL_STR, IDI_AUTHRUGUEST, &CMraProto::MraRequestAuthForAll }
+ { MRA_GOTO_INBOX_STR, MRA_GOTO_INBOX, IDI_INBOX },
+ { MRA_SHOW_INBOX_STATUS_STR, MRA_SHOW_INBOX_STATUS, IDI_MAIL_NOTIFY },
+ { MRA_EDIT_PROFILE_STR, MRA_EDIT_PROFILE, IDI_PROFILE },
+ { MRA_MY_ALBUM_STR, MRA_VIEW_ALBUM, IDI_MRA_PHOTO },
+ { MRA_MY_BLOG_STR, MRA_READ_BLOG, IDI_MRA_BLOGS },
+ { MRA_MY_BLOGSTATUS_STR, MRA_REPLY_BLOG_STATUS, IDI_BLOGSTATUS },
+ { MRA_MY_VIDEO_STR, MRA_VIEW_VIDEO, IDI_MRA_VIDEO },
+ { MRA_MY_ANSWERS_STR, MRA_ANSWERS, IDI_MRA_ANSWERS },
+ { MRA_MY_WORLD_STR, MRA_WORLD, IDI_MRA_WORLD },
+ { MRA_ZHUKI_STR, MRA_ZHUKI, IDI_MRA_ZHUKI },
+ { MRA_WEB_SEARCH_STR, MRA_WEB_SEARCH, IDI_MRA_WEB_SEARCH },
+ { MRA_UPD_ALL_USERS_INFO_STR, MRA_UPD_ALL_USERS_INFO, IDI_PROFILE },
+ { MRA_CHK_USERS_AVATARS_STR, MRA_CHK_USERS_AVATARS, IDI_PROFILE },
+ { MRA_REQ_AUTH_FOR_ALL_STR, MRA_REQ_AUTH_FOR_ALL, IDI_AUTHRUGUEST }
};
-GUI_DISPLAY_ITEM gdiContactMenuItems[] =
+IconItem gdiContactMenuItems[CONTACT_MENU_ITEMS_COUNT] =
{
- { MRA_REQ_AUTH, MRA_REQ_AUTH_STR, IDI_AUTHRUGUEST, &CMraProto::MraRequestAuthorization },
- { MRA_GRANT_AUTH, MRA_GRANT_AUTH_STR, IDI_AUTHGRANT, &CMraProto::MraGrantAuthorization },
- { MRA_SEND_POSTCARD, MRA_SEND_POSTCARD_STR, IDI_MRA_POSTCARD, &CMraProto::MraSendPostcard },
- { MRA_VIEW_ALBUM, MRA_VIEW_ALBUM_STR, IDI_MRA_PHOTO, &CMraProto::MraViewAlbum },
- { MRA_READ_BLOG, MRA_READ_BLOG_STR , IDI_MRA_BLOGS, &CMraProto::MraReadBlog },
- { MRA_REPLY_BLOG_STATUS, MRA_REPLY_BLOG_STATUS_STR, IDI_BLOGSTATUS, &CMraProto::MraReplyBlogStatus },
- { MRA_VIEW_VIDEO, MRA_VIEW_VIDEO_STR, IDI_MRA_VIDEO, &CMraProto::MraViewVideo },
- { MRA_ANSWERS, MRA_ANSWERS_STR, IDI_MRA_ANSWERS, &CMraProto::MraAnswers },
- { MRA_WORLD, MRA_WORLD_STR, IDI_MRA_WORLD, &CMraProto::MraWorld },
- { PS_SEND_NUDGE, MRA_SENDNUDGE_STR, IDI_MRA_ALARM, NULL }
+ { MRA_REQ_AUTH_STR, MRA_REQ_AUTH, IDI_AUTHRUGUEST },
+ { MRA_GRANT_AUTH_STR, MRA_GRANT_AUTH, IDI_AUTHGRANT },
+ { MRA_SEND_POSTCARD_STR, MRA_SEND_POSTCARD, IDI_MRA_POSTCARD },
+ { MRA_VIEW_ALBUM_STR, MRA_VIEW_ALBUM, IDI_MRA_PHOTO },
+ { MRA_READ_BLOG_STR, MRA_READ_BLOG, IDI_MRA_BLOGS },
+ { MRA_REPLY_BLOG_STATUS_STR, MRA_REPLY_BLOG_STATUS, IDI_BLOGSTATUS },
+ { MRA_VIEW_VIDEO_STR, MRA_VIEW_VIDEO, IDI_MRA_VIDEO },
+ { MRA_ANSWERS_STR, MRA_ANSWERS, IDI_MRA_ANSWERS },
+ { MRA_WORLD_STR, MRA_WORLD, IDI_MRA_WORLD },
+ { MRA_SENDNUDGE_STR, PS_SEND_NUDGE, IDI_MRA_ALARM }
};
-GUI_DISPLAY_ITEM gdiExtraStatusIconsItems[] =
+IconItem gdiExtraStatusIconsItems[ADV_ICON_MAX] =
{
- { ADV_ICON_DELETED_ID, ADV_ICON_DELETED_STR, IDI_DELETED, NULL },
- { ADV_ICON_NOT_ON_SERVER_ID, ADV_ICON_NOT_ON_SERVER_STR, IDI_AUTHGRANT, NULL },
- { ADV_ICON_NOT_AUTHORIZED_ID, ADV_ICON_NOT_AUTHORIZED_STR, IDI_AUTHRUGUEST, NULL },
- { ADV_ICON_PHONE_ID, ADV_ICON_PHONE_STR, IDI_MRA_PHONE, NULL },
- { ADV_ICON_BLOGSTATUS_ID, ADV_ICON_BLOGSTATUS_STR, IDI_BLOGSTATUS, NULL },
+ { ADV_ICON_DELETED_STR, ADV_ICON_DELETED_ID, IDI_DELETED },
+ { ADV_ICON_NOT_ON_SERVER_STR, ADV_ICON_NOT_ON_SERVER_ID, IDI_AUTHGRANT },
+ { ADV_ICON_NOT_AUTHORIZED_STR, ADV_ICON_NOT_AUTHORIZED_ID, IDI_AUTHRUGUEST },
+ { ADV_ICON_PHONE_STR, ADV_ICON_PHONE_ID, IDI_MRA_PHONE },
+ { ADV_ICON_BLOGSTATUS_STR, ADV_ICON_BLOGSTATUS_ID, IDI_BLOGSTATUS }
};
//////////////////////////////////////////////////////////////////////////////////////
-static void AddIcoLibItems(LPWSTR lptszSubSectionName, GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount)
-{
- TCHAR tszSection[MAX_PATH], tszPath[MAX_FILEPATH];
- GetModuleFileName(masMraSettings.hInstance, tszPath, SIZEOF(tszPath));
- mir_sntprintf(tszSection, SIZEOF(tszSection), _T("Protocols/MRA/%s"), lptszSubSectionName);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszSection = tszSection;
- sid.ptszDefaultFile = tszPath;
- sid.cx = sid.cy = 16;
- sid.flags = SIDF_ALL_UNICODE;
-
- if (lptszSubSectionName == NULL)
- lptszSubSectionName = _T("");
-
- for (size_t i = 0;i<dwCount;i++) {
- char szBuff[MAX_PATH];
- mir_snprintf(szBuff, SIZEOF(szBuff), "MRA_%s", pgdiItems[i].lpszName);
-
- sid.pszName = szBuff;
- sid.pwszDescription = pgdiItems[i].lpwszDescr;
- sid.iDefaultIndex = -pgdiItems[i].defIcon;
- pgdiItems[i].hIconHandle = Skin_AddIcon(&sid);
- }
-}
-
HICON IconLibGetIcon(HANDLE hIcon)
{
return IconLibGetIconEx(hIcon, LR_SHARED);
@@ -92,24 +66,45 @@ HICON IconLibGetIconEx(HANDLE hIcon, DWORD dwFlags) void IconsLoad()
{
- AddIcoLibItems(LPGENT("Main Menu"), gdiMenuItems, SIZEOF(gdiMenuItems));
- AddIcoLibItems(LPGENT("Contact Menu"), gdiContactMenuItems, SIZEOF(gdiContactMenuItems));
+ g_hMainIcon = (HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_MRA), IMAGE_ICON, 0, 0, LR_SHARED);
- // Advanced Status Icons initialization
- AddIcoLibItems(LPGENT("Extra status"), gdiExtraStatusIconsItems, SIZEOF(gdiExtraStatusIconsItems));
+ Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("MRA") "/" LPGEN("Main Menu"), gdiMenuItems, MAIN_MENU_ITEMS_COUNT, "MRA_");
+ Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("MRA") "/" LPGEN("Contact Menu"), gdiContactMenuItems, CONTACT_MENU_ITEMS_COUNT, "MRA_");
+ Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("MRA") "/" LPGEN("Extra status"), gdiExtraStatusIconsItems, ADV_ICON_MAX, "MRA_");
}
void InitXStatusIcons()
{
- TCHAR tszPath[MAX_FILEPATH];
- if (masMraSettings.hDLLXStatusIcons)
- GetModuleFileName(masMraSettings.hDLLXStatusIcons, tszPath, SIZEOF(tszPath));
- else
- bzero(tszPath, sizeof(tszPath));
+ // load libs
+ TCHAR szBuff[MAX_FILEPATH];
+ if (GetModuleFileName(NULL, szBuff, SIZEOF(szBuff))) {
+ LPWSTR lpwszFileName;
+ g_dwMirWorkDirPathLen = GetFullPathName(szBuff, MAX_FILEPATH, g_szMirWorkDirPath, &lpwszFileName);
+ if (g_dwMirWorkDirPathLen) {
+ g_dwMirWorkDirPathLen -= lstrlenW(lpwszFileName);
+ g_szMirWorkDirPath[g_dwMirWorkDirPathLen] = 0;
+
+ // load xstatus icons lib
+ DWORD dwBuffLen;
+ DWORD dwErrorCode = FindFile(g_szMirWorkDirPath, (DWORD)g_dwMirWorkDirPathLen, _T("xstatus_MRA.dll"), -1, szBuff, SIZEOF(szBuff), &dwBuffLen);
+ if (dwErrorCode == NO_ERROR) {
+ g_hDLLXStatusIcons = LoadLibraryEx(szBuff, NULL, 0);
+ if (g_hDLLXStatusIcons) {
+ dwBuffLen = LoadString(g_hDLLXStatusIcons, IDS_IDENTIFY, szBuff, MAX_FILEPATH);
+ if (dwBuffLen == 0 || _tcsnicmp(_T("# Custom Status Icons #"), szBuff, 23)) {
+ FreeLibrary(g_hDLLXStatusIcons);
+ g_hDLLXStatusIcons = NULL;
+ }
+ }
+ }
+ }
+ }
+
+ GetModuleFileName((g_hDLLXStatusIcons != NULL) ? g_hDLLXStatusIcons : g_hInstance, szBuff, SIZEOF(szBuff));
SKINICONDESC sid = { sizeof(sid) };
sid.ptszSection = LPGENT("Protocols")_T("/")LPGENT("MRA")_T("/")LPGENT("Custom Status");
- sid.ptszDefaultFile = tszPath;
+ sid.ptszDefaultFile = szBuff;
sid.cx = sid.cy = 16;
sid.flags = SIDF_ALL_TCHAR;
@@ -138,63 +133,3 @@ void DestroyXStatusIcons() bzero(hXStatusAdvancedStatusIcons, sizeof(hXStatusAdvancedStatusIcons));
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-void CMraProto::InitMainMenu()
-{
- HICON hMainIcon = (HICON)LoadImage(masMraSettings.hInstance, MAKEINTRESOURCE(IDI_MRA), IMAGE_ICON, 0, 0, LR_SHARED);
- CListCreateMenu(200001, 500085000, hMainIcon, NULL, TRUE, gdiMenuItems, SIZEOF(gdiMenuItems), hMainMenuItems);
-}
-
-void CMraProto::InitContactMenu()
-{
- CListCreateMenu(2000060000, -500050000, NULL, NULL, FALSE, gdiContactMenuItems, SIZEOF(gdiContactMenuItems), hContactMenuItems);
-}
-
-void CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsMain, const GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HGENMENU *hResult)
-{
- if (!pgdiItems || !dwCount || !hResult)
- return;
-
- char szServiceFunction[MAX_PATH], *pszServiceFunctionName;
- strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
- pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName);
-
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.position = -1999901008;
-
- HGENMENU (*fnAddFunc)(CLISTMENUITEM*);
- if (bIsMain) {
- fnAddFunc = Menu_AddProtoMenuItem;
-
- HGENMENU hRootMenu = MO_GetProtoRootMenu(m_szModuleName);
- if (hRootMenu == NULL) {
- mi.ptszName = m_tszUserName;
- mi.hParentMenu = HGENMENU_ROOT;
- mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- mi.hIcon = hMainIcon;
- hRootMenu = Menu_AddProtoMenuItem(&mi);
- }
- mi.hParentMenu = hRootMenu;
- mi.flags = CMIF_UNICODE | CMIF_CHILDPOPUP;
- }
- else {
- fnAddFunc = Menu_AddContactMenuItem;
- mi.ptszPopupName = m_tszUserName;
- mi.flags = CMIF_UNICODE;
- }
-
- mi.popupPosition = lPopupPosition;
- mi.pszService = szServiceFunction;
-
- for (size_t i = 0; i < dwCount; i++) {
- memmove(pszServiceFunctionName, pgdiItems[i].lpszName, lstrlenA(pgdiItems[i].lpszName)+1);
- if (pgdiItems[i].lpFunc)
- CreateProtoService(pgdiItems[i].lpszName, pgdiItems[i].lpFunc);
- mi.position = int(lPosition + i);
- mi.icolibItem = pgdiItems[i].hIconHandle;
- mi.ptszName = pgdiItems[i].lpwszDescr;
- hResult[i] = fnAddFunc(&mi);
- }
-}
diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp index f33269fd33..5d70971e06 100644 --- a/protocols/MRA/src/MraPopUp.cpp +++ b/protocols/MRA/src/MraPopUp.cpp @@ -131,7 +131,7 @@ int CMraProto::OnPopupOptInit(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.dwInitParam = (LPARAM)this;
odp.position = 100000000;
- odp.hInstance = masMraSettings.hInstance;
+ odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUPS);
odp.pszTitle = m_szModuleName;
odp.pszGroup = LPGEN("Popups");
@@ -246,7 +246,7 @@ void CMraProto::MraPopupShowW(HANDLE hContact, DWORD dwType, DWORD dwFlags, LPWS // load icon
switch (dwType) {
case MRA_POPUP_TYPE_NONE:// proto icon
- ppd->lchIcon = (HICON)LoadImage(masMraSettings.hInstance, MAKEINTRESOURCE(IDI_MRA), IMAGE_ICON, 0, 0, LR_SHARED);
+ ppd->lchIcon = g_hMainIcon;
break;
case MRA_POPUP_TYPE_DEBUG:// IDI_APPLICATION
ppd->lchIcon = (HICON)LoadImage(NULL, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_SHARED);
@@ -264,7 +264,7 @@ void CMraProto::MraPopupShowW(HANDLE hContact, DWORD dwType, DWORD dwFlags, LPWS ppd->lchIcon = (HICON)LoadImage(NULL, IDI_ERROR, IMAGE_ICON, 0, 0, LR_SHARED);
break;
case MRA_POPUP_TYPE_EMAIL_STATUS:
- ppd->lchIcon = (HICON)LoadImage(masMraSettings.hInstance, MAKEINTRESOURCE(IDI_MAIL_NOTIFY), IMAGE_ICON, 0, 0, LR_SHARED);
+ ppd->lchIcon = (HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_MAIL_NOTIFY), IMAGE_ICON, 0, 0, LR_SHARED);
break;
}
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 462c35dbb9..753ba4a466 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -46,14 +46,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : HookProtoEvent(ME_SYSTEM_PRESHUTDOWN, &CMraProto::OnPreShutdown);
- InitContactMenu();
-
- // xstatus menu
- for (size_t i = 0; i < MRA_XSTATUS_COUNT; i++) {
- char szServiceName[100];
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "/menuXStatus%ld", i);
- CreateProtoServiceParam(szServiceName, &CMraProto::MraXStatusMenu, i);
- }
+ InitMenus();
mir_snprintf(szNewMailSound, SIZEOF(szNewMailSound), "%s: %s", m_szModuleName, MRA_SOUND_NEW_EMAIL);
SkinAddNewSoundEx(szNewMailSound, m_szModuleName, MRA_SOUND_NEW_EMAIL);
@@ -86,7 +79,7 @@ CMraProto::~CMraProto() INT_PTR CMraProto::MraCreateAccMgrUI(WPARAM wParam,LPARAM lParam)
{
- return (int)CreateDialogParam(masMraSettings.hInstance, MAKEINTRESOURCE(IDD_MRAACCOUNT),
+ return (int)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MRAACCOUNT),
(HWND)lParam, DlgProcAccount, LPARAM(this));
}
@@ -626,7 +619,7 @@ int CMraProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) case EV_PROTO_ONOPTIONS: return OnOptionsInit( wParam, lParam );
case EV_PROTO_ONMENU:
- InitMainMenu();
+ CListCreateMenu(2000060000, 500085000, TRUE, gdiMenuItems, MAIN_MENU_ITEMS_COUNT, hMainMenuItems);
break;
}
return 1;
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 325b8d1409..ebd76449ab 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -10,7 +10,7 @@ #define SCBIF_NICK 64
#define SCBIF_PHONES 128
-#define MAIN_MENU_ITEMS_COUNT 15
+#define MAIN_MENU_ITEMS_COUNT 14
#define CONTACT_MENU_ITEMS_COUNT 10
#define ADV_ICON_MAX 5
@@ -183,8 +183,8 @@ struct CMraProto : public PROTO<CMraProto> HANDLE hAvatarsQueueHandle;
- HGENMENU hMainMenuItems[MAIN_MENU_ITEMS_COUNT+4];
- HGENMENU hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+4];
+ HGENMENU hMainMenuItems[MAIN_MENU_ITEMS_COUNT];
+ HGENMENU hContactMenuItems[CONTACT_MENU_ITEMS_COUNT];
HWND hWndEMailPopupStatus;
DWORD dwEmailMessagesTotal, m_dwEmailMessagesUnread;
@@ -283,9 +283,8 @@ struct CMraProto : public PROTO<CMraProto> void SetExtraIcons(HANDLE hContact);
- void InitMainMenu();
- void InitContactMenu();
- void CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsStatus, const struct GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HGENMENU *hResult);
+ void InitMenus(void);
+ void CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bIsStatus, const IconItem *pgdiItems, size_t dwCount, HGENMENU *hResult);
DWORD ProtoBroadcastAckAsync(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam);
CMStringA CreateBlobFromContact(HANDLE hContact, const CMStringW &wszRequestReason);
diff --git a/protocols/MRA/src/MraSelectEMail.cpp b/protocols/MRA/src/MraSelectEMail.cpp index 3978c57a8b..6081d902c0 100644 --- a/protocols/MRA/src/MraSelectEMail.cpp +++ b/protocols/MRA/src/MraSelectEMail.cpp @@ -146,7 +146,7 @@ DWORD CMraProto::MraSelectEMailDlgShow(HANDLE hContact, DWORD dwType) dat->ppro = this;
dat->hContact = hContact;
dat->dwType = dwType;
- DialogBoxParam(masMraSettings.hInstance, MAKEINTRESOURCE(IDD_DIALOG_SELECT_EMAIL), NULL, MraSelectEMailDlgProc, (LPARAM)dat);
+ DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_SELECT_EMAIL), NULL, MraSelectEMailDlgProc, (LPARAM)dat);
}
return 0;
}
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 1e7b335c67..7bce3fba9b 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -659,7 +659,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & //cle.hContact;
//cle.hDbEvent;
cle.lpszProtocol = m_szModuleName;
- cle.hIcon = IconLibGetIcon( gdiMenuItems[0].hIconHandle );
+ cle.hIcon = IconLibGetIcon(gdiMenuItems[0].hIcolib);
cle.flags = (CLEF_UNICODE|CLEF_PROTOCOLGLOBAL);
cle.pszService = "";
cle.ptszTooltip = szStatusText;
@@ -1086,7 +1086,7 @@ bool CMraProto::MraRequestXStatusDetails(DWORD dwXStatus) SetXStatusData *dat = (SetXStatusData*)mir_calloc(sizeof(SetXStatusData));
dat->dwXStatus = dwXStatus;
dat->ppro = this;
- return DialogBoxParam(masMraSettings.hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), NULL, SetXStatusDlgProc, (LPARAM)dat) != -1;
+ return DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), NULL, SetXStatusDlgProc, (LPARAM)dat) != -1;
}
return false;
@@ -1114,7 +1114,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w SetWindowLongPtr(hWndEdit, GWLP_USERDATA, (LONG_PTR)OldMessageEditProc);
SendMessage(hWndEdit, EM_LIMITTEXT, MICBLOG_STATUS_MAX, 0);
- SendMessage(hWndDlg, WM_SETICON, ICON_BIG, (LPARAM)IconLibGetIcon(gdiMenuItems[5].hIconHandle));
+ SendMessage(hWndDlg, WM_SETICON, ICON_BIG, (LPARAM)IconLibGetIcon(gdiMenuItems[5].hIcolib));
// blog status message
CMStringW szBuff;
@@ -1208,7 +1208,7 @@ bool CMraProto::MraSendReplyBlogStatus(HANDLE hContact) SetBlogStatusData* dat = (SetBlogStatusData*)mir_calloc( sizeof(SetBlogStatusData));
dat->ppro = this;
dat->hContact = hContact;
- return CreateDialogParam(masMraSettings.hInstance, MAKEINTRESOURCE(IDD_MINIBLOG), NULL, SendReplyBlogStatusDlgProc, (LPARAM)dat) != NULL;
+ return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MINIBLOG), NULL, SendReplyBlogStatusDlgProc, (LPARAM)dat) != NULL;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp new file mode 100644 index 0000000000..ea3a503d00 --- /dev/null +++ b/protocols/MRA/src/Mra_menus.cpp @@ -0,0 +1,416 @@ +#include "Mra.h"
+#include "proto.h"
+
+INT_PTR CMraProto::MraGotoInbox(WPARAM wParam, LPARAM lParam)
+{
+ MraMPopSessionQueueAddUrl(hMPopSessionQueue, MRA_WIN_INBOX_URL);
+ return 0;
+}
+
+INT_PTR CMraProto::MraShowInboxStatus(WPARAM wParam, LPARAM lParam)
+{
+ MraUpdateEmailStatus("", "", 0, 0);
+ return 0;
+}
+
+INT_PTR CMraProto::MraSendSMS(WPARAM wParam, LPARAM lParam)
+{
+ if (!m_bLoggedIn || !wParam || !lParam)
+ return 0;
+
+ ptrW lpwszMessageXMLEncoded( mir_utf8decodeW((LPSTR)lParam));
+ if (lpwszMessageXMLEncoded) {
+ CMStringW decoded = DecodeXML( CMStringW(lpwszMessageXMLEncoded));
+ if (decoded.GetLength())
+ MraSMSW(NULL, CMStringA((LPSTR)wParam), decoded);
+ }
+
+ return 0;
+}
+
+INT_PTR CMraProto::MraEditProfile(WPARAM wParam, LPARAM lParam)
+{
+ MraMPopSessionQueueAddUrl(hMPopSessionQueue, MRA_EDIT_PROFILE_URL);
+ return 0;
+}
+
+INT_PTR CMraProto::MraZhuki(WPARAM wParam, LPARAM lParam)
+{
+ MraMPopSessionQueueAddUrl(hMPopSessionQueue, MRA_ZHUKI_URL);
+ return 0;
+}
+
+INT_PTR CMraProto::MraWebSearch(WPARAM wParam, LPARAM lParam)
+{
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)MRA_SEARCH_URL);
+ return 0;
+}
+
+INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM wParam, LPARAM lParam)
+{
+ if ( MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_UPD_ALL_USERS_INFO_STR), MB_YESNO | MB_ICONQUESTION) == IDYES ) {
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ CMStringA szEmail;
+ if ( mraGetStringA(hContact, "e-mail", szEmail))
+ MraWPRequestByEMail(hContact, ACKTYPE_GETINFO, szEmail);
+ }
+ }
+ return 0;
+}
+
+INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM wParam, LPARAM lParam)
+{
+ if ( MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_CHK_USERS_AVATARS_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ CMStringA szEmail;
+ if (mraGetStringA(hContact, "e-mail", szEmail))
+ if ( !IsEMailChatAgent(szEmail))
+ MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, 0, hContact, 0);
+ }
+ }
+ return 0;
+}
+
+INT_PTR CMraProto::MraRequestAuthForAll(WPARAM wParam, LPARAM lParam)
+{
+ if ( MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_REQ_AUTH_FOR_ALL_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ DWORD dwContactSeverFlags;
+ if (GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL) == NO_ERROR)
+ if (dwContactSeverFlags & CONTACT_INTFLAG_NOT_AUTHORIZED && dwContactSeverFlags != -1)
+ MraRequestAuthorization((WPARAM)hContact, 0);
+ }
+ }
+ return 0;
+}
+
+INT_PTR CMraProto::MraRequestAuthorization(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE)wParam;
+ if (!hContact)
+ return 0;
+
+ CMStringW wszAuthMessage;
+ if ( !mraGetStringW(NULL, "AuthMessage", wszAuthMessage))
+ wszAuthMessage = TranslateT(MRA_DEFAULT_AUTH_MESSAGE);
+
+ if ( !wszAuthMessage.IsEmpty()) {
+ CMStringA szEmail;
+ if ( mraGetStringA(hContact, "e-mail", szEmail)) {
+ BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND);
+ int iRet = MraMessage(bSlowSend, hContact, ACKTYPE_AUTHREQ, MESSAGE_FLAG_AUTHORIZE, szEmail, wszAuthMessage, NULL, 0);
+ if (bSlowSend == FALSE)
+ ProtoBroadcastAck(hContact, ACKTYPE_AUTHREQ, ACKRESULT_SUCCESS, (HANDLE)iRet, 0);
+
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+INT_PTR CMraProto::MraGrantAuthorization(WPARAM wParam, LPARAM lParam)
+{
+ if (!m_bLoggedIn || !wParam)
+ return 0;
+
+ // send without reason, do we need any ?
+ CMStringA szEmail;
+ if (mraGetStringA((HANDLE)wParam, "e-mail", szEmail))
+ MraAuthorize(szEmail);
+
+ return 0;
+}
+
+INT_PTR CMraProto::MraSendPostcard(WPARAM wParam, LPARAM lParam)
+{
+ if (!m_bLoggedIn)
+ return 0;
+
+ DWORD dwContactEMailCount = GetContactEMailCount((HANDLE)wParam, FALSE);
+ if (dwContactEMailCount) {
+ if (dwContactEMailCount == 1) {
+ CMStringA szUrl, szEmail;
+ if ( GetContactFirstEMail((HANDLE)wParam, FALSE, szEmail)) {
+ szEmail.MakeLower();
+ szUrl.Format("http://cards.mail.ru/event.html?rcptname=%s&rcptemail=%s", GetContactNameA((HANDLE)wParam), szEmail);
+ MraMPopSessionQueueAddUrl(hMPopSessionQueue, szUrl);
+ }
+ }
+ else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_SEND_POSTCARD);
+ }
+ return 0;
+}
+
+INT_PTR CMraProto::MraViewAlbum(WPARAM wParam, LPARAM lParam)
+{
+ if (!m_bLoggedIn)
+ return 0;
+
+ DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE);
+ if (dwContactEMailMRCount) {
+ if (dwContactEMailMRCount == 1) {
+ CMStringA szEmail;
+ if ( GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail))
+ MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_FOTO_URL, szEmail);
+ }
+ else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_VIEW_ALBUM);
+ }
+ return 0;
+}
+
+INT_PTR CMraProto::MraReadBlog(WPARAM wParam, LPARAM lParam)
+{
+ if (!m_bLoggedIn)
+ return 0;
+
+ DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE);
+ if (dwContactEMailMRCount)
+ if (dwContactEMailMRCount == 1) {
+ CMStringA szEmail;
+ if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail))
+ MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_BLOGS_URL, szEmail);
+ }
+ else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_READ_BLOG);
+
+ return 0;
+}
+
+INT_PTR CMraProto::MraReplyBlogStatus(WPARAM wParam, LPARAM lParam)
+{
+ if (!m_bLoggedIn)
+ return 0;
+
+ CMStringW blogStatusMsg;
+ mraGetStringW((HANDLE)wParam, DBSETTING_BLOGSTATUS, blogStatusMsg);
+ if (!blogStatusMsg.IsEmpty()|| wParam == 0)
+ MraSendReplyBlogStatus((HANDLE)wParam);
+
+ return 0;
+}
+
+INT_PTR CMraProto::MraViewVideo(WPARAM wParam, LPARAM lParam)
+{
+ if (!m_bLoggedIn)
+ return 0;
+
+ DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE);
+ if (dwContactEMailMRCount) {
+ if (dwContactEMailMRCount == 1) {
+ CMStringA szEmail;
+ if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail))
+ MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_VIDEO_URL, szEmail);
+ }
+ else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_VIEW_VIDEO);
+ }
+ return 0;
+}
+
+INT_PTR CMraProto::MraAnswers(WPARAM wParam, LPARAM lParam)
+{
+ if (!m_bLoggedIn)
+ return 0;
+
+ DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE);
+ if (dwContactEMailMRCount) {
+ if (dwContactEMailMRCount == 1) {
+ CMStringA szEmail;
+ if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail))
+ MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_ANSWERS_URL, szEmail);
+ }
+ else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_ANSWERS);
+ }
+ return 0;
+}
+
+INT_PTR CMraProto::MraWorld(WPARAM wParam, LPARAM lParam)
+{
+ if (!m_bLoggedIn)
+ return 0;
+
+ DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE);
+ if (dwContactEMailMRCount) {
+ if (dwContactEMailMRCount == 1) {
+ CMStringA szEmail;
+ if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail))
+ MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_WORLD_URL, szEmail);
+ }
+ else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_WORLD);
+ }
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int CMraProto::MraRebuildContactMenu(WPARAM wParam, LPARAM lParam)
+{
+ BOOL bIsContactMRA, bHasEMail, bHasEMailMR, bChatAgent;
+ DWORD dwContactSeverFlags = 0;
+ CMStringW blogStatusMsgSize;
+ HANDLE hContact = (HANDLE)wParam;
+
+ // proto own contact
+ bIsContactMRA = IsContactMra(hContact);
+ if (bIsContactMRA) {
+ bHasEMail = TRUE;
+ bHasEMailMR = TRUE;
+ bChatAgent = IsContactChatAgent(hContact);
+ GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL);
+ mraGetStringW(hContact, DBSETTING_BLOGSTATUS, blogStatusMsgSize);
+ }
+ // non proto contact
+ else bHasEMail = bHasEMailMR = bChatAgent = FALSE;
+
+ //"Request authorization"
+ Menu_ShowItem(hContactMenuItems[0], (m_bLoggedIn && bIsContactMRA));// && (dwContactSeverFlags&CONTACT_INTFLAG_NOT_AUTHORIZED)
+
+ //"Grant authorization"
+ Menu_ShowItem(hContactMenuItems[1], (m_bLoggedIn && bIsContactMRA && bChatAgent == FALSE));
+
+ //"&Send postcard"
+ Menu_ShowItem(hContactMenuItems[2], (m_bLoggedIn && bHasEMail && bChatAgent == FALSE));
+
+ //"&View Album"
+ Menu_ShowItem(hContactMenuItems[3], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+
+ //"&Read Blog"
+ Menu_ShowItem(hContactMenuItems[4], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+
+ //"Reply Blog Status"
+ Menu_ShowItem(hContactMenuItems[5], (m_bLoggedIn && blogStatusMsgSize.GetLength() && bChatAgent == FALSE));
+
+ //"View Video"
+ Menu_ShowItem(hContactMenuItems[6], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+
+ //"Answers"
+ Menu_ShowItem(hContactMenuItems[7], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+
+ //"World"
+ Menu_ShowItem(hContactMenuItems[8], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+
+ //"Send &Nudge"
+ Menu_ShowItem(hContactMenuItems[9], (!m_heNudgeReceived) ? (m_bLoggedIn && bIsContactMRA) : 0);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int CMraProto::MraRebuildStatusMenu(WPARAM wParam, LPARAM lParam)
+{
+ CHAR szServiceFunction[MAX_PATH*2], *pszServiceFunctionName, szValueName[MAX_PATH];
+ strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
+ pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName);
+
+ TCHAR szItem[MAX_PATH+64];
+ mir_sntprintf(szItem, SIZEOF(szItem), _T("%s Custom Status"), m_tszUserName);
+
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.position = 2000060000;
+ mi.popupPosition = 500085000;
+ mi.ptszPopupName = szItem;
+ mi.flags = CMIF_UNICODE;
+ mi.pszService = szServiceFunction;
+ mi.pszContactOwner = m_szModuleName;
+
+ CMStringW szStatusTitle;
+ for (size_t i = 0; i < MRA_XSTATUS_COUNT; i++) {
+ mir_snprintf(pszServiceFunctionName, 100, "/menuXStatus%ld", i);
+ mi.position++;
+ if (i) {
+ mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", i);
+ if ( mraGetStringW(NULL, szValueName, szStatusTitle))
+ mi.ptszName = (TCHAR*)szStatusTitle.c_str();
+ else
+ mi.ptszName = lpcszXStatusNameDef[i];
+
+ mi.icolibItem = hXStatusAdvancedStatusIcons[i];
+ }
+ else {
+ mi.ptszName = lpcszXStatusNameDef[i];
+ mi.hIcon = NULL;
+ }
+ hXStatusMenuItems[i] = Menu_AddStatusMenuItem(&mi);
+ }
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bIsMain, const IconItem *pgdiItems, size_t dwCount, HGENMENU *hResult)
+{
+ if (!pgdiItems || !dwCount || !hResult)
+ return;
+
+ char szServiceFunction[MAX_PATH];
+ strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
+ char *pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName);
+
+ CLISTMENUITEM mi = { sizeof(mi) };
+
+ HGENMENU hRootMenu, (*fnAddFunc)(CLISTMENUITEM*);
+ if (bIsMain) {
+ fnAddFunc = Menu_AddProtoMenuItem;
+
+ hRootMenu = MO_GetProtoRootMenu(m_szModuleName);
+ if (hRootMenu == NULL) {
+ mi.ptszName = m_tszUserName;
+ mi.hParentMenu = HGENMENU_ROOT;
+ mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
+ mi.hIcon = g_hMainIcon;
+ hRootMenu = Menu_AddProtoMenuItem(&mi);
+ }
+
+ mi.position = 20003;
+ mi.hParentMenu = hRootMenu;
+ mi.flags = CMIF_ROOTHANDLE;
+ }
+ else {
+ fnAddFunc = Menu_AddContactMenuItem;
+ mi.position = lPosition;
+ mi.flags = CMIF_ROOTPOPUP;
+ }
+
+ mi.pszName = LPGEN("Services...");
+ mi.hIcon = g_hMainIcon;
+ hRootMenu = fnAddFunc(&mi);
+
+ mi.flags = CMIF_CHILDPOPUP;
+ mi.hParentMenu = hRootMenu;
+ mi.popupPosition = lPopupPosition;
+ mi.pszService = szServiceFunction;
+
+ for (size_t i = 0; i < dwCount; i++) {
+ strcpy(pszServiceFunctionName, pgdiItems[i].szName);
+ mi.position = int(lPosition + i);
+ mi.icolibItem = pgdiItems[i].hIcolib;
+ mi.pszName = pgdiItems[i].szDescr;
+ hResult[i] = fnAddFunc(&mi);
+ }
+}
+
+void CMraProto::InitMenus()
+{
+ CreateProtoService(MRA_GOTO_INBOX, &CMraProto::MraGotoInbox);
+ CreateProtoService(MRA_SHOW_INBOX_STATUS, &CMraProto::MraShowInboxStatus);
+ CreateProtoService(MRA_EDIT_PROFILE, &CMraProto::MraEditProfile);
+ CreateProtoService(MRA_VIEW_ALBUM, &CMraProto::MraViewAlbum);
+ CreateProtoService(MRA_READ_BLOG, &CMraProto::MraReadBlog);
+ CreateProtoService(MRA_REPLY_BLOG_STATUS, &CMraProto::MraReplyBlogStatus);
+ CreateProtoService(MRA_VIEW_VIDEO, &CMraProto::MraViewVideo);
+ CreateProtoService(MRA_ANSWERS, &CMraProto::MraAnswers);
+ CreateProtoService(MRA_WORLD, &CMraProto::MraWorld);
+ CreateProtoService(MRA_ZHUKI, &CMraProto::MraZhuki);
+ CreateProtoService(MRA_WEB_SEARCH, &CMraProto::MraWebSearch);
+ CreateProtoService(MRA_UPD_ALL_USERS_INFO, &CMraProto::MraUpdateAllUsersInfo);
+ CreateProtoService(MRA_CHK_USERS_AVATARS, &CMraProto::MraCheckUpdatesUsersAvt);
+ CreateProtoService(MRA_REQ_AUTH_FOR_ALL, &CMraProto::MraRequestAuthForAll);
+
+ CListCreateMenu(-2000001001, -500050000, FALSE, gdiContactMenuItems, CONTACT_MENU_ITEMS_COUNT, hContactMenuItems);
+
+ // xstatus menu
+ for (int i = 0; i < MRA_XSTATUS_COUNT; i++) {
+ char szServiceName[100];
+ mir_snprintf(szServiceName, SIZEOF(szServiceName), "/menuXStatus%d", i);
+ CreateProtoServiceParam(szServiceName, &CMraProto::MraXStatusMenu, i);
+ }
+}
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index 2744a00c1b..cfd9cca5b9 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -218,7 +218,7 @@ int CMraProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) {
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.dwInitParam = (LPARAM)this;
- odp.hInstance = masMraSettings.hInstance;
+ odp.hInstance = g_hInstance;
odp.ptszTitle = m_tszUserName;
odp.ptszGroup = LPGENT("Network");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 5821b7d073..abbbf9b687 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -5,7 +5,7 @@ DWORD CMraProto::StartConnect()
{
- if (!masMraSettings.dwGlobalPluginRunning)
+ if (!g_dwGlobalPluginRunning)
return ERROR_OPERATION_ABORTED;
// поток ещё/уже не работал, поставили статус что работает и запускаем
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index fa41da557a..5fb31c662a 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -156,7 +156,7 @@ void CMraProto::SetExtraIcons(HANDLE hContact) ExtraIcon_SetIcon(hExtraXstatusIcon, hContact,
(IsXStatusValid(dwXStatus) || dwXStatus == MRA_MIR_XSTATUS_UNKNOWN) ? hXStatusAdvancedStatusIcons[dwXStatus] : NULL);
- ExtraIcon_SetIcon(hExtraInfo, hContact, (dwIconID != -1) ? gdiExtraStatusIconsItems[dwIconID].hIconHandle : NULL);
+ ExtraIcon_SetIcon(hExtraInfo, hContact, (dwIconID != -1) ? gdiExtraStatusIconsItems[dwIconID].hIcolib : NULL);
}
INT_PTR CMraProto::MraXStatusMenu(WPARAM wParam, LPARAM lParam, LPARAM param)
@@ -166,245 +166,6 @@ INT_PTR CMraProto::MraXStatusMenu(WPARAM wParam, LPARAM lParam, LPARAM param) return 0;
}
-INT_PTR CMraProto::MraGotoInbox(WPARAM wParam, LPARAM lParam)
-{
- MraMPopSessionQueueAddUrl(hMPopSessionQueue, MRA_WIN_INBOX_URL);
- return 0;
-}
-
-INT_PTR CMraProto::MraShowInboxStatus(WPARAM wParam, LPARAM lParam)
-{
- MraUpdateEmailStatus("", "", 0, 0);
- return 0;
-}
-
-INT_PTR CMraProto::MraSendSMS(WPARAM wParam, LPARAM lParam)
-{
- if (!m_bLoggedIn || !wParam || !lParam)
- return 0;
-
- ptrW lpwszMessageXMLEncoded( mir_utf8decodeW((LPSTR)lParam));
- if (lpwszMessageXMLEncoded) {
- CMStringW decoded = DecodeXML( CMStringW(lpwszMessageXMLEncoded));
- if (decoded.GetLength())
- MraSMSW(NULL, CMStringA((LPSTR)wParam), decoded);
- }
-
- return 0;
-}
-
-INT_PTR CMraProto::MraEditProfile(WPARAM wParam, LPARAM lParam)
-{
- MraMPopSessionQueueAddUrl(hMPopSessionQueue, MRA_EDIT_PROFILE_URL);
- return 0;
-}
-
-INT_PTR CMraProto::MraZhuki(WPARAM wParam, LPARAM lParam)
-{
- MraMPopSessionQueueAddUrl(hMPopSessionQueue, MRA_ZHUKI_URL);
- return 0;
-}
-
-INT_PTR CMraProto::MraWebSearch(WPARAM wParam, LPARAM lParam)
-{
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)MRA_SEARCH_URL);
- return 0;
-}
-
-INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM wParam, LPARAM lParam)
-{
- if ( MessageBox(NULL, TranslateT("Are you sure?"), TranslateTS(MRA_UPD_ALL_USERS_INFO_STR), MB_YESNO | MB_ICONQUESTION) == IDYES ) {
- for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- CMStringA szEmail;
- if ( mraGetStringA(hContact, "e-mail", szEmail))
- MraWPRequestByEMail(hContact, ACKTYPE_GETINFO, szEmail);
- }
- }
- return 0;
-}
-
-INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM wParam, LPARAM lParam)
-{
- if ( MessageBox(NULL, TranslateT("Are you sure?"), TranslateTS(MRA_CHK_USERS_AVATARS_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- CMStringA szEmail;
- if (mraGetStringA(hContact, "e-mail", szEmail))
- if ( !IsEMailChatAgent(szEmail))
- MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, 0, hContact, 0);
- }
- }
- return 0;
-}
-
-INT_PTR CMraProto::MraRequestAuthForAll(WPARAM wParam, LPARAM lParam)
-{
- if ( MessageBox(NULL, TranslateT("Are you sure?"), TranslateTS(MRA_REQ_AUTH_FOR_ALL_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- DWORD dwContactSeverFlags;
- if (GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL) == NO_ERROR)
- if (dwContactSeverFlags & CONTACT_INTFLAG_NOT_AUTHORIZED && dwContactSeverFlags != -1)
- MraRequestAuthorization((WPARAM)hContact, 0);
- }
- }
- return 0;
-}
-
-INT_PTR CMraProto::MraRequestAuthorization(WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact = (HANDLE)wParam;
- if (!hContact)
- return 0;
-
- CMStringW wszAuthMessage;
- if ( !mraGetStringW(NULL, "AuthMessage", wszAuthMessage))
- wszAuthMessage = TranslateT(MRA_DEFAULT_AUTH_MESSAGE);
-
- if ( !wszAuthMessage.IsEmpty()) {
- CMStringA szEmail;
- if ( mraGetStringA(hContact, "e-mail", szEmail)) {
- BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND);
- int iRet = MraMessage(bSlowSend, hContact, ACKTYPE_AUTHREQ, MESSAGE_FLAG_AUTHORIZE, szEmail, wszAuthMessage, NULL, 0);
- if (bSlowSend == FALSE)
- ProtoBroadcastAck(hContact, ACKTYPE_AUTHREQ, ACKRESULT_SUCCESS, (HANDLE)iRet, 0);
-
- return 0;
- }
- }
-
- return 1;
-}
-
-INT_PTR CMraProto::MraGrantAuthorization(WPARAM wParam, LPARAM lParam)
-{
- if (!m_bLoggedIn || !wParam)
- return 0;
-
- // send without reason, do we need any ?
- CMStringA szEmail;
- if (mraGetStringA((HANDLE)wParam, "e-mail", szEmail))
- MraAuthorize(szEmail);
-
- return 0;
-}
-
-INT_PTR CMraProto::MraSendPostcard(WPARAM wParam, LPARAM lParam)
-{
- if (!m_bLoggedIn)
- return 0;
-
- DWORD dwContactEMailCount = GetContactEMailCount((HANDLE)wParam, FALSE);
- if (dwContactEMailCount) {
- if (dwContactEMailCount == 1) {
- CMStringA szUrl, szEmail;
- if ( GetContactFirstEMail((HANDLE)wParam, FALSE, szEmail)) {
- szEmail.MakeLower();
- szUrl.Format("http://cards.mail.ru/event.html?rcptname=%s&rcptemail=%s", GetContactNameA((HANDLE)wParam), szEmail);
- MraMPopSessionQueueAddUrl(hMPopSessionQueue, szUrl);
- }
- }
- else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_SEND_POSTCARD);
- }
- return 0;
-}
-
-INT_PTR CMraProto::MraViewAlbum(WPARAM wParam, LPARAM lParam)
-{
- if (!m_bLoggedIn)
- return 0;
-
- DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE);
- if (dwContactEMailMRCount) {
- if (dwContactEMailMRCount == 1) {
- CMStringA szEmail;
- if ( GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail))
- MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_FOTO_URL, szEmail);
- }
- else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_VIEW_ALBUM);
- }
- return 0;
-}
-
-INT_PTR CMraProto::MraReadBlog(WPARAM wParam, LPARAM lParam)
-{
- if (!m_bLoggedIn)
- return 0;
-
- DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE);
- if (dwContactEMailMRCount)
- if (dwContactEMailMRCount == 1) {
- CMStringA szEmail;
- if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail))
- MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_BLOGS_URL, szEmail);
- }
- else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_READ_BLOG);
-
- return 0;
-}
-
-INT_PTR CMraProto::MraReplyBlogStatus(WPARAM wParam, LPARAM lParam)
-{
- if (!m_bLoggedIn)
- return 0;
-
- CMStringW blogStatusMsg;
- mraGetStringW((HANDLE)wParam, DBSETTING_BLOGSTATUS, blogStatusMsg);
- if (!blogStatusMsg.IsEmpty()|| wParam == 0)
- MraSendReplyBlogStatus((HANDLE)wParam);
-
- return 0;
-}
-
-INT_PTR CMraProto::MraViewVideo(WPARAM wParam, LPARAM lParam)
-{
- if (!m_bLoggedIn)
- return 0;
-
- DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE);
- if (dwContactEMailMRCount) {
- if (dwContactEMailMRCount == 1) {
- CMStringA szEmail;
- if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail))
- MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_VIDEO_URL, szEmail);
- }
- else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_VIEW_VIDEO);
- }
- return 0;
-}
-
-INT_PTR CMraProto::MraAnswers(WPARAM wParam, LPARAM lParam)
-{
- if (!m_bLoggedIn)
- return 0;
-
- DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE);
- if (dwContactEMailMRCount) {
- if (dwContactEMailMRCount == 1) {
- CMStringA szEmail;
- if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail))
- MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_ANSWERS_URL, szEmail);
- }
- else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_ANSWERS);
- }
- return 0;
-}
-
-INT_PTR CMraProto::MraWorld(WPARAM wParam, LPARAM lParam)
-{
- if (!m_bLoggedIn)
- return 0;
-
- DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE);
- if (dwContactEMailMRCount) {
- if (dwContactEMailMRCount == 1) {
- CMStringA szEmail;
- if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail))
- MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_WORLD_URL, szEmail);
- }
- else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_WORLD);
- }
- return 0;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
int CMraProto::MraContactDeleted(WPARAM wParam, LPARAM lParam)
@@ -534,57 +295,6 @@ int CMraProto::MraDbSettingChanged(WPARAM wParam, LPARAM lParam) return 0;
}
-int CMraProto::MraRebuildContactMenu(WPARAM wParam, LPARAM lParam)
-{
- BOOL bIsContactMRA, bHasEMail, bHasEMailMR, bChatAgent;
- DWORD dwContactSeverFlags = 0;
- CMStringW blogStatusMsgSize;
- HANDLE hContact = (HANDLE)wParam;
-
- // proto own contact
- bIsContactMRA = IsContactMra(hContact);
- if (bIsContactMRA) {
- bHasEMail = TRUE;
- bHasEMailMR = TRUE;
- bChatAgent = IsContactChatAgent(hContact);
- GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL);
- mraGetStringW(hContact, DBSETTING_BLOGSTATUS, blogStatusMsgSize);
- }
- // non proto contact
- else bHasEMail = bHasEMailMR = bChatAgent = FALSE;
-
- //"Request authorization"
- Menu_ShowItem(hContactMenuItems[0], (m_bLoggedIn && bIsContactMRA));// && (dwContactSeverFlags&CONTACT_INTFLAG_NOT_AUTHORIZED)
-
- //"Grant authorization"
- Menu_ShowItem(hContactMenuItems[1], (m_bLoggedIn && bIsContactMRA && bChatAgent == FALSE));
-
- //"&Send postcard"
- Menu_ShowItem(hContactMenuItems[2], (m_bLoggedIn && bHasEMail && bChatAgent == FALSE));
-
- //"&View Album"
- Menu_ShowItem(hContactMenuItems[3], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
-
- //"&Read Blog"
- Menu_ShowItem(hContactMenuItems[4], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
-
- //"Reply Blog Status"
- Menu_ShowItem(hContactMenuItems[5], (m_bLoggedIn && blogStatusMsgSize.GetLength() && bChatAgent == FALSE));
-
- //"View Video"
- Menu_ShowItem(hContactMenuItems[6], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
-
- //"Answers"
- Menu_ShowItem(hContactMenuItems[7], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
-
- //"World"
- Menu_ShowItem(hContactMenuItems[8], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
-
- //"Send &Nudge"
- Menu_ShowItem(hContactMenuItems[9], (!m_heNudgeReceived) ? (m_bLoggedIn && bIsContactMRA) : 0);
- return 0;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// Extra icons
@@ -594,47 +304,6 @@ int CMraProto::MraExtraIconsApply(WPARAM wParam, LPARAM lParam) return 0;
}
-/////////////////////////////////////////////////////////////////////////////////////////
-
-int CMraProto::MraRebuildStatusMenu(WPARAM wParam, LPARAM lParam)
-{
- CHAR szServiceFunction[MAX_PATH*2], *pszServiceFunctionName, szValueName[MAX_PATH];
- strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
- pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName);
-
- TCHAR szItem[MAX_PATH+64];
- mir_sntprintf(szItem, SIZEOF(szItem), _T("%s Custom Status"), m_tszUserName);
-
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.position = 2000060000;
- mi.popupPosition = 500085000;
- mi.ptszPopupName = szItem;
- mi.flags = CMIF_UNICODE;
- mi.pszService = szServiceFunction;
- mi.pszContactOwner = m_szModuleName;
-
- CMStringW szStatusTitle;
- for (size_t i = 0; i < MRA_XSTATUS_COUNT; i++) {
- mir_snprintf(pszServiceFunctionName, 100, "/menuXStatus%ld", i);
- mi.position++;
- if (i) {
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", i);
- if ( mraGetStringW(NULL, szValueName, szStatusTitle))
- mi.ptszName = (TCHAR*)szStatusTitle.c_str();
- else
- mi.ptszName = lpcszXStatusNameDef[i];
-
- mi.icolibItem = hXStatusAdvancedStatusIcons[i];
- }
- else {
- mi.ptszName = lpcszXStatusNameDef[i];
- mi.hIcon = NULL;
- }
- hXStatusMenuItems[i] = Menu_AddStatusMenuItem(&mi);
- }
- return 0;
-}
-
INT_PTR CMraProto::MraSetListeningTo(WPARAM wParam, LPARAM lParam)
{
LISTENINGTOINFO *pliInfo = (LISTENINGTOINFO*)lParam;
diff --git a/protocols/MRA/src/version.h b/protocols/MRA/src/version.h index 5553461ecd..5a6b04d9e4 100644 --- a/protocols/MRA/src/version.h +++ b/protocols/MRA/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 2
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 5
+#define __BUILD_NUM 6
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
|