diff options
-rw-r--r-- | include/delphi/m_message.inc | 14 | ||||
-rw-r--r-- | include/m_message.h | 6 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 25 | ||||
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 12 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 19 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 2 |
6 files changed, 52 insertions, 26 deletions
diff --git a/include/delphi/m_message.inc b/include/delphi/m_message.inc index 112e94ed01..ceac07dc85 100644 --- a/include/delphi/m_message.inc +++ b/include/delphi/m_message.inc @@ -120,6 +120,12 @@ const }
MS_MSG_GETWINDOWDATA:PAnsiChar = 'MessageAPI/GetWindowData';
+{ wparam=(THANDLE)hContact
+ lparam=(pWideChar)ptszMessageText
+ Sets a status line text for the appropriate contact
+}
+ MS_MSG_SETSTATUSTEXT:PAnsiChar = 'MessageAPI/SetStatusText';
+
{ wparam=0(unused)
lparam=(pMessageWindowEvent) event being written
fired before SRMM writes an entered message into the database
@@ -127,10 +133,10 @@ const ME_MSG_PRECREATEEVENT:PAnsiChar = 'MessageAPI/PreCreateEvent';
{ wParam = 0
- lParam = (MessageWindowPopupData *)&MessageWindowPopupData;
- Fired to allow plugins to add itens to the msg window popup menu
- Always fired twice: once with MSG_WINDOWPOPUP_SHOWING and once with MSG_WINDOWPOPUP_SELECTED.
- This is done to allow cleaning of resources.
+ lParam = (MessageWindowPopupData *)&MessageWindowPopupData;
+ Fired to allow plugins to add itens to the msg window popup menu
+ Always fired twice: once with MSG_WINDOWPOPUP_SHOWING and once with MSG_WINDOWPOPUP_SELECTED.
+ This is done to allow cleaning of resources.
}
ME_MSG_WINDOWPOPUP:PAnsiChar = 'MessageAPI/WindowPopupRequested';
diff --git a/include/m_message.h b/include/m_message.h index a8258aadfe..897f4a5475 100644 --- a/include/m_message.h +++ b/include/m_message.h @@ -71,6 +71,11 @@ typedef struct { HWND hwndLog; // log area window for the contact (or NULL if there is none)
} MessageWindowEventData;
+//wparam = (HANDLE)hContact
+//lparam = (TCHAR*)ptszMessageText
+//Sets a status line text for the appropriate contact
+#define MS_MSG_SETSTATUSTEXT "MessageAPI/SetStatusText"
+
//wparam = 0
//lparam = 0
//Returns a dword with the current message api version
@@ -127,6 +132,7 @@ typedef struct { // Fired to allow plugins to add items to the msg window popup menu
// Always fired twice: once with MSG_WINDOWPOPUP_SHOWING and once with MSG_WINDOWPOPUP_SELECTED.
// This is done to allow cleaning of resources.
+
#define ME_MSG_WINDOWPOPUP "MessageAPI/WindowPopupRequested"
#define MSG_WINDOWPOPUP_SHOWING 1
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index c98b11ab15..59d4eb7eae 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -176,7 +176,7 @@ static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus) }
}
-static void ShowTime(struct SrmmWindowData *dat)
+static void ShowTime(SrmmWindowData *dat)
{
if (dat->hwndStatus && dat->hTimeZone) {
SYSTEMTIME st;
@@ -192,7 +192,7 @@ static void ShowTime(struct SrmmWindowData *dat) }
}
-static void SetupStatusBar(HWND hwndDlg, struct SrmmWindowData *dat)
+static void SetupStatusBar(HWND hwndDlg, SrmmWindowData *dat)
{
int icons_width, cx, i = 0, statwidths[4];
RECT rc;
@@ -220,9 +220,9 @@ static void SetupStatusBar(HWND hwndDlg, struct SrmmWindowData *dat) static void SetDialogToType(HWND hwndDlg)
{
- struct SrmmWindowData *dat;
+ SrmmWindowData *dat;
- dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ dat = (SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (dat->hContact)
ShowMultipleControls(hwndDlg, infoLineControls, SIZEOF(infoLineControls), (g_dat.flags&SMF_SHOWINFO) ? SW_SHOW : SW_HIDE);
else
@@ -269,7 +269,7 @@ static void SetEditorText(HWND hwnd, const TCHAR* txt) static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct SrmmWindowData *pdat = (struct SrmmWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
+ SrmmWindowData *pdat = (SrmmWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
struct MsgEditSubclassData *dat = (struct MsgEditSubclassData *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch (msg) {
@@ -494,7 +494,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct SrmmWindowData *pdat = (struct SrmmWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
+ SrmmWindowData *pdat = (SrmmWindowData *)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
switch (msg) {
case WM_NCHITTEST:
@@ -529,7 +529,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc)
{
- struct SrmmWindowData *dat = (struct SrmmWindowData *) lParam;
+ SrmmWindowData *dat = (SrmmWindowData *) lParam;
if ( !(g_dat.flags & SMF_SHOWINFO) && !(g_dat.flags & SMF_SHOWBTNS)) {
for (int i = 0; i < SIZEOF(buttonLineControls); i++)
@@ -602,7 +602,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
-void ShowAvatar(HWND hwndDlg, struct SrmmWindowData *dat)
+void ShowAvatar(HWND hwndDlg, SrmmWindowData *dat)
{
if (g_dat.flags & SMF_AVATAR) {
AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)dat->hContact, 0);
@@ -617,7 +617,7 @@ void ShowAvatar(HWND hwndDlg, struct SrmmWindowData *dat) SendMessage(hwndDlg, DM_AVATARSIZECHANGE, 0, 0);
}
-static void NotifyTyping(struct SrmmWindowData *dat, int mode)
+static void NotifyTyping(SrmmWindowData *dat, int mode)
{
if ( !dat->hContact)
return;
@@ -678,15 +678,14 @@ void Window_FreeIcon_IcoLib(HWND hwndDlg) INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct SrmmWindowData *dat;
+ SrmmWindowData *dat = (SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
{
- struct NewMessageWindowLParam *newData = (struct NewMessageWindowLParam *) lParam;
+ NewMessageWindowLParam *newData = (NewMessageWindowLParam *) lParam;
TranslateDialogDefault(hwndDlg);
- dat = (struct SrmmWindowData *) mir_calloc(sizeof(struct SrmmWindowData));
+ dat = (SrmmWindowData *) mir_calloc(sizeof(SrmmWindowData));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat);
dat->hContact = newData->hContact;
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index fec3d93737..51a7baad09 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -43,7 +43,7 @@ struct LogStreamData int bufferOffset, bufferLen;
int eventsToInsert;
int isEmpty;
- struct SrmmWindowData *dlgDat;
+ SrmmWindowData *dlgDat;
};
static char szSep2[40], szSep2_RTL[50];
@@ -183,7 +183,7 @@ static int AppendToBufferWithRTF(char **buffer, int *cbBufferEnd, int *cbBufferA #define FONT_FORMAT "{\\f%u\\fnil\\fcharset%u %S;}"
-static char *CreateRTFHeader(struct SrmmWindowData *dat)
+static char *CreateRTFHeader(SrmmWindowData *dat)
{
char *buffer;
int bufferAlloced, bufferEnd;
@@ -219,7 +219,7 @@ static char *CreateRTFHeader(struct SrmmWindowData *dat) }
//mir_free() the return value
-static char *CreateRTFTail(struct SrmmWindowData *dat)
+static char *CreateRTFTail(SrmmWindowData *dat)
{
char *buffer;
int bufferAlloced, bufferEnd;
@@ -249,7 +249,7 @@ int DbEventIsForMsgWindow(DBEVENTINFO *dbei) return et && ( et->flags & DETF_MSGWINDOW );
}
-int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat)
+int DbEventIsShown(DBEVENTINFO * dbei, SrmmWindowData *dat)
{
switch (dbei->eventType) {
case EVENTTYPE_MESSAGE:
@@ -264,7 +264,7 @@ int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat) }
//mir_free() the return value
-static char *CreateRTFFromDbEvent(struct SrmmWindowData *dat, HANDLE hContact, HANDLE hDbEvent, struct LogStreamData *streamData)
+static char *CreateRTFFromDbEvent(SrmmWindowData *dat, HANDLE hContact, HANDLE hDbEvent, struct LogStreamData *streamData)
{
char *buffer;
int bufferAlloced, bufferEnd;
@@ -511,7 +511,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) {
EDITSTREAM stream = {0};
struct LogStreamData streamData = {0};
- struct SrmmWindowData *dat = (struct SrmmWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ SrmmWindowData *dat = (SrmmWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
CHARRANGE oldSel, sel;
POINT scrollPos;
BOOL bottomScroll = TRUE;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 97de54f461..abf9b88cf9 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -81,7 +81,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) char *szProto = GetContactProto((HANDLE)wParam);
if (szProto && (g_dat.openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0))))
{
- struct NewMessageWindowLParam newData = { 0 };
+ NewMessageWindowLParam newData = { 0 };
newData.hContact = (HANDLE) wParam;
newData.noActivate = db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS);
CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), NULL, DlgProcMessage, (LPARAM) & newData);
@@ -133,7 +133,7 @@ INT_PTR SendMessageCmd(HANDLE hContact, char* msg, int isWchar) }
else
{
- struct NewMessageWindowLParam newData = { 0 };
+ NewMessageWindowLParam newData = { 0 };
newData.hContact = hContact;
newData.szInitialText = msg;
newData.isWchar = isWchar;
@@ -355,6 +355,20 @@ static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam) return 0;
}
+static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam)
+{
+ HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam);
+ if (hwnd == NULL)
+ return 1;
+
+ SrmmWindowData *dat = (SrmmWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (dat == NULL)
+ return 1;
+
+ SendMessage(dat->hwndStatus, SB_SETTEXT, 0, lParam);
+ return 0;
+}
+
static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
{
MessageWindowInputData *mwid = (MessageWindowInputData*)wParam;
@@ -405,6 +419,7 @@ int LoadSendRecvMessageModule(void) CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI);
CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass);
CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData);
+ CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText);
CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
hHookWinEvt = CreateHookableEvent(ME_MSG_WINDOWEVENT);
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 1c472835a8..d459efa56f 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -116,7 +116,7 @@ struct CREOleCallback : public IRichEditOleCallback INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int DbEventIsForMsgWindow(DBEVENTINFO *dbei);
-int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat);
+int DbEventIsShown(DBEVENTINFO * dbei, SrmmWindowData *dat);
void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend);
HANDLE SendMessageDirect(const TCHAR *szMsg, HANDLE hContact, char *szProto);
|