summaryrefslogtreecommitdiff
path: root/src/core/stdemail/email.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/stdemail/email.cpp')
-rw-r--r--src/core/stdemail/email.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/core/stdemail/email.cpp b/src/core/stdemail/email.cpp
index d744e71f51..95f772884b 100644
--- a/src/core/stdemail/email.cpp
+++ b/src/core/stdemail/email.cpp
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "commonheaders.h"
-static HANDLE hEMailMenuItem;
+static HGENMENU hEMailMenuItem;
void SendEmailThread(void *szUrl)
{
@@ -35,8 +35,8 @@ static INT_PTR SendEMailCommand(WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv;
char *szProto = GetContactProto((HANDLE)wParam);
- if (szProto == NULL || DBGetContactSettingString((HANDLE)wParam, szProto, "e-mail", &dbv)) {
- if (DBGetContactSettingString((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv)) {
+ if (szProto == NULL || db_get_s((HANDLE)wParam, szProto, "e-mail", &dbv)) {
+ if (db_get_s((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv)) {
MessageBox((HWND)lParam, TranslateT("User has not registered an e-mail address"), TranslateT("Send e-mail"), MB_OK);
return 1;
}
@@ -51,17 +51,15 @@ static INT_PTR SendEMailCommand(WPARAM wParam, LPARAM lParam)
static int EMailPreBuildMenu(WPARAM wParam, LPARAM)
{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
-
+ bool bEnabled = true;
DBVARIANT dbv = { 0 };
char *szProto = GetContactProto((HANDLE)wParam);
- if (szProto == NULL || DBGetContactSettingString((HANDLE)wParam, szProto, "e-mail", & dbv))
- if (DBGetContactSettingString((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv))
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
+ if (szProto == NULL || db_get_s((HANDLE)wParam, szProto, "e-mail", & dbv))
+ if (db_get_s((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv))
+ bEnabled = false;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hEMailMenuItem, (LPARAM)&mi);
- if (dbv.pszVal) DBFreeVariant(&dbv);
+ Menu_ShowItem(hEMailMenuItem, bEnabled);
+ if (dbv.pszVal) db_free(&dbv);
return 0;
}