diff options
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/eventpopups.cpp | 78 | ||||
-rw-r--r-- | plugins/TabSRMM/src/functions.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/mim.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 9 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msglog.cpp | 18 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 11 | ||||
-rw-r--r-- | plugins/TabSRMM/src/translator.cpp | 16 |
9 files changed, 77 insertions, 68 deletions
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 68e8f0b421..8e81baebc5 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -510,35 +510,39 @@ static BOOL CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM * @return
*/
-static TCHAR *GetPreviewT(WORD eventType, DBEVENTINFO* dbe)
+static TCHAR *ShortenPreview(DBEVENTINFO* dbe)
{
- char *pBlob = (char *)dbe->pBlob;
bool fAddEllipsis = false;
-
int iPreviewLimit = nen_options.iLimitPreview;
if (iPreviewLimit > 500 || iPreviewLimit == 0)
iPreviewLimit = 500;
+ TCHAR* buf = DbGetEventTextT(dbe, CP_ACP);
+ if (lstrlen(buf) > iPreviewLimit) {
+ fAddEllipsis = true;
+ int iIndex = iPreviewLimit;
+ int iWordThreshold = 20;
+ while(iIndex && buf[iIndex] != ' ' && iWordThreshold--)
+ buf[iIndex--] = 0;
+
+ buf[iIndex] = 0;
+ }
+ if (fAddEllipsis) {
+ buf = (TCHAR *)mir_realloc(buf, (lstrlen(buf) + 5) * sizeof(TCHAR));
+ _tcscat(buf, _T("..."));
+ }
+ return buf;
+}
+
+static TCHAR *GetPreviewT(WORD eventType, DBEVENTINFO* dbe)
+{
+ char *pBlob = (char *)dbe->pBlob;
+
switch (eventType) {
case EVENTTYPE_MESSAGE:
- if (pBlob) {
- if (nen_options.bPreview) {
- TCHAR* buf = DbGetEventTextT(dbe, CP_ACP);
- if (lstrlen(buf) > iPreviewLimit) {
- fAddEllipsis = true;
- int iIndex = iPreviewLimit;
- int iWordThreshold = 20;
- while(iIndex && buf[iIndex] != ' ' && iWordThreshold--) {
- buf[iIndex--] = 0;
- }
- buf[iIndex] = 0;
- }
- buf = (TCHAR *)mir_realloc(buf, (lstrlen(buf) + 5) * sizeof(TCHAR));
- if (fAddEllipsis)
- _tcscat(buf, _T("..."));
- return buf;
- }
- }
+ if (pBlob && nen_options.bPreview)
+ return ShortenPreview(dbe);
+
return mir_tstrdup( TranslateT("Message"));
case EVENTTYPE_FILE:
@@ -574,6 +578,9 @@ static TCHAR *GetPreviewT(WORD eventType, DBEVENTINFO* dbe) return mir_tstrdup(TranslateT("Incoming file (invalid format"));
default:
+ if (nen_options.bPreview)
+ return ShortenPreview(dbe);
+
return mir_tstrdup(TranslateT("Unknown event"));
}
}
@@ -656,6 +663,17 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent if (!PluginConfig.g_PopupAvail)
return 0;
+ DBEVENTINFO dbe = { sizeof(dbe) };
+ // fix for a crash
+ if (hEvent && (pluginOptions->bPreview || hContact == 0)) {
+ dbe.cbBlob = db_event_getBlobSize(hEvent);
+ dbe.pBlob = (PBYTE)malloc(dbe.cbBlob);
+ }
+ db_event_get(hEvent, &dbe);
+
+ if (hEvent == 0 && hContact == 0)
+ dbe.szModule = Translate("Unknown module or contact");
+
POPUPDATAT pud = {0};
long iSeconds;
switch (eventType) {
@@ -665,27 +683,15 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent pud.colorText = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colTextMsg;
iSeconds = pluginOptions->iDelayMsg;
break;
- case EVENTTYPE_FILE:
- pud.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_FILE);
+
+ default:
+ pud.lchIcon = (HICON)CallService(MS_DB_EVENT_GETICON, LR_SHARED, (LPARAM)&dbe);
pud.colorBack = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colBackOthers;
pud.colorText = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colTextOthers;
iSeconds = pluginOptions->iDelayOthers;
break;
- default:
- return 1;
}
- DBEVENTINFO dbe = { sizeof(dbe) };
- // fix for a crash
- if (hEvent && (pluginOptions->bPreview || hContact == 0)) {
- dbe.cbBlob = db_event_getBlobSize(hEvent);
- dbe.pBlob = (PBYTE)malloc(dbe.cbBlob);
- }
- db_event_get(hEvent, &dbe);
-
- if (hEvent == 0 && hContact == 0)
- dbe.szModule = Translate("Unknown module or contact");
-
PLUGIN_DATAT *pdata = (PLUGIN_DATAT *)mir_calloc(sizeof(PLUGIN_DATAT));
pdata->eventType = eventType;
pdata->hContact = hContact;
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index fb6d9e9cd1..06855cd26a 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -132,6 +132,8 @@ void TSAPI RTF_CTableInit(); INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+int DbEventIsForMsgWindow(DBEVENTINFO *dbei);
+
int TSAPI InitOptions(void);
int TSAPI DbEventIsShown(TWindowData *dat, DBEVENTINFO *dbei);
void TSAPI StreamInEvents(HWND hwndDlg,HANDLE hDbEventFirst,int count,int fAppend, DBEVENTINFO *dbei_s);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index b249b635d8..a5e884004a 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1374,9 +1374,7 @@ void TSAPI DM_OptionsApplied(TWindowData *dat, WPARAM wParam, LPARAM lParam) dat->showUIElements = m_pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
- dat->dwFlagsEx = M->GetByte(SRMSGSET_SHOWURLS, SRMSGDEFSET_SHOWURLS) ? MWF_SHOW_URLEVENTS : 0;
- dat->dwFlagsEx |= M->GetByte(SRMSGSET_SHOWFILES, SRMSGDEFSET_SHOWFILES) ? MWF_SHOW_FILEEVENTS : 0;
- dat->dwFlagsEx |= M->GetByte(dat->hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0;
+ dat->dwFlagsEx = M->GetByte(dat->hContact, "splitoverride", 0) ? MWF_SHOW_SPLITTEROVERRIDE : 0;
dat->Panel->getVisibility();
// small inner margins (padding) for the text areas
@@ -1600,7 +1598,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM wParam, LPARAM lParam) dat->hDbEventFirst = hDbEvent;
BOOL fIsStatusChangeEvent = IsStatusEvent(dbei.eventType);
- BOOL fIsNotifyEvent = (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE);
+ //BOOL fIsNotifyEvent = (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE);
if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ))
return;
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 7699d1da01..865c267924 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -712,7 +712,9 @@ int CMimAPI::MessageEventAdded(WPARAM wParam, LPARAM lParam) HWND hwnd = M->FindWindow((HANDLE)wParam);
- if (dbei.flags & DBEF_SENT || !(dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE) || dbei.flags & DBEF_READ)
+ BOOL isCustomEvent = IsCustomEvent(dbei.eventType);
+ BOOL isShownCustomEvent = DbEventIsForMsgWindow(&dbei);
+ if (dbei.flags & DBEF_SENT || (isCustomEvent && !isShownCustomEvent) || dbei.flags & DBEF_READ)
return 0;
CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM)1);
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 0a3f28e6d6..7b03ab7480 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -68,6 +68,15 @@ BOOL TSAPI IsStatusEvent(int eventType) return FALSE;
}
+BOOL TSAPI IsCustomEvent(int eventType)
+{
+ if (eventType == EVENTTYPE_MESSAGE || eventType == EVENTTYPE_URL || eventType == EVENTTYPE_CONTACTS ||
+ eventType == EVENTTYPE_ADDED || eventType == EVENTTYPE_AUTHREQUEST || eventType == EVENTTYPE_FILE)
+ return FALSE;
+
+ return TRUE;
+}
+
/*
* reorder tabs within a container. fSavePos indicates whether the new position should be saved to the
* contacts db record (if so, the container will try to open the tab at the saved position later)
diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h index 7b29990778..aa5386052f 100644 --- a/plugins/TabSRMM/src/msgdlgutils.h +++ b/plugins/TabSRMM/src/msgdlgutils.h @@ -78,6 +78,7 @@ void TSAPI GetClientIcon (TWindowData *dat); void TSAPI RearrangeTab (HWND hwndDlg, const TWindowData *dat, int iMode, BOOL fSavePos);
void TSAPI GetCachedStatusMsg (TWindowData *dat);
BOOL TSAPI IsStatusEvent (int eventType);
+BOOL TSAPI IsCustomEvent (int eventType);
void TSAPI GetMyNick (TWindowData *dat);
HICON TSAPI MY_GetContactIcon (const TWindowData *dat);
void TSAPI CheckAndDestroyIEView (TWindowData *dat);
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 75784e1987..83cad550e6 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -543,20 +543,18 @@ static char *CreateRTFTail(struct TWindowData *dat) return buffer;
}
-int TSAPI DbEventIsShown(struct TWindowData *dat, DBEVENTINFO * dbei)
+int TSAPI DbEventIsShown(struct TWindowData *dat, DBEVENTINFO *dbei)
{
- switch (dbei->eventType) {
- case EVENTTYPE_MESSAGE:
+ if (!IsCustomEvent(dbei->eventType))
return 1;
- case EVENTTYPE_FILE:
- return(dat->dwFlagsEx & MWF_SHOW_FILEEVENTS);
- }
+ if (DbEventIsForMsgWindow(dbei))
+ return 1;
return IsStatusEvent(dbei->eventType);
}
-static int DbEventIsForMsgWindow(DBEVENTINFO *dbei)
+int DbEventIsForMsgWindow(DBEVENTINFO *dbei)
{
DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
return et && ( et->flags & DETF_MSGWINDOW );
@@ -1030,6 +1028,12 @@ static char *Template_CreateRTFFromDbEvent(struct TWindowData *dat, HANDLE hCont mir_free( tszFileName );
}
break;
+ default:
+ if (IsCustomEvent(dbei.eventType)) {
+ TCHAR* tszText = DbGetEventTextT(&dbei, CP_ACP);
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, tszText, 0);
+ }
+ break;
}
break;
case '*': // bold
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 8932d182f4..8d20bef397 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -91,16 +91,9 @@ #define MWF_DIVIDERWANTED 0x40000000
#define MWF_LOG_GROUPMODE 0x80000000
-#define MWF_SHOW_URLEVENTS 1
-#define MWF_SHOW_FILEEVENTS 2
-//#define MWF_SHOW_PRIVATETHEME 4
-//#define MWF_SHOW_EMPTYLINEFIX 8
-//#define MWF_SHOW_MICROLF 16
-//#define MWF_SHOW_MARKFOLLOWUPTS 32
#define MWF_SHOW_FLASHCLIST 64
#define MWF_SHOW_SPLITTEROVERRIDE 128
#define MWF_SHOW_SCROLLINGDISABLED 256
-//#define MWF_SHOW_INFONOTES ** FREE **
#define MWF_SHOW_ISIDLE 4096
#define MWF_SHOW_AWAYMSGTIMER 8192
#define MWF_EX_DELAYEDSPLITTER 32768
@@ -725,10 +718,6 @@ extern const int msgDlgFontCount; #define SRMSGSET_LOADTIME "LoadTime"
#define SRMSGDEFSET_LOADTIME 10
-#define SRMSGSET_SHOWURLS "ShowURLs"
-#define SRMSGDEFSET_SHOWURLS 1
-#define SRMSGSET_SHOWFILES "ShowFiles"
-#define SRMSGDEFSET_SHOWFILES 1
#define SRMSGSET_BKGCOLOUR "BkgColour"
#define SRMSGSET_BKGCOLOUR_MUC "BkgColourMUC"
diff --git a/plugins/TabSRMM/src/translator.cpp b/plugins/TabSRMM/src/translator.cpp index 0d42c72b4e..3e51e9314a 100644 --- a/plugins/TabSRMM/src/translator.cpp +++ b/plugins/TabSRMM/src/translator.cpp @@ -119,22 +119,20 @@ TOptionListItem m_lvItemsMsg[] = { TOptionListGroup m_lvGroupsLog[] = {
0, LPGENT("Message log appearance"),
0, LPGENT("Support for external plugins"),
- 0, LPGENT("Additional events to show"),
0, LPGENT("Timestamp settings (note: timstamps also depend on your templates)"),
0, LPGENT("Message log icons"),
0, NULL
};
TOptionListItem m_lvItemsLog[] = {
- 0, LPGENT("Show file events"), 1, LOI_TYPE_SETTING, (UINT_PTR)SRMSGSET_SHOWFILES, 2,
- 0, LPGENT("Show timestamps"), 1, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_SHOWTIME, 3,
- 0, LPGENT("Show dates in timestamps"), 1, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_SHOWDATES, 3,
- 0, LPGENT("Show seconds in timestamps"), 1, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_SHOWSECONDS, 3,
- 0, LPGENT("Use contacts local time (if timezone info available)"), 0, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_LOCALTIME, 3,
+ 0, LPGENT("Show timestamps"), 1, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_SHOWTIME, 2,
+ 0, LPGENT("Show dates in timestamps"), 1, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_SHOWDATES, 2,
+ 0, LPGENT("Show seconds in timestamps"), 1, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_SHOWSECONDS, 2,
+ 0, LPGENT("Use contacts local time (if timezone info available)"), 0, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_LOCALTIME, 2,
0, LPGENT("Draw grid lines"), 1, LOI_TYPE_FLAG, MWF_LOG_GRID, 0,
- 0, LPGENT("Event type icons in the message log"), 1, LOI_TYPE_FLAG, MWF_LOG_SHOWICONS, 4,
- 0, LPGENT("Text symbols as event markers"), 0, LOI_TYPE_FLAG, MWF_LOG_SYMBOLS, 4,
- 0, LPGENT("Use Incoming/Outgoing Icons"), 1, LOI_TYPE_FLAG, MWF_LOG_INOUTICONS, 4,
+ 0, LPGENT("Event type icons in the message log"), 1, LOI_TYPE_FLAG, MWF_LOG_SHOWICONS, 3,
+ 0, LPGENT("Text symbols as event markers"), 0, LOI_TYPE_FLAG, MWF_LOG_SYMBOLS, 3,
+ 0, LPGENT("Use Incoming/Outgoing Icons"), 1, LOI_TYPE_FLAG, MWF_LOG_INOUTICONS, 3,
0, LPGENT("Use Message Grouping"), 1, LOI_TYPE_FLAG, MWF_LOG_GROUPMODE, 0,
0, LPGENT("Indent message body"), 1, LOI_TYPE_FLAG, MWF_LOG_INDENT, 0,
0, LPGENT("Simple text formatting (*bold* etc.)"), 0, LOI_TYPE_FLAG, MWF_LOG_TEXTFORMAT, 0,
|