summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_popup.h14
-rw-r--r--plugins/Popup/src/font.cpp48
-rw-r--r--plugins/Popup/src/font.h16
-rw-r--r--plugins/Popup/src/main.cpp1
-rw-r--r--plugins/Popup/src/services.cpp55
-rw-r--r--plugins/YAPP/src/services.cpp6
-rw-r--r--plugins/YAPP/src/yapp_history.cpp6
-rw-r--r--protocols/FacebookRM/src/events.cpp3
-rw-r--r--protocols/FacebookRM/src/proto.cpp3
9 files changed, 63 insertions, 89 deletions
diff --git a/include/m_popup.h b/include/m_popup.h
index 3b4cfc6240..e53b720302 100644
--- a/include/m_popup.h
+++ b/include/m_popup.h
@@ -157,19 +157,6 @@ static void __inline * PUGetPluginData(HWND hPopupWindow) {
return (void*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hPopupWindow, (LPARAM)uselessPointer);
}
-/* Popup/IsSecondLineShown
-Checks if second line is enable
-
-wParam = 0
-lParam = 0
-
-Returns: 0 if the user has chosen not to have the second line, 1 if he choose to have the second line.
-*/
-#define MS_POPUP_ISSECONDLINESHOWN "Popup/IsSecondLineShown"
-static BOOL __inline PUIsSecondLineShown() {
- return (BOOL)CallService(MS_POPUP_ISSECONDLINESHOWN, 0, 0);
-}
-
/* Popup/Query
Requests an action or an answer from Popup module.
@@ -332,6 +319,7 @@ typedef struct {
WNDPROC PluginWindowProc;
int iSeconds;
+ LPARAM lParam; //APF_RETURN_HWND, APF_CUSTOM_POPUP ... as above
} POPUPCLASS;
#define PCF_UNICODE 0x0001
diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp
index fca4c1cf12..df6e1640ca 100644
--- a/plugins/Popup/src/font.cpp
+++ b/plugins/Popup/src/font.cpp
@@ -34,35 +34,35 @@ void InitFonts() {
fid.flags = FIDF_DEFAULTVALID;
fid.deffontsettings.charset = DEFAULT_CHARSET;
fid.deffontsettings.size = -11;
- lstrcpy(fid.backgroundGroup,_T(PU_FNT_AND_COLOR));
- lstrcpy(fid.backgroundName,_T(PU_COL_BACK_NAME));
- lstrcpy(fid.deffontsettings.szFace, _T("Tahoma"));
+ lstrcpyn(fid.backgroundGroup,_T(PU_FNT_AND_COLOR), SIZEOF(fid.backgroundGroup));
+ lstrcpyn(fid.backgroundName,PU_COL_BACK_NAME, SIZEOF(fid.backgroundName));
+ lstrcpyn(fid.deffontsettings.szFace, _T("Tahoma"), SIZEOF(fid.deffontsettings.szFace));
- lstrcpy(fid.name, _T(PU_FNT_NAME_TITLE));
+ lstrcpyn(fid.name, PU_FNT_NAME_TITLE, SIZEOF(fid.name));
mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TITLE);
fid.deffontsettings.style = DBFONTF_BOLD;
fid.deffontsettings.colour = RGB(0,0,0);
FontRegisterT(&fid);
- lstrcpy(fid.name, _T(PU_FNT_NAME_CLOCK));
+ lstrcpyn(fid.name, PU_FNT_NAME_CLOCK, SIZEOF(fid.name));
mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_CLOCK);
//fid.deffontsettings.style = DBFONTF_BOLD;
//fid.deffontsettings.colour = RGB(0,0,0);
FontRegisterT(&fid);
- lstrcpy(fid.name, _T(PU_FNT_NAME_TEXT));
+ lstrcpyn(fid.name, PU_FNT_NAME_TEXT, SIZEOF(fid.name));
mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TEXT);
fid.deffontsettings.style = 0;
//fid.deffontsettings.colour = RGB(0,0,0);
FontRegisterT(&fid);
- lstrcpy(fid.name, _T("Action"));
+ lstrcpyn(fid.name, _T("Action"), SIZEOF(fid.name));
mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, "Action");
//fid.deffontsettings.style = 0;
fid.deffontsettings.colour = RGB(0,0,255);
FontRegisterT(&fid);
- lstrcpy(fid.name, LPGENT("Hovered Action"));
+ lstrcpyn(fid.name, LPGENT("Hovered Action"), SIZEOF(fid.name));
mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, "Hovered Action");
fid.deffontsettings.style = DBFONTF_UNDERLINE;
//fid.deffontsettings.colour = RGB(0,0,255);
@@ -70,16 +70,16 @@ void InitFonts() {
ColourIDT cid = {0};
cid.cbSize = sizeof(ColourIDT);
- lstrcpy(cid.group, _T(PU_FNT_AND_COLOR));
- strcpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB);
+ lstrcpyn(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group));
+ strncpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(cid.dbSettingsGroup));
- lstrcpy(cid.name, _T(PU_COL_BACK_NAME));
- strcpy(cid.setting, PU_COL_BACK_SETTING);
+ lstrcpyn(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name));
+ strncpy(cid.setting, PU_COL_BACK_SETTING, SIZEOF(cid.setting));
cid.defcolour = SETTING_BACKCOLOUR_DEFAULT;
ColourRegisterT(&cid);
- lstrcpy(cid.name, _T(PU_COL_AVAT_NAME));
- strcpy(cid.setting, PU_COL_AVAT_SETTING);
+ lstrcpyn(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name));
+ strncpy(cid.setting, PU_COL_AVAT_SETTING, SIZEOF(cid.setting));
cid.defcolour = SETTING_TEXTCOLOUR_DEFAULT;
ColourRegisterT(&cid);
@@ -98,36 +98,36 @@ void ReloadFonts()
LOGFONT lf = {0};
FontIDT fid = {0};
fid.cbSize = sizeof(FontIDT);
- lstrcpy(fid.group, _T(PU_FNT_AND_COLOR));
+ lstrcpyn(fid.group, _T(PU_FNT_AND_COLOR),SIZEOF(fid.name));
- lstrcpy(fid.name, _T(PU_FNT_NAME_TITLE));
+ lstrcpyn(fid.name, PU_FNT_NAME_TITLE,SIZEOF(fid.name));
fonts.clTitle = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.title = CreateFontIndirect(&lf);
- lstrcpy(fid.name, LPGENT("Clock"));
+ lstrcpyn(fid.name, LPGENT("Clock"),SIZEOF(fid.name));
fonts.clClock = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.clock = CreateFontIndirect(&lf);
- lstrcpy(fid.name, _T(PU_FNT_NAME_TEXT));
+ lstrcpyn(fid.name, PU_FNT_NAME_TEXT,SIZEOF(fid.name));
fonts.clText = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.text = CreateFontIndirect(&lf);
- lstrcpy(fid.name, _T("Action"));
+ lstrcpyn(fid.name, LPGENT("Action"),SIZEOF(fid.name));
fonts.clAction = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.action = CreateFontIndirect(&lf);
- lstrcpy(fid.name, LPGENT("Hovered Action"));
+ lstrcpyn(fid.name, LPGENT("Hovered Action"),SIZEOF(fid.name));
fonts.clActionHover = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.actionHover = CreateFontIndirect(&lf);
ColourIDT cid = {0};
cid.cbSize = sizeof(ColourIDT);
- lstrcpy(cid.group, _T(PU_FNT_AND_COLOR));
- lstrcpy(cid.name, _T(PU_COL_BACK_NAME));
+ lstrcpyn(cid.group, _T(PU_FNT_AND_COLOR),SIZEOF(cid.group));
+ lstrcpyn(cid.name, PU_COL_BACK_NAME,SIZEOF(cid.name));
fonts.clBack = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf);
- lstrcpy(cid.group, _T(PU_FNT_AND_COLOR));
- lstrcpy(cid.name, _T(PU_COL_AVAT_NAME));
+ lstrcpyn(cid.group, _T(PU_FNT_AND_COLOR),SIZEOF(cid.group));
+ lstrcpyn(cid.name, PU_COL_AVAT_NAME,SIZEOF(cid.name));
fonts.clAvatarBorder = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf);
//update class popupps(only temp at this point, must rework)
diff --git a/plugins/Popup/src/font.h b/plugins/Popup/src/font.h
index 13674ddd2b..c22a08811f 100644
--- a/plugins/Popup/src/font.h
+++ b/plugins/Popup/src/font.h
@@ -29,19 +29,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PU_FNT_AND_COLOR_DB MODULNAME //use eg strcpy(fid.dbSettingsGroup, PU_FNT_GROUP_DB);
#define PU_FNT_PREFIX "fnt%s" //use eg mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_....);
-#define PU_FNT_NAME_TITLE "Title" //use eg lstrcpy(fid.name, _T(FNT_NAME_....)) for FontIDT
-#define PU_FNT_NAME_CLOCK "Clock"
-#define PU_FNT_NAME_TEXT "Text"
+#define PU_FNT_NAME_TITLE LPGENT("Title") //use eg lstrcpy(fid.name, _T(FNT_NAME_....)) for FontIDT
+#define PU_FNT_NAME_CLOCK LPGENT("Clock")
+#define PU_FNT_NAME_TEXT LPGENT("Text")
-#define PU_COL_BACK_NAME "Background"
+#define PU_COL_BACK_NAME LPGENT("Background")
#define PU_COL_BACK_SETTING "ColourBg"
-#define PU_COL_BORD_NAME "Border"
+#define PU_COL_BORD_NAME LPGENT("Border")
#define PU_COL_BORD_SETTING "ColourBorder"
-#define PU_COL_SIDE_NAME "Sidebar"
+#define PU_COL_SIDE_NAME LPGENT("Sidebar")
#define PU_COL_SIDE_SETTING "ColourSidebar"
-#define PU_COL_LINE_NAME "Title underline"
+#define PU_COL_LINE_NAME LPGENT("Title underline")
#define PU_COL_LINE_SETTING "ColourUnderline"
-#define PU_COL_AVAT_NAME "Avatar Border"
+#define PU_COL_AVAT_NAME LPGENT("Avatar Border")
#define PU_COL_AVAT_SETTING "ColourAvatarBorder"
struct PopupFonts
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index 752ac6765b..eba19300b5 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -387,7 +387,6 @@ MIRAPI int Load(void)
CreateServiceFunction(MS_POPUP_GETCONTACT, Popup_GetContact);
CreateServiceFunction(MS_POPUP_GETPLUGINDATA, Popup_GetPluginData);
- CreateServiceFunction(MS_POPUP_ISSECONDLINESHOWN, Popup_IsSecondLineShown);
CreateServiceFunction(MS_POPUP_SHOWMESSAGE, Popup_ShowMessage);
CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, Popup_ShowMessageW);
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index e5e6f51687..f9d69ab9a8 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -187,12 +187,6 @@ INT_PTR Popup_GetPluginData(WPARAM wParam, LPARAM lParam)
return (INT_PTR)(-1);
}
-//===== Popup/IsSecondLineShown
-INT_PTR Popup_IsSecondLineShown(WPARAM wParam, LPARAM lParam)
-{
- return 1;
-}
-
//===== Popup/ChangeTextW
INT_PTR Popup_ChangeTextW(WPARAM wParam, LPARAM lParam)
{
@@ -307,7 +301,7 @@ INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam) {
}
//===== Popup/Query
-INT_PTR Popup_Query(WPARAM wParam, LPARAM lParam)
+INT_PTR Popup_Query(WPARAM wParam, LPARAM)
{
if (!gbPopupLoaded) return -1;
@@ -348,7 +342,7 @@ INT_PTR Popup_RegisterActions(WPARAM wParam, LPARAM lParam)
}
-INT_PTR Popup_RegisterNotification(WPARAM wParam, LPARAM lParam)
+INT_PTR Popup_RegisterNotification(WPARAM wParam, LPARAM)
{
return (INT_PTR)RegisterNotification((LPPOPUPNOTIFICATION)wParam);
}
@@ -386,7 +380,7 @@ INT_PTR Popup_RegisterVfx(WPARAM wParam, LPARAM lParam)
}
//===== Popup/RegisterClass (for core class api support)
-INT_PTR Popup_RegisterPopupClass(WPARAM wParam, LPARAM lParam)
+INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
{
char setting[256];
POPUPCLASS *pc = (POPUPCLASS *)lParam;
@@ -410,39 +404,39 @@ INT_PTR Popup_RegisterPopupClass(WPARAM wParam, LPARAM lParam)
//we ignore pc->colorText and use fonts.text as default (if no setting found in DB)
mir_snprintf(setting, 256, "%s/TextCol", ptd->pupClass.pszName);
ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/);
- FontID fid = {0};
- fid.cbSize = sizeof(FontID);
- mir_snprintf(fid.group, sizeof(fid.group), "%s/%s", PU_FNT_AND_COLOR, ptd->pupClass.pszName);
+ FontIDT fid = {0};
+ fid.cbSize = sizeof(FontIDT);
+ mir_sntprintf(fid.group, SIZEOF(fid.group), _T("%s/%S"), PU_FNT_AND_COLOR, ptd->pupClass.pszName);
strcpy(fid.dbSettingsGroup, PU_MODULCLASS);
fid.flags = FIDF_DEFAULTVALID;
fid.deffontsettings.charset = DEFAULT_CHARSET;
fid.deffontsettings.size = -11;
- strcpy(fid.deffontsettings.szFace, "Verdana");
- strcpy(fid.name, PU_FNT_NAME_TEXT);
- strcpy(fid.prefix, setting);
+ _tcsncpy(fid.deffontsettings.szFace, _T("Verdana"), SIZEOF(fid.deffontsettings.szFace));
+ _tcsncpy(fid.name, PU_FNT_NAME_TEXT, SIZEOF(fid.name));
+ strncpy(fid.prefix, setting, SIZEOF(fid.prefix));
mir_snprintf(fid.prefix, sizeof(fid.prefix), "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol"
fid.deffontsettings.style = 0;
fid.deffontsettings.colour = fonts.clText;
- FontRegister(&fid);
+ FontRegisterT(&fid);
//we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB)
mir_snprintf(setting, 256, "%s/BgCol", ptd->pupClass.pszName);
- ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
- ColourID cid = {0};
- cid.cbSize = sizeof(ColourID);
- mir_snprintf(cid.group, sizeof(cid.group), "%s/%s", PU_FNT_AND_COLOR, ptd->pupClass.pszName);
+ ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
+ ColourIDT cid = {0};
+ cid.cbSize = sizeof(ColourIDT);
+ mir_sntprintf(cid.group, SIZEOF(cid.group), _T("%s/%S"), PU_FNT_AND_COLOR, ptd->pupClass.pszName);
strcpy(cid.dbSettingsGroup, PU_MODULCLASS);
- strcpy(cid.name, PU_COL_BACK_NAME);
+ _tcsncpy(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name));
mir_snprintf(cid.setting, sizeof(cid.setting), "%s/BgCol", ptd->pupClass.pszName);
cid.defcolour = fonts.clBack;
- ColourRegister(&cid);
+ ColourRegisterT(&cid);
gTreeData.insert(ptd);
num_classes++;
return (INT_PTR)ptd;
}
-INT_PTR Popup_UnregisterPopupClass(WPARAM wParam, LPARAM lParam)
+INT_PTR Popup_UnregisterPopupClass(WPARAM, LPARAM lParam)
{
POPUPTREEDATA *ptd = (POPUPTREEDATA*)lParam;
if (ptd == NULL)
@@ -460,18 +454,19 @@ INT_PTR Popup_UnregisterPopupClass(WPARAM wParam, LPARAM lParam)
//===== Popup/AddPopupClass (for core class api support)
INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) {
- int ret = 1;
+ INT_PTR ret = 1;
POPUPDATACLASS *pdc = (POPUPDATACLASS *)lParam;
if (pdc->cbSize != sizeof(POPUPDATACLASS)) return ret;
- POPUPCLASS *pc = NULL;
- POPUPTREEDATA *ptd = NULL;
+ POPUPCLASS *pc = NULL;
- if (wParam) pc = (POPUPCLASS*)wParam;
+ if (wParam)
+ pc = (POPUPCLASS*)wParam;
else {
LPTSTR group = mir_a2t(pdc->pszClassName);
- ptd = (POPUPTREEDATA *)FindTreeData(group, NULL, 2);
- if (ptd) pc = &ptd->pupClass;
+ POPUPTREEDATA *ptd = (POPUPTREEDATA *)FindTreeData(group, NULL, 2);
+ if (ptd)
+ pc = &ptd->pupClass;
}
if (pc) {
POPUPDATA2 ppd2 = { sizeof(ppd2) };
@@ -493,7 +488,7 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) {
ppd2.lchContact = pdc->hContact;
ppd2.PluginData = pdc->PluginData;
- ret = Popup_AddPopup2((WPARAM)&ppd2, 0);
+ return Popup_AddPopup2((WPARAM)&ppd2, pc->lParam);
}
return ret!=0 ? 1 : 0;
}
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp
index d612714f10..b193a3d952 100644
--- a/plugins/YAPP/src/services.cpp
+++ b/plugins/YAPP/src/services.cpp
@@ -191,11 +191,6 @@ static INT_PTR GetOpaque(WPARAM wParam, LPARAM lParam)
return (INT_PTR)data;
}
-static INT_PTR IsSecondLineShown(WPARAM wParam, LPARAM lParam)
-{
- return TRUE;
-}
-
void UpdateMenu()
{
bool isEnabled = db_get_b(0, MODULE, "Enabled", 1) == 1;
@@ -432,7 +427,6 @@ void InitServices()
CreateServiceFunction(MS_POPUP_CHANGEW, PopupChangeW);
CreateServiceFunction(MS_POPUP_GETCONTACT, GetContact);
CreateServiceFunction(MS_POPUP_GETPLUGINDATA, GetOpaque);
- CreateServiceFunction(MS_POPUP_ISSECONDLINESHOWN, IsSecondLineShown);
CreateServiceFunction(MS_POPUP_QUERY, PopupQuery);
CreateServiceFunction(MS_POPUP_SHOWMESSAGE, ShowMessage);
diff --git a/plugins/YAPP/src/yapp_history.cpp b/plugins/YAPP/src/yapp_history.cpp
index a7cfd70fc6..0b1d534cb0 100644
--- a/plugins/YAPP/src/yapp_history.cpp
+++ b/plugins/YAPP/src/yapp_history.cpp
@@ -16,8 +16,7 @@ PopupHistoryList::~PopupHistoryList()
void PopupHistoryList::Clear()
{
- int i;
- for (i = 0; i < count; i++)
+ for (int i = 0; i < count; i++)
{
DeleteData(i);
}
@@ -26,9 +25,8 @@ void PopupHistoryList::Clear()
void PopupHistoryList::RemoveItem(int index)
{
- int i;
DeleteData(index); //free the mem for that particular item
- for (i = index + 1; i < count; i++)
+ for (int i = index + 1; i < count; i++)
{
historyData[i - 1] = historyData[i]; //shift all items to the left
}
diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp
index e1e3ac560f..8604d58492 100644
--- a/protocols/FacebookRM/src/events.cpp
+++ b/protocols/FacebookRM/src/events.cpp
@@ -86,8 +86,7 @@ HWND FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWO
pd.PluginData = data;
}
- if (CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&pd) == 0)
- return NULL; // TODO: return popup window handle (to allow closing them)
+ return (HWND) CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&pd);
}
} else {
if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY))
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 7ceab6fc52..abd24e7d7d 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -811,7 +811,8 @@ void FacebookProto::InitPopups()
{
POPUPCLASS ppc = { sizeof(ppc) };
ppc.flags = PCF_TCHAR;
- ppc.PluginWindowProc = (WNDPROC)PopupDlgProc;
+ ppc.PluginWindowProc = PopupDlgProc;
+ ppc.lParam = APF_RETURN_HWND;
TCHAR desc[256];
char name[256];