diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/SeenPlugin/res/resource.rc | 73 | ||||
-rw-r--r-- | plugins/SeenPlugin/res/version.rc | 41 | ||||
-rw-r--r-- | plugins/SeenPlugin/seenplugin_10.vcxproj | 9 | ||||
-rw-r--r-- | plugins/SeenPlugin/seenplugin_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/file.cpp | 95 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/history.cpp | 340 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/main.cpp | 38 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/menu.cpp | 69 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/missed.cpp | 297 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/options.cpp | 794 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/seen.h | 14 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/userinfo.cpp | 67 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/utils.cpp | 799 |
13 files changed, 1243 insertions, 1396 deletions
diff --git a/plugins/SeenPlugin/res/resource.rc b/plugins/SeenPlugin/res/resource.rc index eeeccc30e7..2aa5cbbb71 100644 --- a/plugins/SeenPlugin/res/resource.rc +++ b/plugins/SeenPlugin/res/resource.rc @@ -26,17 +26,17 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN // TEXTINCLUDE
//
-1 TEXTINCLUDE DISCARDABLE
+1 TEXTINCLUDE DISCARDABLE
BEGIN
"..\\src\\resource.h\0"
END
-2 TEXTINCLUDE DISCARDABLE
+2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include <windows.h>\0"
END
-3 TEXTINCLUDE DISCARDABLE
+3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
@@ -58,17 +58,17 @@ BEGIN GROUPBOX "Last seen options",IDC_MAINGROUP,0,0,299,226,WS_GROUP
CONTROL "Last seen menuitem",IDC_MENUITEM,"Button",
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,6,12,132,10
- CONTROL "Show icon",IDC_SHOWICON,"Button",BS_AUTOCHECKBOX |
+ CONTROL "Show icon",IDC_SHOWICON,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,141,12,69,10
EDITTEXT IDC_MENUSTAMP,18,23,120,12,ES_AUTOHSCROLL | WS_GROUP
- CONTROL "Userinfo tab",IDC_USERINFO,"Button",BS_AUTOCHECKBOX |
+ CONTROL "Userinfo tab",IDC_USERINFO,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,6,42,140,10
EDITTEXT IDC_USERSTAMP,18,52,275,12,ES_AUTOHSCROLL | WS_GROUP
- CONTROL "Log to file",IDC_FILE,"Button",BS_AUTOCHECKBOX |
+ CONTROL "Log to file",IDC_FILE,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,6,72,132,10
EDITTEXT IDC_FILENAME,149,69,144,12,ES_AUTOHSCROLL
EDITTEXT IDC_FILESTAMP,18,83,275,12,ES_AUTOHSCROLL | WS_GROUP
- CONTROL "Log to history",IDC_HISTORY,"Button",BS_AUTOCHECKBOX |
+ CONTROL "Log to history",IDC_HISTORY,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,7,104,131,10
LTEXT "Maximum size",IDC_STATIC,183,102,51,9
EDITTEXT IDC_HISTORYSIZE,149,100,30,12,ES_AUTOHSCROLL | ES_NUMBER
@@ -80,10 +80,10 @@ BEGIN BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,7,174,135,10
CONTROL "Enable 'Missed Ones' feature",IDC_MISSEDONES,"Button",
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,7,190,135,10
- CONTROL "Count times",IDC_COUNT,"Button",BS_AUTOCHECKBOX |
+ CONTROL "Count times",IDC_COUNT,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,18,202,100,10
LTEXT "Protocols to watch:",IDC_MAINGROUP,149,130,114,9
- CONTROL "Tree1",IDC_PROTOCOLLIST,"SysTreeView32",TVS_NOTOOLTIPS |
+ CONTROL "Tree1",IDC_PROTOCOLLIST,"SysTreeView32",TVS_NOTOOLTIPS |
WS_BORDER | WS_TABSTOP,149,140,144,81
END
@@ -99,7 +99,7 @@ BEGIN RTEXT "Title",IDC_LABTEXT,57,11,40,10
EDITTEXT IDC_POPUPSTAMP,100,9,50,12,ES_AUTOHSCROLL | WS_GROUP
RTEXT "Text",IDC_LABTTITLE,155,11,25,10
- EDITTEXT IDC_POPUPSTAMPTEXT,185,9,88,12,ES_AUTOHSCROLL |
+ EDITTEXT IDC_POPUPSTAMPTEXT,185,9,88,12,ES_AUTOHSCROLL |
WS_GROUP
GROUPBOX "PopUp Colors",IDC_STATIC,0,30,280,136,WS_GROUP
RTEXT "Online",IDC_STATIC,10,43,60,10
@@ -141,12 +141,12 @@ STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- EDITTEXT IDC_INFOTEXT,6,6,210,122,ES_MULTILINE | ES_NOHIDESEL |
+ EDITTEXT IDC_INFOTEXT,6,6,210,122,ES_MULTILINE | ES_NOHIDESEL |
ES_READONLY | NOT WS_BORDER
END
IDD_MISSED DIALOGEX 0, 0, 160, 71
-STYLE DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
+STYLE DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
CAPTION "Last seen plugin"
@@ -158,7 +158,7 @@ BEGIN END
IDD_HISTORY DIALOGEX 0, 0, 200, 120
-STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
+STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
@@ -168,7 +168,7 @@ BEGIN PUSHBUTTON "",IDC_USERMENU,146,5,15,13,BS_ICON | WS_TABSTOP
PUSHBUTTON "",IDC_DETAILS,163,5,15,13,BS_ICON | WS_TABSTOP
PUSHBUTTON "",IDC_SENDMSG,180,5,15,13,BS_ICON | WS_TABSTOP
- LISTBOX IDC_HISTORYLIST,5,20,190,59,LBS_NOINTEGRALHEIGHT |
+ LISTBOX IDC_HISTORYLIST,5,20,190,59,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
CONTROL "Alert when user status changes",IDC_STATUSCHANGE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,5,86,190,8
@@ -181,7 +181,7 @@ END //
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE
+GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_OPTIONS, DIALOG
BEGIN
@@ -221,48 +221,6 @@ BEGIN END
#endif // APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 5,0,4,7
- PRODUCTVERSION 5,0,4,7
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "000004b0"
- BEGIN
- VALUE "Comments", "Last Seen Mod Plugin for Miranda NG\0"
- VALUE "CompanyName", "Heiko Schillinger, YB\0"
- VALUE "FileDescription", "Last Seen Plugin (NSN Compatible)\0"
- VALUE "FileVersion", "5.0.4.7\0"
- VALUE "InternalName", "Last Seen\0"
- VALUE "LegalCopyright", "ฉ 2001-2002 by Heiko Schillinger, 2003 by Bruno Rino, 2006 by YB\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "seenplugin.dll\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", " Last Seen Plugin Mod\0"
- VALUE "ProductVersion", "5.0.4.7\0"
- VALUE "SpecialBuild", "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0, 1200
- END
-END
-
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
@@ -277,4 +235,3 @@ END /////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
-
diff --git a/plugins/SeenPlugin/res/version.rc b/plugins/SeenPlugin/res/version.rc new file mode 100644 index 0000000000..26119cf8dd --- /dev/null +++ b/plugins/SeenPlugin/res/version.rc @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 5,0,4,7
+ PRODUCTVERSION 5,0,4,7
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "Comments", "Last Seen Mod Plugin for Miranda NG\0"
+ VALUE "CompanyName", "Heiko Schillinger, YB\0"
+ VALUE "FileDescription", "Last Seen Plugin (NSN Compatible)\0"
+ VALUE "FileVersion", "5.0.4.7\0"
+ VALUE "InternalName", "Last Seen\0"
+ VALUE "LegalCopyright", "ฉ 2001-2002 by Heiko Schillinger, 2003 by Bruno Rino, 2006 by YB\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "seenplugin.dll\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", " Last Seen Plugin Mod\0"
+ VALUE "ProductVersion", "5.0.4.7\0"
+ VALUE "SpecialBuild", "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
diff --git a/plugins/SeenPlugin/seenplugin_10.vcxproj b/plugins/SeenPlugin/seenplugin_10.vcxproj index 0c493f11ca..47769fbcfe 100644 --- a/plugins/SeenPlugin/seenplugin_10.vcxproj +++ b/plugins/SeenPlugin/seenplugin_10.vcxproj @@ -25,20 +25,20 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -199,6 +199,7 @@ </ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc" />
+ <ResourceCompile Include="res\version.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/plugins/SeenPlugin/seenplugin_10.vcxproj.filters b/plugins/SeenPlugin/seenplugin_10.vcxproj.filters index 77ba5eda3f..9c321cd123 100644 --- a/plugins/SeenPlugin/seenplugin_10.vcxproj.filters +++ b/plugins/SeenPlugin/seenplugin_10.vcxproj.filters @@ -52,5 +52,8 @@ <ResourceCompile Include="res\resource.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
+ <ResourceCompile Include="res\version.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/plugins/SeenPlugin/src/file.cpp b/plugins/SeenPlugin/src/file.cpp index cac37f8c30..77cf31d373 100644 --- a/plugins/SeenPlugin/src/file.cpp +++ b/plugins/SeenPlugin/src/file.cpp @@ -32,88 +32,61 @@ Prepares the log file: */
int InitFileOutput(void)
{
- char szfpath[256]="",szmpath[256]="",*str;
- DBVARIANT dbv;
-
- GetModuleFileName(NULL,szmpath,MAX_PATH);
- strcpy(szfpath,!DBGetContactSetting(NULL,S_MOD,"FileName",&dbv)?dbv.pszVal:DEFAULT_FILENAME);
+ TCHAR szfpath[256], szmpath[256];
+ GetModuleFileName(NULL, szmpath, MAX_PATH);
- DBFreeVariant(&dbv);
+ DBVARIANT dbv;
+ _tcscpy(szfpath, !DBGetContactSettingTString(NULL, S_MOD, "FileName", &dbv) ? dbv.ptszVal : _T(DEFAULT_FILENAME));
+ db_free(&dbv);
- if(szfpath[0]=='\\')
- strcpy(szfpath,szfpath+1);
+ if (szfpath[0] == '\\')
+ _tcscpy(szfpath, szfpath+1);
- str=strrchr(szmpath,'\\');
- if(str!=NULL)
+ TCHAR *str = _tcsrchr(szmpath, '\\');
+ if (str != NULL)
*++str=0;
- strcat(szmpath,szfpath);
-
- strcpy(szfpath,szmpath);
+ _tcscat(szmpath, szfpath);
+ _tcscpy(szfpath, szmpath);
- str=strrchr(szmpath,'\\');
- if(str!=NULL)
+ str = _tcsrchr(szmpath, '\\');
+ if (str != NULL)
*++str=0;
-/*
-//we dont need this anylonger. the directory is created in filewrite
- if (!CreateDirectory(szmpath,NULL))
- {
- if (!(GetFileAttributes(szmpath) & FILE_ATTRIBUTE_DIRECTORY))
- {
- MessageBox(NULL,"Directory could not be created\nPlease choose another!","Last seen plugin",MB_OK|MB_ICONERROR);
- DBWriteContactSettingByte(NULL,S_MOD,"FileOutput",0);
- return 0;
- }
- }
-*/
- DBWriteContactSettingString(NULL,S_MOD,"PathToFile",szfpath);
+ db_set_ts(NULL, S_MOD, "PathToFile", szfpath);
return 0;
}
-//borrowed from netliblog.c
-static void CreateDirectoryTree(char *szDir)
-{
- DWORD dwAttributes;
- char *pszLastBackslash,szTestDir[MAX_PATH];
-
- lstrcpynA(szTestDir,szDir,sizeof(szTestDir));
- if ((dwAttributes=GetFileAttributesA(szTestDir))!=0xffffffff && dwAttributes&FILE_ATTRIBUTE_DIRECTORY) return;
- pszLastBackslash=strrchr(szTestDir,'\\');
- if(pszLastBackslash==NULL) return;
- *pszLastBackslash='\0';
- CreateDirectoryTree(szTestDir);
- CreateDirectoryA(szTestDir,NULL);
-}
-
/*
Writes a line into the log.
*/
void FileWrite(HANDLE hcontact)
{
- HANDLE fhout;
- DWORD byteswritten;
- char szout[1024],sznl[3]="\r\n";
- DBVARIANT dbv;
+ TCHAR szout[1024];
- DBGetContactSetting(NULL,S_MOD,"PathToFile",&dbv);
- strcpy(szout,ParseString(dbv.pszVal,hcontact,1));
- fhout=CreateFile(szout,GENERIC_WRITE,0,NULL,OPEN_ALWAYS,0,NULL);
- if (fhout==INVALID_HANDLE_VALUE){
- CreateDirectoryTree(szout);
- fhout=CreateFile(szout,GENERIC_WRITE,0,NULL,OPEN_ALWAYS,0,NULL);
- if (fhout==INVALID_HANDLE_VALUE) return;
+ DBVARIANT dbv;
+ DBGetContactSettingTString(NULL, S_MOD, "PathToFile", &dbv);
+ _tcscpy(szout, ParseString(dbv.ptszVal, hcontact, 1));
+
+ HANDLE fhout = CreateFile(szout, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, 0, NULL);
+ if (fhout == INVALID_HANDLE_VALUE){
+ CreateDirectoryTreeT(szout);
+ fhout = CreateFile(szout, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, 0, NULL);
+ if (fhout == INVALID_HANDLE_VALUE)
+ return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
SetFilePointer(fhout,0,0,FILE_END);
- strcpy(szout,ParseString(!DBGetContactSetting(NULL,S_MOD,"FileStamp",&dbv)?dbv.pszVal:DEFAULT_FILESTAMP,hcontact,1));
- DBFreeVariant(&dbv);
+ if ( !DBGetContactSettingTString(NULL, S_MOD," FileStamp", &dbv)) {
+ _tcscpy(szout, ParseString(dbv.ptszVal, hcontact, 1));
+ db_free(&dbv);
+ }
+ else _tcscpy(szout, ParseString( _T(DEFAULT_FILESTAMP), hcontact, 1));
- WriteFile(fhout,szout, (DWORD)_tcslen(szout),&byteswritten,NULL);
- WriteFile(fhout,sznl, (DWORD)_tcslen(sznl),&byteswritten,NULL);
+ DWORD byteswritten;
+ WriteFile(fhout, _T2A(szout), (DWORD)_tcslen(szout), &byteswritten, NULL);
+ WriteFile(fhout, "\r\n", 2, &byteswritten, NULL);
CloseHandle(fhout);
-
-
}
diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index fa90264fda..aa600dd906 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -34,7 +34,7 @@ char* BuildSetting(int historyLast) { static char sztemp[15];
*setting = '\0';
strcat(setting, "History_");
- strcat(setting, _itot(historyLast, sztemp, 10));
+ strcat(setting, _itoa(historyLast, sztemp, 10));
return setting;
}
@@ -43,49 +43,57 @@ void HistoryWrite(HANDLE hContact) short historyFirst, historyLast, historyMax;
DBVARIANT dbv;
- historyMax = DBGetContactSettingWord(NULL,S_MOD,"HistoryMax",10);
+ historyMax = db_get_w(NULL,S_MOD,"HistoryMax",10);
if (historyMax < 0) historyMax=0; else if (historyMax > 99) historyMax = 99;
- if (historyMax == 0) return;
- historyFirst = DBGetContactSettingWord(hContact,S_MOD,"HistoryFirst",0);
- if (historyFirst >= historyMax) historyFirst = 0;
- historyLast = DBGetContactSettingWord(hContact,S_MOD,"HistoryLast",0);
- if (historyLast >= historyMax) historyLast = historyMax-1;
-
- DBWriteContactSettingString(hContact,S_MOD,BuildSetting(historyLast),
- ParseString(!DBGetContactSetting(NULL,S_MOD,"HistoryStamp",&dbv)?dbv.pszVal:DEFAULT_HISTORYSTAMP,hContact,0));
- DBFreeVariant(&dbv);
-
- historyLast = (historyLast+1) % historyMax;
- DBWriteContactSettingWord(hContact,S_MOD,"HistoryLast",historyLast);
- if (historyLast == historyFirst) {
- DBWriteContactSettingWord(hContact,S_MOD,"HistoryFirst",(short) ((historyFirst+1) % historyMax));
+ if (historyMax == 0)
+ return;
+
+ historyFirst = db_get_w(hContact, S_MOD, "HistoryFirst", 0);
+ if (historyFirst >= historyMax)
+ historyFirst = 0;
+ historyLast = db_get_w(hContact, S_MOD, "HistoryLast", 0);
+ if (historyLast >= historyMax)
+ historyLast = historyMax-1;
+
+ TCHAR *ptszString;
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "HistoryStamp", &dbv)) {
+ ptszString = ParseString(dbv.ptszVal, hContact, 0);
+ db_free(&dbv);
}
+ else ptszString = ParseString( _T(DEFAULT_HISTORYSTAMP), hContact, 0);
+ db_set_ts(hContact, S_MOD, BuildSetting(historyLast), ptszString);
+ historyLast = (historyLast+1) % historyMax;
+ db_set_w(hContact,S_MOD,"HistoryLast",historyLast);
+ if (historyLast == historyFirst)
+ db_set_w(hContact, S_MOD, "HistoryFirst", (historyFirst+1) % historyMax);
}
-void LoadHistoryList(HANDLE hContact, HWND hwnd, int nList) {
+void LoadHistoryList(HANDLE hContact, HWND hwnd, int nList)
+{
short historyFirst, historyLast, historyMax;
short i;
DBVARIANT dbv;
-
SendDlgItemMessage(hwnd, nList, LB_RESETCONTENT, 0, 0);
- historyMax = DBGetContactSettingWord(NULL,S_MOD,"HistoryMax",10);
+ historyMax = db_get_w(NULL,S_MOD,"HistoryMax",10);
if (historyMax < 0) historyMax = 0; else if (historyMax > 99) historyMax = 99;
if (historyMax == 0) return;
- historyFirst = DBGetContactSettingWord(hContact,S_MOD,"HistoryFirst",0);
+ historyFirst = db_get_w(hContact,S_MOD,"HistoryFirst",0);
if (historyFirst >= historyMax) historyFirst = 0;
- historyLast = DBGetContactSettingWord(hContact,S_MOD,"HistoryLast",0);
+ historyLast = db_get_w(hContact,S_MOD,"HistoryLast",0);
if (historyLast >= historyMax) historyLast = historyMax-1;
i = historyLast;
while (i != historyFirst) {
i = (i-1+historyMax) % historyMax;
- SendDlgItemMessage(hwnd, nList, LB_ADDSTRING, 0,
- (LPARAM)(!DBGetContactSetting(hContact,S_MOD,BuildSetting(i),&dbv)?dbv.pszVal:""));
- DBFreeVariant(&dbv);
+
+ if ( !DBGetContactSettingTString(hContact, S_MOD, BuildSetting(i), &dbv)) {
+ SendDlgItemMessage(hwnd, nList, LB_ADDSTRING, 0, (LPARAM)dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else SendDlgItemMessage(hwnd, nList, LB_ADDSTRING, 0, (LPARAM)_T(""));
}
-
}
@@ -105,13 +113,6 @@ HDWP MyResizeWindow (HDWP hDwp, HWND hwndDlg, HWND hwndControl, ScreenToClient(hwndDlg, &pt);
// resize control
-/* MoveWindow(hwndControl,
- pt.x + nHorizontalOffset,
- pt.y + nVerticalOffset,
- rcinit.right - rcinit.left + nWidthOffset,
- rcinit.bottom - rcinit.top + nHeightOffset,
- FALSE);
-*/
return DeferWindowPos(hDwp, hwndControl, NULL,
pt.x + nHorizontalOffset,
pt.y + nVerticalOffset,
@@ -138,13 +139,6 @@ HDWP MyHorizCenterWindow (HDWP hDwp, HWND hwndDlg, HWND hwndControl, ScreenToClient(hwndDlg, &pt);
// resize control
-/* MoveWindow(hwndControl,
- (int) ((nClientWidth - (rcinit.right - rcinit.left))/2),
- pt.y + nVerticalOffset,
- rcinit.right - rcinit.left,
- rcinit.bottom - rcinit.top + nHeightOffset,
- TRUE);
-*/
return DeferWindowPos(hDwp, hwndControl, NULL,
(int) ((nClientWidth - (rcinit.right - rcinit.left))/2),
pt.y + nVerticalOffset,
@@ -153,9 +147,7 @@ HDWP MyHorizCenterWindow (HDWP hDwp, HWND hwndDlg, HWND hwndControl, SWP_NOZORDER);
}
-void MyResizeGetOffset (HWND hwndDlg, HWND hwndControl,
- int nWidth, int nHeight,
- int* nDx, int* nDy)
+void MyResizeGetOffset (HWND hwndDlg, HWND hwndControl, int nWidth, int nHeight, int* nDx, int* nDy)
{
RECT rcinit;
@@ -172,147 +164,147 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA HANDLE hContact;
char sztemp[1024]="";
static HIMAGELIST hIml=NULL;
-
- switch(Message)
- {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- hContact = (HANDLE)lparam;
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,lparam);
- strcpy(sztemp,(char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0));
- strcat(sztemp, ": ");
- strcat(sztemp, Translate("last seen history"));
- SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)sztemp);
- SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_BIG, (LPARAM) LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
- SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_SMALL, (LPARAM) LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
-
-// LoadHistoryList(hContact, hwndDlg, IDC_HISTORYLIST);
-
- if (DBGetContactSettingByte(hContact,S_MOD,"OnlineAlert",0))
- SendDlgItemMessage(hwndDlg, IDC_STATUSCHANGE, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
- {
- hIml=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,3,3);
- ImageList_AddIcon(hIml,LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_USERDETAILS)));
- ImageList_AddIcon(hIml,LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_DOWNARROW)));
- ImageList_AddIcon(hIml,LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
- SendDlgItemMessage(hwndDlg,IDC_DETAILS,BM_SETIMAGE,IMAGE_ICON,(WPARAM)ImageList_GetIcon(hIml,0,ILD_NORMAL));
- SendDlgItemMessage(hwndDlg,IDC_USERMENU,BM_SETIMAGE,IMAGE_ICON,(WPARAM)ImageList_GetIcon(hIml,1,ILD_NORMAL));
- SendDlgItemMessage(hwndDlg,IDC_SENDMSG,BM_SETIMAGE,IMAGE_ICON,(WPARAM)ImageList_GetIcon(hIml,2,ILD_NORMAL));
- }
- //set-up tooltips
- {
- HWND hwndDlgToolTips;
- TOOLINFO ti;
-
- hwndDlgToolTips = CreateWindowEx(WS_EX_TOPMOST,TOOLTIPS_CLASS,"",WS_POPUP,0,0,0,0,NULL,NULL,GetModuleHandle(NULL),NULL);
- ZeroMemory(&ti,sizeof(ti));
- ti.cbSize=sizeof(ti);
- ti.uFlags=TTF_IDISHWND|TTF_SUBCLASS;
- ti.uId=(UINT)GetDlgItem(hwndDlg,IDC_USERMENU);
- ti.lpszText=Translate("User Menu");
- SendMessage(hwndDlgToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
- ti.uId=(UINT)GetDlgItem(hwndDlg,IDC_DETAILS);
- ti.lpszText=Translate("View User's Details");
- SendMessage(hwndDlgToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
- ti.uId=(UINT)GetDlgItem(hwndDlg,IDC_SENDMSG);
- ti.lpszText=Translate("Send Instant Message");
- SendMessage(hwndDlgToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
- }
-
-
- Utils_RestoreWindowPositionNoMove(hwndDlg,NULL,S_MOD,"History_");
- ShowWindow(hwndDlg, SW_SHOW);
+ switch(Message) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ hContact = (HANDLE)lparam;
+ SetWindowLongPtr(hwndDlg,GWLP_USERDATA,lparam);
+ strcpy(sztemp,(char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0));
+ strcat(sztemp, ": ");
+ strcat(sztemp, Translate("last seen history"));
+ SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)sztemp);
+ SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_BIG, (LPARAM) LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
+ SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_SMALL, (LPARAM) LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
+
+ // LoadHistoryList(hContact, hwndDlg, IDC_HISTORYLIST);
+
+ if ( db_get_b(hContact,S_MOD,"OnlineAlert",0))
+ SendDlgItemMessage(hwndDlg, IDC_STATUSCHANGE, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
+ {
+ hIml=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,3,3);
+ ImageList_AddIcon(hIml,LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_USERDETAILS)));
+ ImageList_AddIcon(hIml,LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_DOWNARROW)));
+ ImageList_AddIcon(hIml,LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
+ SendDlgItemMessage(hwndDlg,IDC_DETAILS,BM_SETIMAGE,IMAGE_ICON,(WPARAM)ImageList_GetIcon(hIml,0,ILD_NORMAL));
+ SendDlgItemMessage(hwndDlg,IDC_USERMENU,BM_SETIMAGE,IMAGE_ICON,(WPARAM)ImageList_GetIcon(hIml,1,ILD_NORMAL));
+ SendDlgItemMessage(hwndDlg,IDC_SENDMSG,BM_SETIMAGE,IMAGE_ICON,(WPARAM)ImageList_GetIcon(hIml,2,ILD_NORMAL));
+ }
+
+ //set-up tooltips
+ {
+ HWND hwndDlgToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);
+
+ TOOLINFO ti = { sizeof(ti) };
+ ti.uFlags=TTF_IDISHWND|TTF_SUBCLASS;
+ ti.uId = (UINT)GetDlgItem(hwndDlg,IDC_USERMENU);
+ ti.lpszText = TranslateT("User Menu");
+ SendMessage(hwndDlgToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
+ ti.uId = (UINT)GetDlgItem(hwndDlg,IDC_DETAILS);
+ ti.lpszText = TranslateT("View User's Details");
+ SendMessage(hwndDlgToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
+ ti.uId = (UINT)GetDlgItem(hwndDlg,IDC_SENDMSG);
+ ti.lpszText = TranslateT("Send Instant Message");
+ SendMessage(hwndDlgToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
+ }
+
+ Utils_RestoreWindowPositionNoMove(hwndDlg,NULL,S_MOD,"History_");
+ ShowWindow(hwndDlg, SW_SHOW);
+ break;
+
+ case WM_MEASUREITEM:
+ return CallService(MS_CLIST_MENUMEASUREITEM,wparam,lparam);
+
+ case WM_DRAWITEM:
+ return CallService(MS_CLIST_MENUDRAWITEM,wparam,lparam);
+
+ case WM_COMMAND:
+ hContact=(HANDLE)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ if (CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wparam),MPCF_CONTACTMENU),(LPARAM)hContact))
break;
- case WM_MEASUREITEM:
- return CallService(MS_CLIST_MENUMEASUREITEM,wparam,lparam);
- case WM_DRAWITEM:
- return CallService(MS_CLIST_MENUDRAWITEM,wparam,lparam);
- case WM_COMMAND:
- hContact=(HANDLE)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if(CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wparam),MPCF_CONTACTMENU),(LPARAM)hContact))
- break;
- switch(LOWORD(wparam))
- {
- case IDCANCEL:
- SendMessage(hwndDlg, WM_CLOSE, 0, 0);
- break;
- case IDOK:
- if (SendDlgItemMessage(hwndDlg, IDC_STATUSCHANGE, BM_GETCHECK, 0, 0) == BST_CHECKED)
- DBWriteContactSettingByte(hContact,S_MOD,"OnlineAlert",1);
- else
- DBWriteContactSettingByte(hContact,S_MOD,"OnlineAlert",0);
- SendMessage(hwndDlg, WM_CLOSE, 0, 0);
- break;
- case IDC_USERMENU:
- {
- RECT rc;
- HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,(WPARAM)hContact,0);
- GetWindowRect(GetDlgItem(hwndDlg,IDC_USERMENU),&rc);
- TrackPopupMenu(hMenu,0,rc.left,rc.bottom,0,hwndDlg,NULL);
- DestroyMenu(hMenu);
- }
- break;
- case IDC_DETAILS:
- CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)hContact,0);
- break;
- case IDC_SENDMSG:
- CallService(MS_MSG_SENDMESSAGE,(WPARAM)hContact,0);
- break;
- case IDC_TEST:
- debug(ParseString("Date: %d.%m.%y(%Y) \n Date desc: %W - %w - %E - %e \n Time: %H:%M:%S (%h-%p) \n user: %n - %u \n Status: %s \n IP: %i - %r",hContact,0));
- break;
- }
+ switch(LOWORD(wparam)) {
+ case IDCANCEL:
+ SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
- case WM_SIZE:
- {
- int dx, dy;
- HDWP hDwp;
-
- hDwp = BeginDeferWindowPos(6);
- MyResizeGetOffset(hwndDlg, GetDlgItem(hwndDlg, IDC_HISTORYLIST),
- LOWORD(lparam)-15, HIWORD(lparam)-99, &dx, &dy);
- hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_USERMENU),
- dx, 0, 0, 0);
- hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_DETAILS),
- dx, 0, 0, 0);
- hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_SENDMSG),
- dx, 0, 0, 0);
- hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_HISTORYLIST),
- 0, 0, dx, dy);
- hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_STATUSCHANGE),
- 0, dy, dx, 0);
- hDwp = MyHorizCenterWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDOK),
- LOWORD(lparam), dy, 0);
- EndDeferWindowPos(hDwp);
- }
+ case IDOK:
+ if (SendDlgItemMessage(hwndDlg, IDC_STATUSCHANGE, BM_GETCHECK, 0, 0) == BST_CHECKED)
+ db_set_b(hContact,S_MOD,"OnlineAlert",1);
+ else
+ db_set_b(hContact,S_MOD,"OnlineAlert",0);
+ SendMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
- case WM_GETMINMAXINFO:
- {
- MINMAXINFO mmi;
- CopyMemory (&mmi, (LPMINMAXINFO) lparam, sizeof (MINMAXINFO));
-
- /* The minimum width in points*/
- mmi.ptMinTrackSize.x = 200;
- /* The minimum height in points*/
- mmi.ptMinTrackSize.y = 190;
-
- CopyMemory ((LPMINMAXINFO) lparam, &mmi, sizeof (MINMAXINFO));
+ case IDC_USERMENU:
+ {
+ RECT rc;
+ HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,(WPARAM)hContact,0);
+ GetWindowRect(GetDlgItem(hwndDlg,IDC_USERMENU),&rc);
+ TrackPopupMenu(hMenu,0,rc.left,rc.bottom,0,hwndDlg,NULL);
+ DestroyMenu(hMenu);
}
break;
-
- case WM_CLOSE:
- DestroyWindow(hwndDlg);
- WindowList_Remove(hWindowList,hwndDlg);
+ case IDC_DETAILS:
+ CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)hContact,0);
+ break;
+ case IDC_SENDMSG:
+ CallService(MS_MSG_SENDMESSAGE,(WPARAM)hContact,0);
break;
- case WM_DESTROY:
- Utils_SaveWindowPosition(hwndDlg,NULL,S_MOD,"History_");
- ImageList_Destroy(hIml);
+ case IDC_TEST:
+ debug( ParseString( _T("Date: %d.%m.%y(%Y) \n Date desc: %W - %w - %E - %e \n Time: %H:%M:%S (%h-%p) \n user: %n - %u \n Status: %s \n IP: %i - %r"), hContact, 0));
break;
- default:
- return FALSE;
- }
+ }
+ break;
+ case WM_SIZE:
+ {
+ int dx, dy;
+ HDWP hDwp;
+
+ hDwp = BeginDeferWindowPos(6);
+ MyResizeGetOffset(hwndDlg, GetDlgItem(hwndDlg, IDC_HISTORYLIST),
+ LOWORD(lparam)-15, HIWORD(lparam)-99, &dx, &dy);
+ hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_USERMENU),
+ dx, 0, 0, 0);
+ hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_DETAILS),
+ dx, 0, 0, 0);
+ hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_SENDMSG),
+ dx, 0, 0, 0);
+ hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_HISTORYLIST),
+ 0, 0, dx, dy);
+ hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_STATUSCHANGE),
+ 0, dy, dx, 0);
+ hDwp = MyHorizCenterWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDOK),
+ LOWORD(lparam), dy, 0);
+ EndDeferWindowPos(hDwp);
+ }
+ break;
+
+ case WM_GETMINMAXINFO:
+ {
+ MINMAXINFO mmi;
+ CopyMemory (&mmi, (LPMINMAXINFO) lparam, sizeof (MINMAXINFO));
+
+ /* The minimum width in points*/
+ mmi.ptMinTrackSize.x = 200;
+ /* The minimum height in points*/
+ mmi.ptMinTrackSize.y = 190;
+
+ CopyMemory ((LPMINMAXINFO) lparam, &mmi, sizeof (MINMAXINFO));
+ }
+ break;
+
+ case WM_CLOSE:
+ DestroyWindow(hwndDlg);
+ WindowList_Remove(hWindowList,hwndDlg);
+ break;
+
+ case WM_DESTROY:
+ Utils_SaveWindowPosition(hwndDlg,NULL,S_MOD,"History_");
+ ImageList_Destroy(hIml);
+ break;
+
+ default:
+ return FALSE;
+ }
return TRUE;
}
diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp index 310b3e9148..405804dc95 100644 --- a/plugins/SeenPlugin/src/main.cpp +++ b/plugins/SeenPlugin/src/main.cpp @@ -29,17 +29,17 @@ HANDLE ehdb = NULL, ehproto = NULL, ehmissed = NULL, ehuserinfo = NULL, ehmissed int hLangpack;
-PLUGININFOEX pluginInfo={
- sizeof(PLUGININFOEX),
- "Last seen",
- PLUGIN_MAKE_VERSION(5,0,4,7),
- "Log when a user was last seen online and which users were online while you were away.",
- "Heiko Schillinger, YB",
- "y_b@saaplugin.no-ip.info",
- "ฉ 2001-2002 Heiko Schillinger, 2003 modified by Bruno Rino, 2005-7 Modified by YB",
- "http://miranda-ng.org/",
- UNICODE_AWARE,
- { 0x2d506d46,0xc94e,0x4ef8,{0x85, 0x37, 0xf1, 0x12, 0x33, 0xa8, 0x03, 0x81}}/* 2d506d46-c94e-4ef8-8537-f11233a80381 */
+PLUGININFOEX pluginInfo = {
+ sizeof(PLUGININFOEX),
+ "Last seen",
+ PLUGIN_MAKE_VERSION(5,1,0,0),
+ "Log when a user was last seen online and which users were online while you were away.",
+ "Heiko Schillinger, YB",
+ "y_b@saaplugin.no-ip.info",
+ "ฉ 2001-2002 Heiko Schillinger, 2003 modified by Bruno Rino, 2005-7 Modified by YB",
+ "http://miranda-ng.org/",
+ UNICODE_AWARE,
+ { 0x2d506d46,0xc94e,0x4ef8,{0x85, 0x37, 0xf1, 0x12, 0x33, 0xa8, 0x03, 0x81}}/* 2d506d46-c94e-4ef8-8537-f11233a80381 */
};
#define TRANSNUMBER 2
@@ -58,20 +58,20 @@ int MainInit(WPARAM wparam,LPARAM lparam) contactQueue = (logthread_info **)malloc(contactQueueSize);
memset(&contactQueue[0], 0, contactQueueSize);
contactQueueSize = 16;
- includeIdle = (BOOL )DBGetContactSettingByte(NULL,S_MOD,"IdleSupport",1);
+ includeIdle = (BOOL )db_get_b(NULL,S_MOD,"IdleSupport",1);
hOptInit = HookEvent(ME_OPT_INITIALISE, OptionsInit);
- if(DBGetContactSettingByte(NULL,S_MOD,"MenuItem",1)) {
+ if ( db_get_b(NULL,S_MOD,"MenuItem",1)) {
InitMenuitem();
}
- if(DBGetContactSettingByte(NULL,S_MOD,"UserinfoTab",1))
+ if ( db_get_b(NULL,S_MOD,"UserinfoTab",1))
ehuserinfo = HookEvent(ME_USERINFO_INITIALISE,UserinfoInit);
- if(DBGetContactSettingByte(NULL,S_MOD,"FileOutput",0))
+ if ( db_get_b(NULL,S_MOD,"FileOutput",0))
InitFileOutput();
- if(DBGetContactSettingByte(NULL,S_MOD,"MissedOnes",0))
+ if ( db_get_b(NULL,S_MOD,"MissedOnes",0))
ehmissed_proto=HookEvent(ME_PROTO_ACK,ModeChange_mo);
ehdb = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, UpdateValues);
@@ -85,7 +85,7 @@ int MainInit(WPARAM wparam,LPARAM lparam) // known modules list
if (ServiceExists("DBEditorpp/RegisterSingleModule"))
CallService("DBEditorpp/RegisterSingleModule", (WPARAM)S_MOD, 0);
- DBWriteContactSettingString(NULL,"Uninstall",Translate("Last seen"),S_MOD);
+ db_set_s(NULL,"Uninstall",Translate("Last seen"),S_MOD);
if ( ServiceExists(MS_TIPPER_ADDTRANSLATION)) {
@@ -105,9 +105,9 @@ extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirand extern "C" __declspec(dllexport) int Unload(void)
{
UnhookEvent(ehdb);
- if(ehmissed) UnhookEvent(ehmissed);
+ if (ehmissed) UnhookEvent(ehmissed);
UnhookEvent(ehproto);
- if(ehmissed_proto) UnhookEvent(ehmissed_proto);
+ if (ehmissed_proto) UnhookEvent(ehmissed_proto);
UnhookEvent(hOptInit);
UnhookEvent(hMainInit);
if (ehuserinfo) UnhookEvent(ehuserinfo);
diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index 02f241b793..23d26cc3c8 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -40,58 +40,45 @@ INT_PTR MenuitemClicked(WPARAM wparam,LPARAM lparam) int BuildContactMenu(WPARAM wparam,LPARAM lparam)
{
- CLISTMENUITEM cmi;
- DBVARIANT dbv;
- int id=-1,isetting;
- HANDLE hContact;
- char *szProto;
-
- hContact = (HANDLE)wparam;
- szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
-
- ZeroMemory(&cmi,sizeof(cmi));
- cmi.cbSize=sizeof(cmi);
- if (!IsWatchedProtocol(szProto) || !DBGetContactSettingByte(NULL,S_MOD,"MenuItem",1))
- {
- cmi.flags=CMIM_FLAGS|CMIF_HIDDEN;
- }
- else
- {
- cmi.flags=CMIM_NAME|CMIM_FLAGS|CMIM_ICON;
- cmi.hIcon=NULL;
- cmi.pszName=ParseString(!DBGetContactSetting(NULL,S_MOD,"MenuStamp",&dbv)?dbv.pszVal:DEFAULT_MENUSTAMP,(HANDLE)wparam,0);
+ int id = -1, isetting;
+ HANDLE hContact = (HANDLE)wparam;
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+
+ CLISTMENUITEM cmi = { sizeof(cmi) };
+ if (!IsWatchedProtocol(szProto) || !db_get_b(NULL,S_MOD,"MenuItem",1))
+ cmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
+ else {
+ cmi.flags = CMIM_NAME | CMIM_FLAGS | CMIM_ICON | CMIF_TCHAR;
+ cmi.hIcon = NULL;
+
+ DBVARIANT dbv;
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "MenuStamp", &dbv)) {
+ cmi.ptszName = ParseString(dbv.ptszVal, (HANDLE)wparam, 0);
+ db_free(&dbv);
+ }
+ else cmi.ptszName = ParseString( _T(DEFAULT_MENUSTAMP), (HANDLE)wparam, 0);
- if (!strcmp(cmi.pszName,Translate("<unknown>")))
- {
- if (IsWatchedProtocol(szProto))
- cmi.flags|=CMIF_GRAYED;
+ if ( !_tcscmp(cmi.ptszName, TranslateT("<unknown>"))) {
+ if ( IsWatchedProtocol(szProto))
+ cmi.flags |= CMIF_GRAYED;
else
- cmi.flags|=CMIF_HIDDEN;
- }
- else if(DBGetContactSettingByte(NULL,S_MOD,"ShowIcon",1))
- {
- isetting=DBGetContactSettingWord((HANDLE)hContact,S_MOD,"StatusTriger",-1);
- cmi.hIcon=LoadSkinnedProtoIcon(szProto,isetting|0x8000);
-
+ cmi.flags |= CMIF_HIDDEN;
+ }
+ else if ( db_get_b(NULL, S_MOD, "ShowIcon",1)) {
+ isetting = db_get_w(hContact, S_MOD, "StatusTriger", -1);
+ cmi.hIcon = LoadSkinnedProtoIcon(szProto, isetting|0x8000);
}
}
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hmenuitem,(LPARAM)&cmi);
- DBFreeVariant(&dbv);
-
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmenuitem, (LPARAM)&cmi);
return 0;
}
-
-
void InitMenuitem()
{
- CLISTMENUITEM cmi;
-
hLSUserDet = CreateServiceFunction("LastSeenUserDetails", MenuitemClicked);
- ZeroMemory(&cmi,sizeof(cmi));
- cmi.cbSize=sizeof(cmi);
+ CLISTMENUITEM cmi = { sizeof(cmi) };
cmi.flags=0;
cmi.hIcon=NULL;
cmi.hotKey=0;
@@ -110,4 +97,4 @@ void UninitMenuitem() {
DestroyServiceFunction(hLSUserDet);
UnhookEvent(hBuildMenu);
-}
\ No newline at end of file +}
diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp index bb1568a88b..62acb570c9 100644 --- a/plugins/SeenPlugin/src/missed.cpp +++ b/plugins/SeenPlugin/src/missed.cpp @@ -24,77 +24,46 @@ Last change by : $Author: y_b $ */
#include "seen.h"
-#include <m_ignore.h>
-
-
-
MISSEDCONTACTS mcs;
extern HANDLE ehmissed;
extern HINSTANCE hInstance;
-
-
WPARAM IsUserMissed(WPARAM contact)
{
- int loop=0;
-
- for (;loop<mcs.count;loop++)
- {
- if(mcs.wpcontact[loop]==contact)
- return MAKEWPARAM(1,loop);
- }
+ for (int loop=0; loop < mcs.count; loop++)
+ if (mcs.wpcontact[loop] == contact)
+ return MAKEWPARAM(1, loop);
return 0;
}
-
-
int RemoveUser(int pos)
{
- int loop;
-
- for(loop=pos;loop<mcs.count-1;loop++)
- mcs.wpcontact[loop]=mcs.wpcontact[loop+1];
+ for(int loop=pos; loop < mcs.count-1; loop++)
+ mcs.wpcontact[loop] = mcs.wpcontact[loop+1];
mcs.count--;
-
return 0;
}
-
-
int ResetMissed(void)
{
- HANDLE hcontact=NULL;
-
- hcontact=db_find_first();
- while(hcontact!=NULL)
- {
- DBWriteContactSettingByte(hcontact,S_MOD,"Missed",0);
+ HANDLE hcontact = db_find_first();
+ while (hcontact != NULL) {
+ db_set_b(hcontact, S_MOD, "Missed", 0);
hcontact = db_find_next(hcontact);
}
ZeroMemory(&mcs,sizeof(mcs));
-
return 0;
}
-
int CheckIfOnline(void)
{
- HANDLE hcontact;
-// char *szProto;
-// WORD status;
-
- hcontact=db_find_first();
- while(hcontact!=NULL)
- {
-/* szProto=(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0);
- status=(szProto==NULL)?ID_STATUS_OFFLINE:DBGetContactSettingWord(hcontact,szProto,"Status",ID_STATUS_OFFLINE);
- if(status!=ID_STATUS_OFFLINE)
-*/
- if(CallService(MS_CLIST_GETCONTACTICON,(WPARAM)hcontact,0)!=ICON_OFFLINE)
- DBWriteContactSettingByte(hcontact,S_MOD,"Missed",2);
+ HANDLE hcontact = db_find_first();
+ while (hcontact != NULL) {
+ if ( CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hcontact, 0) != ICON_OFFLINE)
+ db_set_b(hcontact, S_MOD, "Missed", 2);
hcontact = db_find_next(hcontact);
}
@@ -102,199 +71,133 @@ int CheckIfOnline(void) return 0;
}
-
-
INT_PTR CALLBACK MissedDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
POINT pt;
RECT rcinit,rcresized,rcb,rcd;
HWND htemp;
- switch(msg){
-
- case WM_INITDIALOG:
- TranslateDialogDefault(hdlg);
-
- htemp=GetDlgItem(hdlg,IDC_CONTACTS);
- GetWindowRect(htemp,&rcinit);
- SetWindowPos(htemp,NULL,0,0,rcinit.right-rcinit.left,mcs.count*(rcinit.bottom-rcinit.top)/2,SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
- GetWindowRect(htemp,&rcresized);
-
- htemp=GetDlgItem(hdlg,IDOK);
- GetWindowRect(htemp,&rcb);
- pt.x=rcb.left;
- pt.y=rcb.top;
-
- ScreenToClient(hdlg,&pt);
- MoveWindow(htemp,pt.x,pt.y+(rcresized.bottom-rcinit.bottom),(rcb.right-rcb.left),(rcb.bottom-rcb.top),FALSE);
- GetWindowRect(hdlg,&rcd);
- SetWindowPos(hdlg,NULL,0,0,rcd.right-rcd.left,rcd.bottom-rcd.top+(rcresized.bottom-rcinit.bottom),SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
-
- SetDlgItemText(hdlg,IDC_CONTACTS,(LPCSTR)lparam);
- ShowWindow(hdlg,SW_SHOWNOACTIVATE);
- break;
-
- case WM_CLOSE:
- EndDialog(hdlg,0);
- break;
-
- case WM_COMMAND:
- if(LOWORD(wparam)==IDOK)
- SendMessage(hdlg,WM_CLOSE,0,0);
- break;
+ switch(msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hdlg);
+
+ htemp = GetDlgItem(hdlg, IDC_CONTACTS);
+ GetWindowRect(htemp, &rcinit);
+ SetWindowPos(htemp,NULL,0,0,rcinit.right-rcinit.left,mcs.count*(rcinit.bottom-rcinit.top)/2,SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
+ GetWindowRect(htemp, &rcresized);
+
+ htemp = GetDlgItem(hdlg,IDOK);
+ GetWindowRect(htemp, &rcb);
+ pt.x = rcb.left;
+ pt.y = rcb.top;
+
+ ScreenToClient(hdlg, &pt);
+ MoveWindow(htemp,pt.x,pt.y+(rcresized.bottom-rcinit.bottom),(rcb.right-rcb.left),(rcb.bottom-rcb.top),FALSE);
+ GetWindowRect(hdlg, &rcd);
+ SetWindowPos(hdlg,NULL,0,0,rcd.right-rcd.left,rcd.bottom-rcd.top+(rcresized.bottom-rcinit.bottom),SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
+
+ SetDlgItemText(hdlg, IDC_CONTACTS, (LPCTSTR)lparam);
+ ShowWindow(hdlg, SW_SHOWNOACTIVATE);
+ break;
+
+ case WM_CLOSE:
+ EndDialog(hdlg, 0);
+ break;
+
+ case WM_COMMAND:
+ if (LOWORD(wparam) == IDOK)
+ SendMessage(hdlg, WM_CLOSE, 0, 0);
+ break;
}
return 0;
}
-
-
-
int ShowMissed(void)
{
- int loop=0;
- char sztemp[1024]="",szcount[7];
-
- if (!mcs.count) return 0;
-
- for (;loop<mcs.count;loop++)
- {
- strcat(sztemp,(const char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,mcs.wpcontact[loop],0));
- if(DBGetContactSettingByte(NULL,S_MOD,"MissedOnes_Count",0))
- {
- wsprintf(szcount," [%i]",mcs.times[loop]);
- strcat(sztemp,szcount);
- }
-
- strcat(sztemp,"\n");
- }
-
- CreateDialogParam(hInstance,MAKEINTRESOURCE(IDD_MISSED),NULL,MissedDlgProc,(LPARAM)&sztemp[0]);
-
- return 0;
-}
-
-/*
-
-int LogStatus(WPARAM wparam,LPARAM lparam)
-{
- DBCONTACTWRITESETTING *cws;
- WPARAM wpvar;
-
- cws=(DBCONTACTWRITESETTING *)lparam;
-
- if(strcmp(cws->szSetting,"Status") || (strcmp(cws->szModule,"ICQ") && strcmp(cws->szModule,"MSN")) || (HANDLE)wparam==NULL) return 0;
-
- if(CallService(MS_IGNORE_ISIGNORED,wparam,IGNOREEVENT_USERONLINE))
+ if (!mcs.count)
return 0;
- if(cws->value.wVal==ID_STATUS_OFFLINE)
- {
- if(DBGetContactSettingByte((HANDLE)wparam,S_MOD,"Missed",0)==1)
- {
- mcs.times[mcs.count]++;
- mcs.wpcontact[mcs.count++]=wparam;
- DBWriteContactSettingByte((HANDLE)wparam,S_MOD,"Missed",0);
+ TCHAR sztemp[1024], szcount[7];
+ for (int loop=0; loop < mcs.count; loop++) {
+ _tcscat(sztemp, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, mcs.wpcontact[loop], GCDNF_TCHAR));
+ if ( db_get_b(NULL, S_MOD, "MissedOnes_Count", 0)) {
+ wsprintf(szcount, _T(" [%i]"), mcs.times[loop]);
+ _tcscat(sztemp, szcount);
}
- else if(DBGetContactSettingByte((HANDLE)wparam,S_MOD,"Missed",0)==3)
- mcs.times[HIWORD(IsUserMissed(wparam))]++;
-
- return 0;
+ _tcscat(sztemp, _T("\n"));
}
- wpvar=IsUserMissed(wparam);
- if(LOWORD(wpvar))
- DBWriteContactSettingByte((HANDLE)wparam,S_MOD,"Missed",3);
-
- else
- DBWriteContactSettingByte((HANDLE)wparam,S_MOD,"Missed",1);
-
+ CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_MISSED), NULL, MissedDlgProc, (LPARAM)sztemp);
return 0;
}
-*/
-
int Test(WPARAM wparam,LPARAM lparam)
{
- if(lparam<ICON_OFFLINE || lparam>ICON_INVIS)
+ if (lparam < ICON_OFFLINE || lparam > ICON_INVIS)
return 0;
- if(CallService(MS_IGNORE_ISIGNORED,wparam,IGNOREEVENT_USERONLINE))
+ if (CallService(MS_IGNORE_ISIGNORED,wparam,IGNOREEVENT_USERONLINE))
return 0;
- if(DBGetContactSettingByte((HANDLE)wparam,S_MOD,"Missed",0)==2)
+ if ( db_get_b((HANDLE)wparam,S_MOD,"Missed",0)==2)
return 0;
- switch(lparam){
-
- case ICON_OFFLINE:
- if(DBGetContactSettingByte((HANDLE)wparam,S_MOD,"Missed",0)==1)
- {
- WORD missed=IsUserMissed(wparam);
-
- if (!LOWORD(missed))
- {
- mcs.times[mcs.count]=1;
- mcs.wpcontact[mcs.count++]=wparam;
- }
- else
- mcs.times[HIWORD(missed)]++;
-
- DBWriteContactSettingByte((HANDLE)wparam,S_MOD,"Missed",0);
+ switch(lparam) {
+ case ICON_OFFLINE:
+ if ( db_get_b((HANDLE)wparam,S_MOD,"Missed",0) == 1) {
+ WORD missed = IsUserMissed(wparam);
+ if (!LOWORD(missed)) {
+ mcs.times[mcs.count]=1;
+ mcs.wpcontact[mcs.count++]=wparam;
}
- break;
-
- case ICON_ONLINE:
- case ICON_AWAY:
- case ICON_NA:
- case ICON_OCC:
- case ICON_DND:
- case ICON_FREE:
- case ICON_INVIS:
- DBWriteContactSettingByte((HANDLE)wparam,S_MOD,"Missed",1);
- break;
+ else mcs.times[HIWORD(missed)]++;
+
+ db_set_b((HANDLE)wparam,S_MOD,"Missed",0);
+ }
+ break;
+
+ case ICON_ONLINE:
+ case ICON_AWAY:
+ case ICON_NA:
+ case ICON_OCC:
+ case ICON_DND:
+ case ICON_FREE:
+ case ICON_INVIS:
+ db_set_b((HANDLE)wparam,S_MOD,"Missed",1);
+ break;
}
return 0;
}
-
-
int ModeChange_mo(WPARAM wparam,LPARAM lparam)
{
- ACKDATA *ack;
- int isetting=0;
-
- ack=(ACKDATA *)lparam;
-
- if(ack->type!=ACKTYPE_STATUS || ack->result!=ACKRESULT_SUCCESS || ack->hContact!=NULL) return 0;
-
- isetting=CallProtoService(ack->szModule,PS_GETSTATUS,0,0);
-
- switch(isetting){
+ ACKDATA *ack = (ACKDATA *)lparam;
+ if (ack->type != ACKTYPE_STATUS || ack->result != ACKRESULT_SUCCESS || ack->hContact != NULL)
+ return 0;
- case ID_STATUS_AWAY:
- case ID_STATUS_DND:
- case ID_STATUS_NA:
- if(ehmissed==NULL)
- {
- ZeroMemory(&mcs,sizeof(mcs));
- CheckIfOnline();
- //ehmissed=HookEvent(ME_DB_CONTACT_SETTINGCHANGED,LogStatus);
- ehmissed=HookEvent(ME_CLIST_CONTACTICONCHANGED,Test);
- }
- break;
-
- default:
- if(ehmissed!=NULL)
- {
- UnhookEvent(ehmissed);
- ehmissed=NULL;
- ShowMissed();
- ResetMissed();
- }
- break;
+ int isetting = CallProtoService(ack->szModule, PS_GETSTATUS, 0, 0);
+ switch(isetting) {
+ case ID_STATUS_AWAY:
+ case ID_STATUS_DND:
+ case ID_STATUS_NA:
+ if (ehmissed == NULL) {
+ ZeroMemory(&mcs,sizeof(mcs));
+ CheckIfOnline();
+ ehmissed = HookEvent(ME_CLIST_CONTACTICONCHANGED, Test);
+ }
+ break;
+
+ default:
+ if (ehmissed != NULL) {
+ UnhookEvent(ehmissed);
+ ehmissed = NULL;
+ ShowMissed();
+ ResetMissed();
+ }
+ break;
}
return 0;
diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp index 61afc53664..b2d42e98eb 100644 --- a/plugins/SeenPlugin/src/options.cpp +++ b/plugins/SeenPlugin/src/options.cpp @@ -22,9 +22,8 @@ Revision : $Rev: 1570 $ Last change on : $Date: 2007-12-30 01:30:07 +0300 (ะั, 30 ะดะตะบ 2007) $
Last change by : $Author: y_b $
*/
-#include "seen.h"
-
+#include "seen.h"
extern HINSTANCE hInstance;
extern HANDLE ehuserinfo,hmenuitem,ehmissed_proto;
@@ -43,133 +42,139 @@ INT_PTR CALLBACK OptsPopUpsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara {
DBVARIANT dbv;
int i;
- char szstamp[256];
+ char szSetting[100];
+ TCHAR szstamp[256];
BOOL hasPopups;
- switch(msg)
- {
- case WM_INITDIALOG:{
- if (hasPopups = (ServiceExists(MS_POPUP_QUERY) != 0))
- hasPopups = CallService(MS_POPUP_QUERY,PUQS_GETSTATUS,0);
- TranslateDialogDefault(hdlg);
- ShowWindow(GetDlgItem(hdlg,IDC_MISSPOPUP),hasPopups?SW_HIDE:SW_SHOW);
- ShowWindow(GetDlgItem(hdlg,IDC_POPUPS),hasPopups?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hdlg,IDC_POPUPSTAMP),hasPopups?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hdlg,IDC_LABTEXT),hasPopups?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hdlg,IDC_LABTTITLE),hasPopups?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hdlg,IDC_POPUPSTAMPTEXT),hasPopups?SW_SHOW:SW_HIDE);
- CheckDlgButton(hdlg,IDC_POPUPS,DBGetContactSettingByte(NULL,S_MOD,"UsePopups",0)&hasPopups);
- EnableWindow(GetDlgItem(hdlg,IDC_POPUPS),hasPopups);
- hasPopups = IsDlgButtonChecked(hdlg,IDC_POPUPS);
- EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMP),hasPopups);
- EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMPTEXT),hasPopups);
- for (i=ID_STATUS_OFFLINE;i<=ID_STATUS_OUTTOLUNCH;i++) {
- DWORD sett;
- COLORREF back, text;
- sprintf(szstamp, "Col_%d",i-ID_STATUS_OFFLINE);
- sett = DBGetContactSettingDword(NULL,S_MOD,szstamp,StatusColors15bits[i-ID_STATUS_OFFLINE]);
- GetColorsFromDWord(&back, &text, sett);
- SendDlgItemMessage(hdlg,i,CPM_SETCOLOUR,0,back);
- SendDlgItemMessage(hdlg,i+20,CPM_SETCOLOUR,0,text);
- EnableWindow(GetDlgItem(hdlg,i),hasPopups);
- EnableWindow(GetDlgItem(hdlg,i+20),hasPopups);
- }
+ BYTE bchecked;
+
+ switch(msg) {
+ case WM_INITDIALOG:
+ if (hasPopups = (ServiceExists(MS_POPUP_QUERY)) != 0)
+ hasPopups = CallService(MS_POPUP_QUERY,PUQS_GETSTATUS,0);
+ TranslateDialogDefault(hdlg);
+ ShowWindow(GetDlgItem(hdlg,IDC_MISSPOPUP),hasPopups?SW_HIDE:SW_SHOW);
+ ShowWindow(GetDlgItem(hdlg,IDC_POPUPS),hasPopups?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg,IDC_POPUPSTAMP),hasPopups?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg,IDC_LABTEXT),hasPopups?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg,IDC_LABTTITLE),hasPopups?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg,IDC_POPUPSTAMPTEXT),hasPopups?SW_SHOW:SW_HIDE);
+ CheckDlgButton(hdlg,IDC_POPUPS,db_get_b(NULL,S_MOD,"UsePopups",0)&hasPopups);
+ EnableWindow(GetDlgItem(hdlg,IDC_POPUPS),hasPopups);
+ hasPopups = IsDlgButtonChecked(hdlg,IDC_POPUPS);
+ EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMP),hasPopups);
+ EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMPTEXT),hasPopups);
+ for (i=ID_STATUS_OFFLINE;i<=ID_STATUS_OUTTOLUNCH;i++) {
+ DWORD sett;
+ COLORREF back, text;
+ sprintf(szSetting, "Col_%d",i-ID_STATUS_OFFLINE);
+ sett = db_get_dw(NULL, S_MOD, szSetting, StatusColors15bits[i-ID_STATUS_OFFLINE]);
+ GetColorsFromDWord(&back, &text, sett);
+ SendDlgItemMessage(hdlg, i, CPM_SETCOLOUR, 0, back);
+ SendDlgItemMessage(hdlg, i+20, CPM_SETCOLOUR, 0, text);
+ EnableWindow( GetDlgItem(hdlg,i), hasPopups);
+ EnableWindow( GetDlgItem(hdlg,i+20), hasPopups);
+ }
- SetDlgItemText(hdlg,IDC_POPUPSTAMP,!DBGetContactSetting(NULL,S_MOD,"PopupStamp",&dbv)?dbv.pszVal:DEFAULT_POPUPSTAMP);
- DBFreeVariant(&dbv);
- SetDlgItemText(hdlg,IDC_POPUPSTAMPTEXT,!DBGetContactSetting(NULL,S_MOD,"PopupStampText",&dbv)?dbv.pszVal:DEFAULT_POPUPSTAMPTEXT);
- DBFreeVariant(&dbv);
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "PopupStamp", &dbv)) {
+ SetDlgItemText(hdlg, IDC_POPUPSTAMP, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else SetDlgItemText(hdlg, IDC_POPUPSTAMP, DEFAULT_POPUPSTAMP);
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "PopupStampText", &dbv)) {
+ SetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, dbv.ptszVal);
+ db_free(&dbv);
}
- break; //case WM_INITDIALOG
- case WM_COMMAND:
- if ((HIWORD(wparam)==BN_CLICKED || HIWORD(wparam)==EN_CHANGE) && GetFocus()==(HWND)lparam)
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- else if (HIWORD(wparam)==CPN_COLOURCHANGED){
- WORD idText, idBack;
- POPUPDATAEX ppd = {0};
- DBVARIANT dbv = {0};
- DWORD temp;
- if (LOWORD(wparam)>ID_STATUS_OUTTOLUNCH){ // we have clicked a text color
- idText = wparam; idBack = wparam-20;
- } else {idText = wparam+20; idBack = wparam;}
- ppd.colorBack = SendDlgItemMessage(hdlg,idBack,CPM_GETCOLOUR,0,0);
- ppd.colorText = SendDlgItemMessage(hdlg,idText,CPM_GETCOLOUR,0,0);
- temp = GetDWordFromColors(ppd.colorBack,ppd.colorText);
- GetColorsFromDWord(&ppd.colorBack,&ppd.colorText,temp);
- SendDlgItemMessage(hdlg,idBack,CPM_SETCOLOUR,0,ppd.colorBack);
- SendDlgItemMessage(hdlg,idText,CPM_SETCOLOUR,0,ppd.colorText);
- ppd.lchIcon = LoadSkinnedProtoIcon(NULL, idBack);
- GetDlgItemText(hdlg,IDC_POPUPSTAMP,szstamp,255);
- strncpy(ppd.lpzContactName,ParseString(szstamp,NULL,0),MAX_CONTACTNAME);
- GetDlgItemText(hdlg,IDC_POPUPSTAMPTEXT,szstamp,255);
- strncpy(ppd.lpzText,ParseString(szstamp,NULL,0),MAX_SECONDLINE);
- CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0);
-
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- }
- if(HIWORD(wparam)==BN_CLICKED)
- {
- switch(LOWORD(wparam)) {
- case IDC_POPUPS:
- hasPopups = IsDlgButtonChecked(hdlg,IDC_POPUPS);
- EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMP),hasPopups);
- EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMPTEXT),hasPopups);
- for (i=ID_STATUS_OFFLINE;i<=ID_STATUS_OUTTOLUNCH;i++) {
- EnableWindow(GetDlgItem(hdlg,i),hasPopups);
- EnableWindow(GetDlgItem(hdlg,i+20),hasPopups);
- }
- break;
- case IDC_DEFAULTCOL:
- for (i=ID_STATUS_OFFLINE;i<=ID_STATUS_OUTTOLUNCH;i++) {
- DWORD sett;
- COLORREF back, text;
- sprintf(szstamp, "Col_%d",i-ID_STATUS_OFFLINE);
- sett = StatusColors15bits[i-ID_STATUS_OFFLINE];
- GetColorsFromDWord(&back, &text, sett);
- SendDlgItemMessage(hdlg,i,CPM_SETCOLOUR,0,back);
- SendDlgItemMessage(hdlg,i+20,CPM_SETCOLOUR,0,text);
- }
- break;
+ else SetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, DEFAULT_POPUPSTAMPTEXT);
+ break;
+
+ case WM_COMMAND:
+ if (( HIWORD(wparam) == BN_CLICKED || HIWORD(wparam) == EN_CHANGE) && GetFocus() == (HWND)lparam)
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ else if (HIWORD(wparam) == CPN_COLOURCHANGED) {
+ WORD idText, idBack;
+ POPUPDATAT ppd = {0};
+ DBVARIANT dbv = {0};
+ DWORD temp;
+ if (LOWORD(wparam) > ID_STATUS_OUTTOLUNCH) // we have clicked a text color
+ idText = wparam, idBack = wparam-20;
+ else
+ idText = wparam+20, idBack = wparam;
+
+ ppd.colorBack = SendDlgItemMessage(hdlg,idBack,CPM_GETCOLOUR,0,0);
+ ppd.colorText = SendDlgItemMessage(hdlg,idText,CPM_GETCOLOUR,0,0);
+ temp = GetDWordFromColors(ppd.colorBack,ppd.colorText);
+ GetColorsFromDWord(&ppd.colorBack,&ppd.colorText,temp);
+ SendDlgItemMessage(hdlg,idBack,CPM_SETCOLOUR,0,ppd.colorBack);
+ SendDlgItemMessage(hdlg,idText,CPM_SETCOLOUR,0,ppd.colorText);
+ ppd.lchIcon = LoadSkinnedProtoIcon(NULL, idBack);
+
+ GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, SIZEOF(szstamp));
+ _tcsncpy(ppd.lptzContactName, ParseString(szstamp,NULL,0), MAX_CONTACTNAME);
+
+ GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, SIZEOF(szstamp));
+ _tcsncpy(ppd.lptzText, ParseString(szstamp,NULL,0), MAX_SECONDLINE);
+
+ PUAddPopUpT(&ppd);
+ SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
+ }
+
+ if (HIWORD(wparam) == BN_CLICKED) {
+ switch(LOWORD(wparam)) {
+ case IDC_POPUPS:
+ hasPopups = IsDlgButtonChecked(hdlg,IDC_POPUPS);
+ EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMP),hasPopups);
+ EnableWindow(GetDlgItem(hdlg,IDC_POPUPSTAMPTEXT),hasPopups);
+ for (i=ID_STATUS_OFFLINE;i<=ID_STATUS_OUTTOLUNCH;i++) {
+ EnableWindow(GetDlgItem(hdlg,i),hasPopups);
+ EnableWindow(GetDlgItem(hdlg,i+20),hasPopups);
+ }
+ break;
+ case IDC_DEFAULTCOL:
+ for (i=ID_STATUS_OFFLINE;i<=ID_STATUS_OUTTOLUNCH;i++) {
+ DWORD sett = StatusColors15bits[i-ID_STATUS_OFFLINE];
+ COLORREF back, text;
+ GetColorsFromDWord(&back, &text, sett);
+ SendDlgItemMessage(hdlg, i, CPM_SETCOLOUR, 0, back);
+ SendDlgItemMessage(hdlg, i+20, CPM_SETCOLOUR, 0, text);
}
+ break;
}
- break; //case WM_COMMAND
-
- case WM_NOTIFY:
- switch(((LPNMHDR)lparam)->idFrom)
- {
- case 0:
- switch (((LPNMHDR)lparam)->code)
- {
- BYTE checkValue;
-
- case PSN_APPLY:
- GetDlgItemText(hdlg,IDC_POPUPSTAMP,szstamp,256);
- DBWriteContactSettingString(NULL,S_MOD,"PopupStamp",szstamp);
- GetDlgItemText(hdlg,IDC_POPUPSTAMPTEXT,szstamp,256);
- DBWriteContactSettingString(NULL,S_MOD,"PopupStampText",szstamp);
-
- checkValue = (BYTE)IsDlgButtonChecked(hdlg,IDC_POPUPS);
- if (DBGetContactSettingByte(NULL,S_MOD,"UsePopups",0) != checkValue) {
- DBWriteContactSettingByte(NULL,S_MOD,"UsePopups",checkValue);
- }
- for (i=ID_STATUS_OFFLINE;i<=ID_STATUS_OUTTOLUNCH;i++) {
- DWORD sett;
- COLORREF back=0, text=0;
- sprintf(szstamp, "Col_%d",i-ID_STATUS_OFFLINE);
- back = SendDlgItemMessage(hdlg,i,CPM_GETCOLOUR,0,0);
- text = SendDlgItemMessage(hdlg,i+20,CPM_GETCOLOUR,0,0);
- sett=GetDWordFromColors(back,text);
- if (sett!=StatusColors15bits[i-ID_STATUS_OFFLINE])
- DBWriteContactSettingDword(NULL,S_MOD,szstamp,sett);
- else DBDeleteContactSetting(NULL,S_MOD,szstamp);
- }
-
- break; //case PSN_APPLY
- }
- break; //case 0
+ }
+ break; //case WM_COMMAND
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lparam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lparam)->code) {
+ case PSN_APPLY:
+ GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, SIZEOF(szstamp));
+ db_set_ts(NULL, S_MOD, "PopupStamp", szstamp);
+
+ GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, SIZEOF(szstamp));
+ db_set_ts(NULL, S_MOD, "PopupStampText", szstamp);
+
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_POPUPS);
+ if ( db_get_b(NULL,S_MOD,"UsePopups",0) != bchecked)
+ db_set_b(NULL, S_MOD, "UsePopups", bchecked);
+
+ for (i=ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ DWORD sett;
+ COLORREF back=0, text=0;
+ sprintf(szSetting, "Col_%d", i-ID_STATUS_OFFLINE);
+ back = SendDlgItemMessage(hdlg, i, CPM_GETCOLOUR, 0, 0);
+ text = SendDlgItemMessage(hdlg, i+20, CPM_GETCOLOUR, 0, 0);
+ sett = GetDWordFromColors(back, text);
+ if (sett != StatusColors15bits[i-ID_STATUS_OFFLINE])
+ DBWriteContactSettingDword(NULL, S_MOD, szSetting, sett);
+ else
+ DBDeleteContactSetting(NULL, S_MOD, szSetting);
+ }
+ break; //case PSN_APPLY
}
- break;//case WM_NOTIFY
-
+ break; //case 0
+ }
+ break;//case WM_NOTIFY
}
return 0;
@@ -178,287 +183,272 @@ INT_PTR CALLBACK OptsPopUpsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
DBVARIANT dbv;
- char szstamp[256];
- BYTE bchecked=0;
- WPARAM wpsend=0;
-
- switch(msg)
- {
- case WM_INITDIALOG:{
- TranslateDialogDefault(hdlg);
-
- CheckDlgButton(hdlg,IDC_MENUITEM,DBGetContactSettingByte(NULL,S_MOD,"MenuItem",1));
- CheckDlgButton(hdlg,IDC_USERINFO,DBGetContactSettingByte(NULL,S_MOD,"UserinfoTab",1));
- CheckDlgButton(hdlg,IDC_FILE,DBGetContactSettingByte(NULL,S_MOD,"FileOutput",0));
- CheckDlgButton(hdlg,IDC_HISTORY,DBGetContactSettingByte(NULL,S_MOD,"KeepHistory",0));
- CheckDlgButton(hdlg,IDC_IGNOREOFFLINE,DBGetContactSettingByte(NULL,S_MOD,"IgnoreOffline",1));
- CheckDlgButton(hdlg,IDC_MISSEDONES,DBGetContactSettingByte(NULL,S_MOD,"MissedOnes",0));
- CheckDlgButton(hdlg,IDC_SHOWICON,DBGetContactSettingByte(NULL,S_MOD,"ShowIcon",1));
- CheckDlgButton(hdlg,IDC_COUNT,DBGetContactSettingByte(NULL,S_MOD,"MissedOnes_Count",0));
- CheckDlgButton(hdlg,IDC_IDLESUPPORT,DBGetContactSettingByte(NULL,S_MOD,"IdleSupport",1));
-
- EnableWindow(GetDlgItem(hdlg,IDC_MENUSTAMP),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
- EnableWindow(GetDlgItem(hdlg,IDC_SHOWICON),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
- EnableWindow(GetDlgItem(hdlg,IDC_USERSTAMP),IsDlgButtonChecked(hdlg,IDC_USERINFO));
- EnableWindow(GetDlgItem(hdlg,IDC_FILESTAMP),IsDlgButtonChecked(hdlg,IDC_FILE));
- EnableWindow(GetDlgItem(hdlg,IDC_FILENAME),IsDlgButtonChecked(hdlg,IDC_FILE));
- EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSIZE),IsDlgButtonChecked(hdlg,IDC_HISTORY));
- EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSTAMP),IsDlgButtonChecked(hdlg,IDC_HISTORY));
- EnableWindow(GetDlgItem(hdlg,IDC_COUNT),IsDlgButtonChecked(hdlg,IDC_MISSEDONES));
-
- SetDlgItemText(hdlg,IDC_MENUSTAMP,!DBGetContactSetting(NULL,S_MOD,"MenuStamp",&dbv)?dbv.pszVal:DEFAULT_MENUSTAMP);
- DBFreeVariant(&dbv);
- SetDlgItemText(hdlg,IDC_USERSTAMP,!DBGetContactSetting(NULL,S_MOD,"UserStamp",&dbv)?dbv.pszVal:DEFAULT_USERSTAMP);
- DBFreeVariant(&dbv);
- SetDlgItemText(hdlg,IDC_FILESTAMP,!DBGetContactSetting(NULL,S_MOD,"FileStamp",&dbv)?dbv.pszVal:DEFAULT_FILESTAMP);
- DBFreeVariant(&dbv);
- SetDlgItemText(hdlg,IDC_FILENAME,!DBGetContactSetting(NULL,S_MOD,"FileName",&dbv)?dbv.pszVal:DEFAULT_FILENAME);
- DBFreeVariant(&dbv);
- SetDlgItemInt(hdlg,IDC_HISTORYSIZE,DBGetContactSettingWord(NULL,S_MOD,"HistoryMax",10-1)-1,FALSE);
- SetDlgItemText(hdlg,IDC_HISTORYSTAMP,!DBGetContactSetting(NULL,S_MOD,"HistoryStamp",&dbv)?dbv.pszVal:DEFAULT_HISTORYSTAMP);
- DBFreeVariant(&dbv);
-
- // load protocol list
- SetWindowLongPtr(GetDlgItem(hdlg,IDC_PROTOCOLLIST),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hdlg,IDC_PROTOCOLLIST),GWL_STYLE)|TVS_CHECKBOXES);
- {
- TVINSERTSTRUCT tvis;
- int numberOfProtocols,i;
- PROTOACCOUNT **protos;
- char *protoName;
- char *protoLabel;
-
- tvis.hParent=NULL;
- tvis.hInsertAfter=TVI_LAST;
- tvis.item.mask=TVIF_TEXT | TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
-
- ProtoEnumAccounts(&numberOfProtocols, &protos);
- for (i=0; i<numberOfProtocols; i++) {
- if(CallProtoService(protos[i]->szModuleName,PS_GETCAPS,PFLAGNUM_2,0)==0)
- continue;
- protoName = (char *)malloc(strlen(protos[i]->szModuleName)+1);
- strcpy(protoName,protos[i]->szModuleName);
-//debug(protoName);
- protoLabel = (char *)malloc(MAXMODULELABELLENGTH+1);
- CallProtoService(protoName,PS_GETNAME,MAXMODULELABELLENGTH,(LPARAM)protoLabel);
-//debug(protoLabel);
- tvis.item.pszText = protoLabel;
- tvis.item.lParam = (LPARAM)protoName;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(IsWatchedProtocol(protoName)+1);
- TreeView_InsertItem(GetDlgItem(hdlg,IDC_PROTOCOLLIST),&tvis);
- free(protoLabel);
+ TCHAR szstamp[256];
+ BYTE bchecked;
+
+ switch(msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hdlg);
+
+ CheckDlgButton(hdlg,IDC_MENUITEM,db_get_b(NULL,S_MOD,"MenuItem",1));
+ CheckDlgButton(hdlg,IDC_USERINFO,db_get_b(NULL,S_MOD,"UserinfoTab",1));
+ CheckDlgButton(hdlg,IDC_FILE,db_get_b(NULL,S_MOD,"FileOutput",0));
+ CheckDlgButton(hdlg,IDC_HISTORY,db_get_b(NULL,S_MOD,"KeepHistory",0));
+ CheckDlgButton(hdlg,IDC_IGNOREOFFLINE,db_get_b(NULL,S_MOD,"IgnoreOffline",1));
+ CheckDlgButton(hdlg,IDC_MISSEDONES,db_get_b(NULL,S_MOD,"MissedOnes",0));
+ CheckDlgButton(hdlg,IDC_SHOWICON,db_get_b(NULL,S_MOD,"ShowIcon",1));
+ CheckDlgButton(hdlg,IDC_COUNT,db_get_b(NULL,S_MOD,"MissedOnes_Count",0));
+ CheckDlgButton(hdlg,IDC_IDLESUPPORT,db_get_b(NULL,S_MOD,"IdleSupport",1));
+
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUSTAMP),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
+ EnableWindow(GetDlgItem(hdlg,IDC_SHOWICON),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
+ EnableWindow(GetDlgItem(hdlg,IDC_USERSTAMP),IsDlgButtonChecked(hdlg,IDC_USERINFO));
+ EnableWindow(GetDlgItem(hdlg,IDC_FILESTAMP),IsDlgButtonChecked(hdlg,IDC_FILE));
+ EnableWindow(GetDlgItem(hdlg,IDC_FILENAME),IsDlgButtonChecked(hdlg,IDC_FILE));
+ EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSIZE),IsDlgButtonChecked(hdlg,IDC_HISTORY));
+ EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSTAMP),IsDlgButtonChecked(hdlg,IDC_HISTORY));
+ EnableWindow(GetDlgItem(hdlg,IDC_COUNT),IsDlgButtonChecked(hdlg,IDC_MISSEDONES));
+
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "MenuStamp", &dbv)) {
+ SetDlgItemText(hdlg, IDC_MENUSTAMP, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else SetDlgItemText(hdlg, IDC_MENUSTAMP, _T(DEFAULT_MENUSTAMP));
- }
- }
- }
- break; //case WM_INITDIALOG
-
- case WM_COMMAND:
- if ((HIWORD(wparam)==BN_CLICKED || HIWORD(wparam)==EN_CHANGE) && GetFocus()==(HWND)lparam)
- if (LOWORD(wparam)!=IDC_VARIABLES)SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
-
- if(HIWORD(wparam)==BN_CLICKED)
- {
- switch(LOWORD(wparam)) {
- case IDC_MENUITEM:
- EnableWindow(GetDlgItem(hdlg,IDC_MENUSTAMP),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
- EnableWindow(GetDlgItem(hdlg,IDC_SHOWICON),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
- break;
- case IDC_USERINFO:
- EnableWindow(GetDlgItem(hdlg,IDC_USERSTAMP),IsDlgButtonChecked(hdlg,IDC_USERINFO));
- break;
- case IDC_FILE:
- EnableWindow(GetDlgItem(hdlg,IDC_FILESTAMP),IsDlgButtonChecked(hdlg,IDC_FILE));
- EnableWindow(GetDlgItem(hdlg,IDC_FILENAME),IsDlgButtonChecked(hdlg,IDC_FILE));
- break;
- case IDC_HISTORY:
- EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSTAMP),IsDlgButtonChecked(hdlg,IDC_HISTORY));
- EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSIZE),IsDlgButtonChecked(hdlg,IDC_HISTORY));
- break;
- case IDC_MISSEDONES:
- EnableWindow(GetDlgItem(hdlg,IDC_COUNT),IsDlgButtonChecked(hdlg,IDC_MISSEDONES));
- break;
- }
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "UserStamp", &dbv)) {
+ SetDlgItemText(hdlg, IDC_USERSTAMP, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else SetDlgItemText(hdlg, IDC_USERSTAMP, DEFAULT_USERSTAMP);
+
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "FileStamp", &dbv)) {
+ SetDlgItemText(hdlg, IDC_FILESTAMP, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else SetDlgItemText(hdlg, IDC_FILESTAMP, _T(DEFAULT_FILESTAMP));
+
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "FileName", &dbv)) {
+ SetDlgItemText(hdlg, IDC_FILENAME, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else SetDlgItemText(hdlg, IDC_FILENAME, _T(DEFAULT_FILENAME));
+
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "HistoryStamp", &dbv)) {
+ SetDlgItemText(hdlg, IDC_HISTORYSTAMP, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else SetDlgItemText(hdlg, IDC_HISTORYSTAMP, _T(DEFAULT_HISTORYSTAMP));
+
+ SetDlgItemInt(hdlg,IDC_HISTORYSIZE,db_get_w(NULL,S_MOD,"HistoryMax",10-1)-1,FALSE);
+
+ // load protocol list
+ SetWindowLongPtr(GetDlgItem(hdlg,IDC_PROTOCOLLIST),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hdlg,IDC_PROTOCOLLIST),GWL_STYLE)|TVS_CHECKBOXES);
+ {
+ TVINSERTSTRUCT tvis;
+ tvis.hParent = NULL;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
+ tvis.item.stateMask = TVIS_STATEIMAGEMASK;
+
+ PROTOACCOUNT **protos;
+ int numberOfProtocols;
+ ProtoEnumAccounts(&numberOfProtocols, &protos);
+
+ for (int i=0; i < numberOfProtocols; i++) {
+ if ( CallProtoService(protos[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
+ continue;
+
+ tvis.item.pszText = protos[i]->tszAccountName;
+ tvis.item.lParam = (LPARAM)mir_strdup(protos[i]->szModuleName);
+ tvis.item.state = INDEXTOSTATEIMAGEMASK( IsWatchedProtocol(protos[i]->szModuleName)+1);
+ TreeView_InsertItem( GetDlgItem(hdlg,IDC_PROTOCOLLIST), &tvis);
}
-
- if (LOWORD(wparam)==IDC_VARIABLES)
- {
- char szout[2048]="";
- wsprintf(szout,VARIABLE_LIST);
- MessageBox(NULL,szout,Translate("Last Seen Variables"),MB_OK|MB_TOPMOST);
+ }
+ break;
+
+ case WM_COMMAND:
+ if ((HIWORD(wparam) == BN_CLICKED || HIWORD(wparam) == EN_CHANGE) && GetFocus() == (HWND)lparam)
+ if (LOWORD(wparam) != IDC_VARIABLES)
+ SendMessage( GetParent(hdlg), PSM_CHANGED, 0, 0);
+
+ if (HIWORD(wparam) == BN_CLICKED) {
+ switch(LOWORD(wparam)) {
+ case IDC_MENUITEM:
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUSTAMP),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
+ EnableWindow(GetDlgItem(hdlg,IDC_SHOWICON),IsDlgButtonChecked(hdlg,IDC_MENUITEM));
+ break;
+ case IDC_USERINFO:
+ EnableWindow(GetDlgItem(hdlg,IDC_USERSTAMP),IsDlgButtonChecked(hdlg,IDC_USERINFO));
+ break;
+ case IDC_FILE:
+ EnableWindow(GetDlgItem(hdlg,IDC_FILESTAMP),IsDlgButtonChecked(hdlg,IDC_FILE));
+ EnableWindow(GetDlgItem(hdlg,IDC_FILENAME),IsDlgButtonChecked(hdlg,IDC_FILE));
+ break;
+ case IDC_HISTORY:
+ EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSTAMP),IsDlgButtonChecked(hdlg,IDC_HISTORY));
+ EnableWindow(GetDlgItem(hdlg,IDC_HISTORYSIZE),IsDlgButtonChecked(hdlg,IDC_HISTORY));
+ break;
+ case IDC_MISSEDONES:
+ EnableWindow(GetDlgItem(hdlg,IDC_COUNT),IsDlgButtonChecked(hdlg,IDC_MISSEDONES));
+ break;
}
+ }
- break; //case WM_COMMAND
-
- case WM_NOTIFY:
- switch(((LPNMHDR)lparam)->idFrom)
- {
- case 0:
- switch (((LPNMHDR)lparam)->code)
- {
- BYTE checkValue;
-
- case PSN_APPLY:
-
- GetDlgItemText(hdlg,IDC_MENUSTAMP,szstamp,256);
- DBWriteContactSettingString(NULL,S_MOD,"MenuStamp",szstamp);
-
- GetDlgItemText(hdlg,IDC_USERSTAMP,szstamp,256);
- DBWriteContactSettingString(NULL,S_MOD,"UserStamp",szstamp);
-
- GetDlgItemText(hdlg,IDC_FILESTAMP,szstamp,256);
- DBWriteContactSettingString(NULL,S_MOD,"FileStamp",szstamp);
-
- GetDlgItemText(hdlg,IDC_FILENAME,szstamp,256);
- DBWriteContactSettingString(NULL,S_MOD,"FileName",szstamp);
-
- GetDlgItemText(hdlg,IDC_HISTORYSTAMP,szstamp,256);
- DBWriteContactSettingString(NULL,S_MOD,"HistoryStamp",szstamp);
-
- DBWriteContactSettingWord(NULL,S_MOD,"HistoryMax",(WORD)(GetDlgItemInt(hdlg,IDC_HISTORYSIZE,NULL,FALSE)+1));
-
- checkValue = (BYTE)IsDlgButtonChecked(hdlg,IDC_MENUITEM);
- if (DBGetContactSettingByte(NULL,S_MOD,"MenuItem",1) != checkValue) {
- DBWriteContactSettingByte(NULL,S_MOD,"MenuItem",checkValue);
- if(hmenuitem==NULL && checkValue) {
- InitMenuitem();
- }
- }
-
- checkValue = (BYTE)IsDlgButtonChecked(hdlg,IDC_USERINFO);
- if (DBGetContactSettingByte(NULL,S_MOD,"UserinfoTab",1) != checkValue) {
- DBWriteContactSettingByte(NULL,S_MOD,"UserinfoTab",checkValue);
- if(checkValue) {
- ehuserinfo=HookEvent(ME_USERINFO_INITIALISE,UserinfoInit);
- } else {
- UnhookEvent(ehuserinfo);
- }
- }
-
- checkValue = (BYTE)IsDlgButtonChecked(hdlg,IDC_FILE);
- if (DBGetContactSettingByte(NULL,S_MOD,"FileOutput",0) != checkValue) {
- DBWriteContactSettingByte(NULL,S_MOD,"FileOutput",checkValue);
- if(checkValue) {
- InitFileOutput();
- }
- }
-
- checkValue = (BYTE)IsDlgButtonChecked(hdlg,IDC_HISTORY);
- if (DBGetContactSettingByte(NULL,S_MOD,"KeepHistory",0) != checkValue) {
- DBWriteContactSettingByte(NULL,S_MOD,"KeepHistory",checkValue);
- }
-
- checkValue = (BYTE)IsDlgButtonChecked(hdlg,IDC_IGNOREOFFLINE);
- if (DBGetContactSettingByte(NULL,S_MOD,"IgnoreOffline",1) != checkValue) {
- DBWriteContactSettingByte(NULL,S_MOD,"IgnoreOffline",checkValue);
- }
-
- checkValue = (BYTE)IsDlgButtonChecked(hdlg,IDC_MISSEDONES);
- if (DBGetContactSettingByte(NULL,S_MOD,"MissedOnes",0) != checkValue) {
- DBWriteContactSettingByte(NULL,S_MOD,"MissedOnes",checkValue);
- if(checkValue) {
- ehmissed_proto=HookEvent(ME_PROTO_ACK,ModeChange_mo);
- } else {
- UnhookEvent(ehmissed_proto);
- }
- }
-
- checkValue = (BYTE)IsDlgButtonChecked(hdlg,IDC_SHOWICON);
- if (DBGetContactSettingByte(NULL,S_MOD,"ShowIcon",1) != checkValue) {
- DBWriteContactSettingByte(NULL,S_MOD,"ShowIcon",checkValue);
- }
-
- checkValue = (BYTE)IsDlgButtonChecked(hdlg,IDC_COUNT);
- if (DBGetContactSettingByte(NULL,S_MOD,"MissedOnes_Count",0) != checkValue) {
- DBWriteContactSettingByte(NULL,S_MOD,"MissedOnes_Count",checkValue);
- }
-
- includeIdle = (BYTE)IsDlgButtonChecked(hdlg,IDC_IDLESUPPORT);
- if (DBGetContactSettingByte(NULL,S_MOD,"IdleSupport",1) != includeIdle) {
- DBWriteContactSettingByte(NULL,S_MOD,"IdleSupport",(BYTE)includeIdle);
- }
-
- // save protocol list
- {
- HWND hwndTreeView = GetDlgItem(hdlg,IDC_PROTOCOLLIST);
- HTREEITEM hItem;
- TVITEM tvItem;
- char *watchedProtocols;
- char *protocol;
- int size=1;
-
- watchedProtocols = (char *)malloc(sizeof(char));
- *watchedProtocols = '\0';
- hItem = TreeView_GetRoot(hwndTreeView);
- tvItem.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
- tvItem.stateMask = TVIS_STATEIMAGEMASK;
-
- while (hItem != NULL) {
- tvItem.hItem = hItem;
- TreeView_GetItem(hwndTreeView, &tvItem);
- protocol = (char*)tvItem.lParam;
- if ((BOOL)(tvItem.state >> 12) -1) {
- size = (size + (int)_tcslen(protocol)+2) * sizeof(char);
- watchedProtocols = (char *)realloc(watchedProtocols, size);
- strcat(watchedProtocols, protocol);
- strcat(watchedProtocols, " ");
- }
- hItem = TreeView_GetNextSibling(hwndTreeView, hItem);
- }
- DBWriteContactSettingString(NULL,S_MOD,"WatchedProtocols",watchedProtocols);
- free(watchedProtocols);
- }
-
- break; //case PSN_APPLY
- }
- break; //case 0
-
- case IDC_PROTOCOLLIST:
- switch (((LPNMHDR)lparam)->code)
- {
- case NM_CLICK:
- {
- HWND hTree=((LPNMHDR)lparam)->hwndFrom;
- TVHITTESTINFO hti;
- HTREEITEM hItem;
-
- hti.pt.x=(short)LOWORD(GetMessagePos());
- hti.pt.y=(short)HIWORD(GetMessagePos());
- ScreenToClient(hTree,&hti.pt);
- if(hItem=TreeView_HitTest(hTree,&hti))
- {
- if (hti.flags & TVHT_ONITEM)
- TreeView_SelectItem(hTree,hItem);
- if (hti.flags & TVHT_ONITEMSTATEICON)
- SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
-
- }
- }
- break;
+ if (LOWORD(wparam) == IDC_VARIABLES) {
+ char szout[2048];
+ wsprintfA(szout,VARIABLE_LIST);
+ MessageBoxA(NULL,szout,Translate("Last Seen Variables"),MB_OK|MB_TOPMOST);
+ }
+ break; //case WM_COMMAND
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lparam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lparam)->code) {
+ case PSN_APPLY:
+ GetDlgItemText(hdlg, IDC_MENUSTAMP, szstamp, SIZEOF(szstamp));
+ db_set_ts(NULL, S_MOD, "MenuStamp", szstamp);
+
+ GetDlgItemText(hdlg, IDC_USERSTAMP, szstamp, SIZEOF(szstamp));
+ db_set_ts(NULL, S_MOD, "UserStamp", szstamp);
+
+ GetDlgItemText(hdlg, IDC_FILESTAMP, szstamp, SIZEOF(szstamp));
+ db_set_ts(NULL, S_MOD, "FileStamp", szstamp);
+
+ GetDlgItemText(hdlg, IDC_FILENAME, szstamp, SIZEOF(szstamp));
+ db_set_ts(NULL, S_MOD, "FileName", szstamp);
+
+ GetDlgItemText(hdlg, IDC_HISTORYSTAMP, szstamp, SIZEOF(szstamp));
+ db_set_ts(NULL, S_MOD, "HistoryStamp", szstamp);
+
+ db_set_w(NULL, S_MOD, "HistoryMax",(WORD)(GetDlgItemInt(hdlg,IDC_HISTORYSIZE,NULL,FALSE)+1));
+
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_MENUITEM);
+ if ( db_get_b(NULL,S_MOD,"MenuItem",1) != bchecked) {
+ db_set_b(NULL,S_MOD,"MenuItem",bchecked);
+ if (hmenuitem == NULL && bchecked)
+ InitMenuitem();
+ }
+
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_USERINFO);
+ if ( db_get_b(NULL,S_MOD,"UserinfoTab",1) != bchecked) {
+ db_set_b(NULL,S_MOD,"UserinfoTab",bchecked);
+ if (bchecked)
+ ehuserinfo = HookEvent(ME_USERINFO_INITIALISE,UserinfoInit);
+ else
+ UnhookEvent(ehuserinfo);
+ }
+
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_FILE);
+ if ( db_get_b(NULL,S_MOD,"FileOutput",0) != bchecked) {
+ db_set_b(NULL,S_MOD,"FileOutput",bchecked);
+ if (bchecked)
+ InitFileOutput();
+ }
+
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_HISTORY);
+ if ( db_get_b(NULL,S_MOD,"KeepHistory",0) != bchecked)
+ db_set_b(NULL,S_MOD,"KeepHistory",bchecked);
+
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_IGNOREOFFLINE);
+ if ( db_get_b(NULL,S_MOD,"IgnoreOffline",1) != bchecked)
+ db_set_b(NULL,S_MOD,"IgnoreOffline",bchecked);
+
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_MISSEDONES);
+ if ( db_get_b(NULL,S_MOD,"MissedOnes",0) != bchecked) {
+ db_set_b(NULL,S_MOD,"MissedOnes",bchecked);
+ if (bchecked)
+ ehmissed_proto = HookEvent(ME_PROTO_ACK,ModeChange_mo);
+ else
+ UnhookEvent(ehmissed_proto);
+ }
+
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_SHOWICON);
+ if ( db_get_b(NULL,S_MOD,"ShowIcon",1) != bchecked)
+ db_set_b(NULL,S_MOD,"ShowIcon",bchecked);
+
+ bchecked = (BYTE)IsDlgButtonChecked(hdlg,IDC_COUNT);
+ if ( db_get_b(NULL,S_MOD,"MissedOnes_Count",0) != bchecked)
+ db_set_b(NULL,S_MOD,"MissedOnes_Count",bchecked);
+
+ includeIdle = (BYTE)IsDlgButtonChecked(hdlg,IDC_IDLESUPPORT);
+ if ( db_get_b(NULL,S_MOD,"IdleSupport",1) != includeIdle)
+ db_set_b(NULL,S_MOD,"IdleSupport",(BYTE)includeIdle);
+
+ // save protocol list
+ {
+ HWND hwndTreeView = GetDlgItem(hdlg,IDC_PROTOCOLLIST);
+ HTREEITEM hItem;
+ TVITEM tvItem;
+ char *watchedProtocols;
+ char *protocol;
+ int size=1;
+
+ watchedProtocols = (char *)malloc(sizeof(char));
+ *watchedProtocols = '\0';
+ hItem = TreeView_GetRoot(hwndTreeView);
+ tvItem.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
+ tvItem.stateMask = TVIS_STATEIMAGEMASK;
+
+ while (hItem != NULL) {
+ tvItem.hItem = hItem;
+ TreeView_GetItem(hwndTreeView, &tvItem);
+ protocol = (char*)tvItem.lParam;
+ if ((BOOL)(tvItem.state >> 12) -1) {
+ size += (int)strlen(protocol)+2;
+ watchedProtocols = (char *)realloc(watchedProtocols, size);
+ strcat(watchedProtocols, protocol);
+ strcat(watchedProtocols, " ");
+ }
+ hItem = TreeView_GetNextSibling(hwndTreeView, hItem);
}
- break; //case IDC_PROTOCOLLIST
+ db_set_s(NULL,S_MOD,"WatchedProtocols",watchedProtocols);
+ free(watchedProtocols);
+ }
+ break; //case PSN_APPLY
}
- break;//case WM_NOTIFY
-
- case WM_DESTROY:
- // free protocol list
- {
- HWND hwndTreeView = GetDlgItem(hdlg,IDC_PROTOCOLLIST);
- HTREEITEM hItem;
- TVITEM tvItem;
-
- hItem = TreeView_GetRoot(hwndTreeView);
- tvItem.mask = TVIF_HANDLE | TVIF_PARAM;
-
- while (hItem != NULL) {
- tvItem.hItem = hItem;
- TreeView_GetItem(hwndTreeView, &tvItem);
- free((void *)tvItem.lParam);
- hItem = TreeView_GetNextSibling(hwndTreeView, hItem);
+ break; //case 0
+
+ case IDC_PROTOCOLLIST:
+ switch (((LPNMHDR)lparam)->code) {
+ case NM_CLICK:
+ {
+ HWND hTree=((LPNMHDR)lparam)->hwndFrom;
+ HTREEITEM hItem;
+
+ TVHITTESTINFO hti;
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(hTree, &hti.pt);
+ if (hItem=TreeView_HitTest(hTree, &hti)) {
+ if (hti.flags & TVHT_ONITEM)
+ TreeView_SelectItem(hTree,hItem);
+ if (hti.flags & TVHT_ONITEMSTATEICON)
+ SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
+ }
}
+ break;
}
- break;
-
+ break; //case IDC_PROTOCOLLIST
+ }
+ break;//case WM_NOTIFY
+
+ case WM_DESTROY:
+ // free protocol list
+ {
+ HWND hwndTreeView = GetDlgItem(hdlg,IDC_PROTOCOLLIST);
+ HTREEITEM hItem = TreeView_GetRoot(hwndTreeView);
+ TVITEM tvItem;
+ tvItem.mask = TVIF_HANDLE | TVIF_PARAM;
+
+ while (hItem != NULL) {
+ tvItem.hItem = hItem;
+ TreeView_GetItem(hwndTreeView, &tvItem);
+ mir_free((void *)tvItem.lParam);
+ hItem = TreeView_GetNextSibling(hwndTreeView, hItem);
+ }
+ }
+ break;
}
return 0;
@@ -466,26 +456,24 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa int OptionsInit(WPARAM wparam,LPARAM lparam)
{
- OPTIONSDIALOGPAGE odp = { 0 };
-
- if(IsWinVerXPPlus()) {
- HMODULE hUxTheme = GetModuleHandle(_T("uxtheme.dll"));
+ if (IsWinVerXPPlus()) {
+ HMODULE hUxTheme = GetModuleHandle( _T("uxtheme.dll"));
if (hUxTheme)
pfnEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
}
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 100000000;
odp.hInstance = hInstance;
odp.flags = ODPF_BOLDGROUPS;
- odp.pszTemplate = MAKEINTRESOURCE(IDD_SETTINGS);
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_SETTINGS);
odp.pszGroup = LPGEN("Services");
odp.pszTitle = LPGEN("Last seen");
odp.pfnDlgProc = OptsSettingsDlgProc;
Options_AddPage(wparam,&odp);
- if (ServiceExists(MS_POPUP_ADDPOPUP)) {
- odp.pszTemplate = MAKEINTRESOURCE(IDD_POPUPS);
+ if ( ServiceExists(MS_POPUP_ADDPOPUP)) {
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPS);
odp.pszGroup = LPGEN("PopUps");
odp.pszTitle = LPGEN("Last seen");
odp.pfnDlgProc = OptsPopUpsDlgProc;
diff --git a/plugins/SeenPlugin/src/seen.h b/plugins/SeenPlugin/src/seen.h index 574126459d..fda47a609f 100644 --- a/plugins/SeenPlugin/src/seen.h +++ b/plugins/SeenPlugin/src/seen.h @@ -27,12 +27,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MIRANDA_VER 0x0A00
#define _CRT_SECURE_NO_WARNINGS
+#define _CRT_NON_CONFORMING_SWPRINTFS
#include <windows.h>
#include <win2k.h>
#include <commctrl.h>
+#include <malloc.h>
#include <stdio.h>
#include <string.h>
+#include <time.h>
#include "resource.h"
@@ -50,6 +53,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_protosvc.h>
#include <m_protocols.h>
#include <m_popup.h>
+#include <m_ignore.h>
#include "m_tipper.h"
@@ -66,7 +70,7 @@ WCHAR *any_to_Idle(HANDLE hContact, const char *module_name, const char *setting //#define UM_CHECKHOOKS (WM_USER+1)
-#define debug(a) MessageBox(NULL,a,"Debug",MB_OK)
+#define debug(a) MessageBox(NULL,a,_T("Debug"),MB_OK)
#define IDI_USERDETAILS 160
#define IDI_DOWNARROW 264
@@ -82,9 +86,9 @@ WCHAR *any_to_Idle(HANDLE hContact, const char *module_name, const char *setting #define ICON_INVIS 20
#define DEFAULT_MENUSTAMP "%d.%m.%Y - %H:%M [%s]"
-#define DEFAULT_POPUPSTAMP Translate("%n is %s (%u)")
-#define DEFAULT_POPUPSTAMPTEXT Translate("%i(%r)%bWas %o")
-#define DEFAULT_USERSTAMP Translate("Name:%t%N%bStatus:%t%s%bDay:%t%d.%m.%Y%bTime:%t%H:%M:%S%bPrevious Status:%t%o%b%b%P ID:%t%u%bExternal IP:%t%i%bInternal IP:%t%r%bClientID: %t%C%b%bStatus Message:%t%T")
+#define DEFAULT_POPUPSTAMP TranslateT("%n is %s (%u)")
+#define DEFAULT_POPUPSTAMPTEXT TranslateT("%i(%r)%bWas %o")
+#define DEFAULT_USERSTAMP TranslateT("Name:%t%N%bStatus:%t%s%bDay:%t%d.%m.%Y%bTime:%t%H:%M:%S%bPrevious Status:%t%o%b%b%P ID:%t%u%bExternal IP:%t%i%bInternal IP:%t%r%bClientID: %t%C%b%bStatus Message:%t%T")
#define DEFAULT_FILESTAMP "%d.%m.%Y %H:%M:%S%t%n%t%s%t%u%t%r | %i%t%N"
#define DEFAULT_FILENAME "logs\\%P.txt"
#define DEFAULT_HISTORYSTAMP "%d.%m.%Y - %H:%M [%s]"
@@ -103,7 +107,7 @@ typedef struct{ } MISSEDCONTACTS;
int IsWatchedProtocol(const char* szProto);
-char *ParseString(char *,HANDLE,BYTE);
+TCHAR *ParseString(TCHAR*, HANDLE, BYTE);
extern DWORD StatusColors15bits[];
void GetColorsFromDWord(LPCOLORREF First, LPCOLORREF Second, DWORD colDword);
DWORD GetDWordFromColors(COLORREF First, COLORREF Second);
diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp index 48d6523818..a40d83f043 100644 --- a/plugins/SeenPlugin/src/userinfo.cpp +++ b/plugins/SeenPlugin/src/userinfo.cpp @@ -38,57 +38,52 @@ extern DWORD dwmirver; BOOL CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg){
- case WM_SETCURSOR:
- SetCursor(LoadCursor(NULL,IDC_ARROW));
- return 1;
-
- default:
- break;
+ case WM_SETCURSOR:
+ SetCursor(LoadCursor(NULL,IDC_ARROW));
+ return 1;
}
return CallWindowProc(MainProc,hdlg,msg,wparam,lparam);
}
-
-
INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
- char *szout;
DBVARIANT dbv;
- switch(msg){
-
- case WM_INITDIALOG:
- MainProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hdlg,IDC_INFOTEXT),GWLP_WNDPROC,(LONG)EditProc);
- szout = _strdup(ParseString((!DBGetContactSetting(NULL,S_MOD,"UserStamp",&dbv)?dbv.pszVal:DEFAULT_USERSTAMP),(HANDLE)lparam,0));
- SetDlgItemText(hdlg,IDC_INFOTEXT,szout);
- if (!strcmp(szout,Translate("<unknown>")))
- EnableWindow(GetDlgItem(hdlg,IDC_INFOTEXT),FALSE);
- free(szout);
- DBFreeVariant(&dbv);
- break;
-
- case WM_COMMAND:
- if(HIWORD(wparam)==EN_SETFOCUS)
- SetFocus(GetParent(hdlg));
- break;
+ switch(msg) {
+ case WM_INITDIALOG:
+ MainProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hdlg,IDC_INFOTEXT),GWLP_WNDPROC,(LONG)EditProc);
+ {
+ TCHAR *szout;
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "UserStamp", &dbv)) {
+ szout = ParseString(dbv.ptszVal, (HANDLE)lparam, 0);
+ db_free(&dbv);
+ }
+ else szout = ParseString(DEFAULT_USERSTAMP, (HANDLE)lparam, 0);
+
+ SetDlgItemText(hdlg, IDC_INFOTEXT, szout);
+ if ( !lstrcmp(szout, TranslateT("<unknown>")))
+ EnableWindow( GetDlgItem(hdlg,IDC_INFOTEXT), FALSE);
+ }
+ break;
+
+ case WM_COMMAND:
+ if (HIWORD(wparam) == EN_SETFOCUS)
+ SetFocus( GetParent(hdlg));
+ break;
}
return 0;
}
-
-
int UserinfoInit(WPARAM wparam,LPARAM lparam)
{
- char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,lparam,0);
- if (IsWatchedProtocol(proto)) {
- OPTIONSDIALOGPAGE uip;
- ZeroMemory(&uip,sizeof(uip));
- uip.cbSize=sizeof(uip);
- uip.hInstance=hInstance;
- uip.pszTemplate=MAKEINTRESOURCE(IDD_USERINFO);
- uip.pszTitle="Last seen";
- uip.pfnDlgProc=UserinfoDlgProc;
+ char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, lparam, 0);
+ if ( IsWatchedProtocol(proto)) {
+ OPTIONSDIALOGPAGE uip = { sizeof(uip) };
+ uip.hInstance = hInstance;
+ uip.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO);
+ uip.pszTitle = "Last seen";
+ uip.pfnDlgProc = UserinfoDlgProc;
UserInfo_AddPage(wparam, &uip);
}
return 0;
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 5d64f0e7a9..c97c4eb793 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -23,9 +23,6 @@ Last change on : $Date: 2007-12-30 01:30:07 +0300 (ะั, 30 ะดะตะบ 2007) $ Last change by : $Author: y_b $
*/
#include "seen.h"
-#include <m_ignore.h>
-#include <time.h>
-
void FileWrite(HANDLE);
void HistoryWrite(HANDLE hcontact);
@@ -34,97 +31,82 @@ void ShowHistory(HANDLE hContact, BYTE isAlert); char * courProtoName = 0;
-//copied from ..\..\miranda32\protocols\protocols\protocols.c
-PROTOCOLDESCRIPTOR* Proto_IsProtocolLoaded(const char* szProto)
-{
- return (PROTOCOLDESCRIPTOR*) CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)szProto);
-}
-
-
/*
Returns true if the protocols is to be monitored
*/
int IsWatchedProtocol(const char* szProto)
{
- DBVARIANT dbv;
- char *szProtoPointer, *szWatched;
- int iProtoLen, iWatchedLen;
- int retval = 0;
- PROTOCOLDESCRIPTOR *pd;
-
if (szProto == NULL)
return 0;
- pd=Proto_IsProtocolLoaded(szProto);
- if (pd==NULL || pd->type!=PROTOTYPE_PROTOCOL || CallProtoService(pd->szName,PS_GETCAPS,PFLAGNUM_2,0)==0)
+ PROTOACCOUNT *pd = ProtoGetAccount(szProto);
+ if (pd == NULL || CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
return 0;
- iProtoLen = (int)_tcslen(szProto);
- if(DBGetContactSetting(NULL, S_MOD, "WatchedProtocols", &dbv))
+ int iProtoLen = (int)strlen(szProto);
+ char *szWatched;
+ DBVARIANT dbv;
+ if ( DBGetContactSettingString(NULL, S_MOD, "WatchedProtocols", &dbv))
szWatched = DEFAULT_WATCHEDPROTOCOLS;
- else
- szWatched = dbv.pszVal;
- iWatchedLen = (int)_tcslen(szWatched);
+ else {
+ szWatched = NEWSTR_ALLOCA(dbv.pszVal);
+ db_free(&dbv);
+ }
if (*szWatched == '\0')
- {
- retval=1; //empty string: all protocols are watched
- }
- else
- {
- char sTemp [MAXMODULELABELLENGTH+1]="";
- strcat(sTemp,szProto);
- strcat(sTemp," ");
- szProtoPointer = strstr(szWatched, sTemp);
- if (szProtoPointer == NULL)
- retval=0;
- else
- retval=1;
- }
+ return 1; //empty string: all protocols are watched
- DBFreeVariant(&dbv);
- return retval;
+ char sTemp[MAXMODULELABELLENGTH+1];
+ mir_snprintf(sTemp, SIZEOF(sTemp), "%s ", szProto);
+ return strstr(szWatched, sTemp) != NULL;
}
-BOOL isYahoo(char * protoname){
+BOOL isYahoo(char *protoname)
+{
if (protoname) {
char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (pszUniqueSetting){
- return (!strcmp(pszUniqueSetting,"yahoo_id"));
- } }
+ if (pszUniqueSetting)
+ return !strcmp(pszUniqueSetting, "yahoo_id");
+ }
return FALSE;
}
-BOOL isJabber(char * protoname){
+
+BOOL isJabber(char *protoname)
+{
if (protoname) {
char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (pszUniqueSetting){
- return (!strcmp(pszUniqueSetting,"jid"));
- } }
+ if (pszUniqueSetting)
+ return !strcmp(pszUniqueSetting, "jid");
+ }
return FALSE;
}
-BOOL isICQ(char * protoname){
+
+BOOL isICQ(char *protoname)
+{
if (protoname) {
char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (pszUniqueSetting){
- return (!strcmp(pszUniqueSetting,"UIN"));
- } }
+ if (pszUniqueSetting)
+ return !strcmp(pszUniqueSetting, "UIN");
+ }
return FALSE;
}
-BOOL isMSN(char * protoname){
+
+BOOL isMSN(char *protoname)
+{
if (protoname) {
char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (pszUniqueSetting){
- return (!strcmp(pszUniqueSetting,"e-mail"));
- } }
+ if (pszUniqueSetting)
+ return !strcmp(pszUniqueSetting, "e-mail");
+ }
return FALSE;
}
-DWORD isSeen(HANDLE hcontact, SYSTEMTIME *st){
- DWORD res = 0;
+DWORD isSeen(HANDLE hcontact, SYSTEMTIME *st)
+{
FILETIME ft;
ULONGLONG ll;
- res = DBGetContactSettingDword(hcontact,S_MOD,"seenTS",0);
- if (res){
+ DWORD res = db_get_dw(hcontact,S_MOD,"seenTS",0);
+ if (res) {
if (st) {
ll = UInt32x32To64(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL,res,0), 10000000) + NUM100NANOSEC;
ft.dwLowDateTime = (DWORD)ll;
@@ -132,316 +114,323 @@ DWORD isSeen(HANDLE hcontact, SYSTEMTIME *st){ FileTimeToSystemTime(&ft, st);
}
return res;
- } else {
- SYSTEMTIME lst;
- ZeroMemory(&lst,sizeof(lst));
- if (lst.wYear = DBGetContactSettingWord(hcontact,S_MOD,"Year",0)) {
- if (lst.wMonth = DBGetContactSettingWord(hcontact,S_MOD,"Month",0)) {
- if (lst.wDay = DBGetContactSettingWord(hcontact,S_MOD,"Day",0)) {
- lst.wDayOfWeek = DBGetContactSettingWord(hcontact,S_MOD,"WeekDay",0);
- lst.wHour = DBGetContactSettingWord(hcontact,S_MOD,"Hours",0);
- lst.wMinute = DBGetContactSettingWord(hcontact,S_MOD,"Minutes",0);
- lst.wSecond = DBGetContactSettingWord(hcontact,S_MOD,"Seconds",0);
- if (SystemTimeToFileTime(&lst,&ft)) {
- ll = ((LONGLONG)ft.dwHighDateTime<<32)|((LONGLONG)ft.dwLowDateTime);
- ll -= NUM100NANOSEC;
- ll /= 10000000;
- //perform LOCALTOTIMESTAMP
- res = (DWORD)ll - CallService(MS_DB_TIME_TIMESTAMPTOLOCAL,0,0);
- //nevel look for Year/Month/Day/Hour/Minute/Second again
- DBWriteContactSettingDword(hcontact,S_MOD,"seenTS",res);
- }
- } } }
- if (st) CopyMemory (st, &lst, sizeof (SYSTEMTIME));
}
+
+ SYSTEMTIME lst;
+ ZeroMemory(&lst,sizeof(lst));
+ if (lst.wYear = db_get_w(hcontact,S_MOD,"Year",0)) {
+ if (lst.wMonth = db_get_w(hcontact,S_MOD,"Month",0)) {
+ if (lst.wDay = db_get_w(hcontact,S_MOD,"Day",0)) {
+ lst.wDayOfWeek = db_get_w(hcontact,S_MOD,"WeekDay",0);
+ lst.wHour = db_get_w(hcontact,S_MOD,"Hours",0);
+ lst.wMinute = db_get_w(hcontact,S_MOD,"Minutes",0);
+ lst.wSecond = db_get_w(hcontact,S_MOD,"Seconds",0);
+ if (SystemTimeToFileTime(&lst,&ft)) {
+ ll = ((LONGLONG)ft.dwHighDateTime<<32)|((LONGLONG)ft.dwLowDateTime);
+ ll -= NUM100NANOSEC;
+ ll /= 10000000;
+ //perform LOCALTOTIMESTAMP
+ res = (DWORD)ll - CallService(MS_DB_TIME_TIMESTAMPTOLOCAL,0,0);
+ //nevel look for Year/Month/Day/Hour/Minute/Second again
+ DBWriteContactSettingDword(hcontact,S_MOD,"seenTS",res);
+ }
+ } } }
+
+ if (st)
+ CopyMemory (st, &lst, sizeof (SYSTEMTIME));
+
return res;
}
-char *ParseString(char *szstring,HANDLE hcontact,BYTE isfile)
+TCHAR *weekdays[] = { _T("Sunday"), _T("Monday"), _T("Tuesday"), _T("Wednesday"), _T("Thursday"), _T("Friday"), _T("Saturday") };
+TCHAR *wdays_short[] = { _T("Sun."), _T("Mon."), _T("Tue."), _T("Wed."), _T("Thu."), _T("Fri."), _T("Sat.") };
+TCHAR *monthnames[] = { _T("January"), _T("February"), _T("March"), _T("April"), _T("May"), _T("June"), _T("July"), _T("August"), _T("September"), _T("October"), _T("November"), _T("December") };
+TCHAR *mnames_short[] = { _T("Jan."), _T("Feb."), _T("Mar."), _T("Apr."), _T("May"), _T("Jun."), _T("Jul."), _T("Aug."), _T("Sep."), _T("Oct."), _T("Nov."), _T("Dec.") };
+
+TCHAR *ParseString(TCHAR *szstring, HANDLE hcontact, BYTE isfile)
{
#define MAXSIZE 1024
- static char sztemp[MAXSIZE+1];
- int sztemplen = 0;
- char szdbsetting[128]="";
- char *charPtr;
- UINT loop=0;
+ static TCHAR sztemp[MAXSIZE+1];
+ TCHAR szdbsetting[128];
+ TCHAR *charPtr;
int isetting=0;
DWORD dwsetting=0;
struct in_addr ia;
- char *weekdays[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
- char *wdays_short[]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};
- char *monthnames[]={"January","February","March","April","May","June","July","August","September","October","November","December"};
- char *mnames_short[]={"Jan.","Feb.","Mar.","Apr.","May","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec."};
- CONTACTINFO ci;
- BOOL wantempty;
- SYSTEMTIME st;
+ DBVARIANT dbv;
sztemp[0] = '\0';
- if (!isSeen(hcontact,&st)) {
- strcat(sztemp,Translate("<never seen>"));
+
+ SYSTEMTIME st;
+ if ( !isSeen(hcontact, &st)) {
+ _tcscat(sztemp, TranslateT("<never seen>"));
return sztemp;
}
- ci.cbSize=sizeof(CONTACTINFO);
- ci.hContact=hcontact;
- ci.szProto=hcontact?(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0):courProtoName;
- for (;loop<strlen(szstring);loop++)
- {
- if (sztemplen == MAXSIZE) break;
- if ((szstring[loop]!='%')&(szstring[loop]!='#'))
- {
- strncat(sztemp,szstring+loop,1);
- sztemplen++;
+ CONTACTINFO ci = { sizeof(CONTACTINFO) };
+ ci.hContact = hcontact;
+ ci.szProto = hcontact ? (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0) : courProtoName;
+
+ TCHAR *d = sztemp;
+ for (TCHAR *p = szstring; *p; p++) {
+ if (d >= sztemp + MAXSIZE)
+ break;
+
+ if (*p != '%' && *p !='#') {
+ *d++ = *p;
continue;
}
- else
- {
- wantempty = (szstring[loop]=='#');
- switch(szstring[++loop]) {
- case 'Y':
- if (!st.wYear) goto LBL_noData;
- sztemplen += mir_snprintf(sztemp+sztemplen,MAXSIZE-sztemplen,"%04i",st.wYear);
- break;
+ bool wantempty = *p =='#';
+ switch(*++p) {
+ case 'Y':
+ if (!st.wYear) goto LBL_noData;
+ d += _stprintf(d, _T("%04i"), st.wYear);
+ break;
- case 'y':
- if (!st.wYear) goto LBL_noData;
- wsprintf(szdbsetting,"%04i",st.wYear);
- sztemplen += mir_snprintf(sztemp+sztemplen,MAXSIZE-sztemplen,"%s",szdbsetting+2);
- break;
+ case 'y':
+ if (!st.wYear) goto LBL_noData;
+ d += _stprintf(d, _T("%02i"), st.wYear % 100);
+ break;
- case 'm':
- if (!(isetting=st.wMonth)) goto LBL_noData;
+ case 'm':
+ if (!(isetting=st.wMonth)) goto LBL_noData;
LBL_2DigNum:
- sztemplen += mir_snprintf(sztemp+sztemplen,MAXSIZE-sztemplen,"%02i",isetting);
- break;
+ d += _stprintf(d, _T("%02i"), isetting);
+ break;
- case 'd':
- if (isetting=st.wDay) goto LBL_2DigNum;
- else goto LBL_noData;
+ case 'd':
+ if (isetting = st.wDay) goto LBL_2DigNum;
+ else goto LBL_noData;
- case 'W':
- isetting=st.wDayOfWeek;
- if(isetting==-1){
+ case 'W':
+ isetting = st.wDayOfWeek;
+ if (isetting == -1){
LBL_noData:
- charPtr = wantempty?"":Translate("<unknown>");
- goto LBL_charPtr;
- }
- charPtr = Translate(weekdays[isetting]);
+ charPtr = wantempty ? _T("") : TranslateT("<unknown>");
+ goto LBL_charPtr;
+ }
+ charPtr = TranslateTS(weekdays[isetting]);
LBL_charPtr:
- sztemplen += mir_snprintf(sztemp+sztemplen,MAXSIZE-sztemplen,"%s",charPtr);
- break;
+ d += mir_sntprintf(d, MAXSIZE-(d-sztemp), _T("%s"), charPtr);
+ break;
- case 'w':
- isetting=st.wDayOfWeek;
- if(isetting==-1)goto LBL_noData;
- charPtr = Translate(wdays_short[isetting]);
- goto LBL_charPtr;
-
- case 'E':
- if (!(isetting=st.wMonth))goto LBL_noData;
- charPtr = Translate(monthnames[isetting-1]);
- goto LBL_charPtr;
-
- case 'e':
- if (!(isetting=st.wMonth))goto LBL_noData;
- charPtr = Translate(mnames_short[isetting-1]);
- goto LBL_charPtr;
-
- case 'H':
- if ((isetting=st.wHour)==-1)goto LBL_noData;
- goto LBL_2DigNum;
-
- case 'h':
- if ((isetting=st.wHour)==-1)goto LBL_noData;
- if (!isetting) isetting=12;
- isetting = isetting-((isetting>12)?12:0);
- goto LBL_2DigNum;
-
- case 'p':
- if ((isetting=st.wHour)==-1)goto LBL_noData;
- charPtr = (isetting>=12)?"PM":"AM";
- goto LBL_charPtr;
-
- case 'M':
- if ((isetting=st.wMinute)==-1)goto LBL_noData;
- goto LBL_2DigNum;
-
- case 'S':
- if ((isetting=st.wHour)==-1)goto LBL_noData;
- goto LBL_2DigNum;
-
- case 'n':
- charPtr = hcontact?(char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hcontact,0):(wantempty?"":"---");
- goto LBL_charPtr;
- case 'N':
- ci.dwFlag=CNF_NICK;
- if (!CallService(MS_CONTACT_GETCONTACTINFO,(WPARAM)0,(LPARAM)&ci)) {
- charPtr = ci.pszVal;
- } else goto LBL_noData;
- goto LBL_charPtr;
- case 'G':
- {
- DBVARIANT dbv;
- if (!DBGetContactSetting(hcontact,"CList","Group",&dbv)) {
- strcpy(szdbsetting,dbv.pszVal);
- DBFreeVariant(&dbv);
- charPtr = szdbsetting;
- goto LBL_charPtr;
- } else; //do nothing
- }
+ case 'w':
+ isetting = st.wDayOfWeek;
+ if (isetting == -1) goto LBL_noData;
+ charPtr = TranslateTS( wdays_short[isetting] );
+ goto LBL_charPtr;
+
+ case 'E':
+ if ( !(isetting = st.wMonth)) goto LBL_noData;
+ charPtr = TranslateTS( monthnames[isetting-1] );
+ goto LBL_charPtr;
+
+ case 'e':
+ if ( !(isetting = st.wMonth)) goto LBL_noData;
+ charPtr = TranslateTS( mnames_short[isetting-1] );
+ goto LBL_charPtr;
+
+ case 'H':
+ if ((isetting = st.wHour) == -1) goto LBL_noData;
+ goto LBL_2DigNum;
+
+ case 'h':
+ if ((isetting = st.wHour) == -1) goto LBL_noData;
+ if (!isetting) isetting = 12;
+ isetting = isetting-((isetting>12)?12:0);
+ goto LBL_2DigNum;
+
+ case 'p':
+ if ((isetting = st.wHour) == -1) goto LBL_noData;
+ charPtr = (isetting >= 12) ? _T("PM") : _T("AM");
+ goto LBL_charPtr;
+
+ case 'M':
+ if ((isetting = st.wMinute) == -1) goto LBL_noData;
+ goto LBL_2DigNum;
+
+ case 'S':
+ if ((isetting = st.wHour) == -1) goto LBL_noData;
+ goto LBL_2DigNum;
+
+ case 'n':
+ charPtr = hcontact ? (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcontact, GCDNF_TCHAR) : (wantempty ? _T("") : _T("---"));
+ goto LBL_charPtr;
+
+ case 'N':
+ ci.dwFlag = CNF_NICK | CNF_TCHAR;
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ charPtr = ci.pszVal;
+ goto LBL_charPtr;
+ }
+ goto LBL_noData;
+
+ case 'G':
+ if ( !DBGetContactSettingTString(hcontact, "CList", "Group", &dbv)) {
+ _tcscpy(szdbsetting, dbv.ptszVal);
+ db_free(&dbv);
+ charPtr = szdbsetting;
+ goto LBL_charPtr;
+ }
+ break;
+
+ case 'u':
+ ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ switch(ci.type) {
+ case CNFT_BYTE:
+ _ltot(ci.bVal, szdbsetting, 10);
+ break;
+ case CNFT_WORD:
+ _ltot(ci.wVal, szdbsetting, 10);
+ break;
+ case CNFT_DWORD:
+ _ltot(ci.dVal, szdbsetting, 10);
break;
+ case CNFT_ASCIIZ:
+ _tcscpy(szdbsetting, ci.pszVal);
+ break;
+ }
+ }
+ else if (ci.szProto != NULL) {
+ if ( isYahoo(ci.szProto)) { // YAHOO support
+ DBGetContactSettingTString(hcontact, ci.szProto, "id", &dbv);
+ _tcscpy(szdbsetting, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else if ( isJabber(ci.szProto)) { // JABBER support
+ if ( DBGetContactSettingTString(hcontact, ci.szProto, "LoginName", &dbv))
+ goto LBL_noData;
+
+ _tcscpy(szdbsetting, dbv.ptszVal);
+ db_free(&dbv);
+
+ DBGetContactSettingTString(hcontact, ci.szProto, "LoginServer", &dbv);
+ _tcscat(szdbsetting, _T("@"));
+ _tcscat(szdbsetting, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else goto LBL_noData;
+ }
+ else goto LBL_noData;
+ charPtr = szdbsetting;
+ goto LBL_charPtr;
+
+ case 's':
+ if (isetting = db_get_w(hcontact,S_MOD,hcontact ? "StatusTriger" : courProtoName, 0)) {
+ _tcscpy(szdbsetting, TranslateTS((TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)(isetting|0x8000), GSMDF_TCHAR)));
+ if ( !(isetting & 0x8000)) {
+ _tcscat(szdbsetting, _T("/"));
+ _tcscat(szdbsetting, TranslateT("Idle"));
+ }
+ charPtr = szdbsetting;
+ goto LBL_charPtr;
+ }
+ goto LBL_noData;
- case 'u':
- ci.dwFlag=CNF_UNIQUEID;
- if (!CallService(MS_CONTACT_GETCONTACTINFO,(WPARAM)0,(LPARAM)&ci))
- {
- switch(ci.type)
- {
- case CNFT_BYTE:
- _ltot(ci.bVal, szdbsetting, 10);
- break;
- case CNFT_WORD:
- _ltot(ci.wVal, szdbsetting, 10);
- break;
- case CNFT_DWORD:
- _ltot(ci.dVal, szdbsetting, 10);
- break;
- case CNFT_ASCIIZ:
- strcpy(szdbsetting, ci.pszVal);
- break;
- }
+ case 'T':
+ if ( DBGetContactSettingTString(hcontact, "CList", "StatusMsg", &dbv))
+ goto LBL_noData;
- }
- else if (ci.szProto != NULL)
- {
- if (isYahoo(ci.szProto)) // YAHOO support
- {
- DBVARIANT dbv;
- DBGetContactSetting(hcontact,ci.szProto,"id",&dbv);
- strcpy(szdbsetting,dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- else if (isJabber(ci.szProto)) // JABBER support
- {
- DBVARIANT dbv;
- if (DBGetContactSetting(hcontact,ci.szProto,"LoginName",&dbv)) goto LBL_noData;
- strcpy(szdbsetting,dbv.pszVal);
- DBFreeVariant(&dbv);
- DBGetContactSetting(hcontact,ci.szProto,"LoginServer",&dbv);
- strcat(szdbsetting,"@");
- strcat(szdbsetting,dbv.pszVal);
- DBFreeVariant(&dbv);
- } else goto LBL_noData;
- }
- else goto LBL_noData;
- charPtr = szdbsetting;
- goto LBL_charPtr;
-
- case 's':
- if (isetting=DBGetContactSettingWord(hcontact,S_MOD,hcontact?"StatusTriger":courProtoName,0)) {
- strcpy(szdbsetting,Translate((const char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)(isetting|0x8000),0)));
- if (!(isetting&0x8000)) {
- strcat(szdbsetting,"/");
- strcat(szdbsetting,Translate("Idle"));
- }
- charPtr = szdbsetting;
- } else goto LBL_noData;
- goto LBL_charPtr;
- case 'T':
- {
- DBVARIANT dbv;
- if (!DBGetContactSetting(hcontact,"CList","StatusMsg",&dbv)) {
- sztemplen += mir_snprintf(sztemp+sztemplen,MAXSIZE-sztemplen,"%s",dbv.pszVal);
- DBFreeVariant(&dbv);
- } else goto LBL_noData;
- }
- break;
- case 'o':
- if (isetting=DBGetContactSettingWord(hcontact,S_MOD,hcontact?"OldStatus":courProtoName,0)) {
- strcpy(szdbsetting,Translate((const char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)isetting,0)));
- if (includeIdle) if (hcontact) if (DBGetContactSettingByte(hcontact,S_MOD,"OldIdle",0)) {
- strcat(szdbsetting,"/");
- strcat(szdbsetting,Translate("Idle"));
- }
- charPtr = szdbsetting;
- } else goto LBL_noData;
- goto LBL_charPtr;
-
- case 'i':
- case 'r': if (isJabber(ci.szProto)) {
- DBVARIANT dbv;
- if (!DBGetContactSetting(hcontact,ci.szProto,szstring[loop]=='i'?"Resource":"System",&dbv)) {
- strcpy(szdbsetting,dbv.pszVal);
- DBFreeVariant(&dbv);
- charPtr = szdbsetting;
- } else goto LBL_noData;
- } else {
- dwsetting=DBGetContactSettingDword(hcontact,ci.szProto,szstring[loop]=='i'?"IP":"RealIP",0);
- if(dwsetting){
- ia.S_un.S_addr=htonl(dwsetting);
- charPtr = inet_ntoa(ia);
- } else goto LBL_noData;
- }
- goto LBL_charPtr;
- case 'P':if (ci.szProto) charPtr = ci.szProto; else charPtr = wantempty?"":"ProtoUnknown";
- goto LBL_charPtr;
- case 'b':
- charPtr = /*"\n"*/"\x0D\x0A";
- goto LBL_charPtr;
- case 'C': // Get Client Info
- if (isMSN(ci.szProto)) {
- if (hcontact) {
- dwsetting = (int)DBGetContactSettingDword(hcontact,ci.szProto,"FlagBits",0);
- wsprintf(szdbsetting,"MSNC%i",(dwsetting&0x70000000)>>28);
- if (dwsetting & 0x00000001) strcat(szdbsetting," MobD"); //Mobile Device
- if (dwsetting & 0x00000004) strcat(szdbsetting," InkG"); //GIF Ink Send/Receive
- if (dwsetting & 0x00000008) strcat(szdbsetting," InkI"); //ISF Ink Send/Receive
- if (dwsetting & 0x00000010) strcat(szdbsetting," WCam"); //Webcam
- if (dwsetting & 0x00000020) strcat(szdbsetting," MPkt"); //Multi packet messages
- if (dwsetting & 0x00000040) strcat(szdbsetting," SMSr"); //Paging
- if (dwsetting & 0x00000080) strcat(szdbsetting," DSMS"); //Using MSN Direct
- if (dwsetting & 0x00000200) strcat(szdbsetting," WebM"); //WebMessenger
- if (dwsetting & 0x00001000) strcat(szdbsetting," MS7+"); //Unknown (Msgr 7 always[?] sets it)
- if (dwsetting & 0x00004000) strcat(szdbsetting," DirM"); //DirectIM
- if (dwsetting & 0x00008000) strcat(szdbsetting," Wink"); //Send/Receive Winks
- if (dwsetting & 0x00010000) strcat(szdbsetting," MSrc"); //MSN Search ??
- if (dwsetting & 0x00040000) strcat(szdbsetting," VoiC"); //Voice Clips
- } else strcpy(szdbsetting,"Miranda");
- } else {
- DBVARIANT dbv;
- if (!DBGetContactSetting(hcontact,ci.szProto,"MirVer",&dbv)) {
- strcpy(szdbsetting,dbv.pszVal);
- DBFreeVariant(&dbv);
- } else goto LBL_noData;
- }
- charPtr = szdbsetting;
- goto LBL_charPtr;
- case 't':
- charPtr = "\t";
- goto LBL_charPtr;
-
- default:
- strncpy(szdbsetting,szstring+loop-1,2);
- goto LBL_charPtr;
+ d += mir_sntprintf(d, MAXSIZE-(d-sztemp), _T("%s"), dbv.ptszVal);
+ db_free(&dbv);
+ break;
+
+ case 'o':
+ if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "OldStatus" : courProtoName, 0)) {
+ _tcscpy(szdbsetting, TranslateTS((TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)isetting, GSMDF_TCHAR)));
+ if (includeIdle) if (hcontact) if ( db_get_b(hcontact, S_MOD, "OldIdle", 0)) {
+ _tcscat(szdbsetting, _T("/"));
+ _tcscat(szdbsetting, TranslateT("Idle"));
+ }
+ charPtr = szdbsetting;
+ goto LBL_charPtr;
}
+ goto LBL_noData;
+
+ case 'i':
+ case 'r':
+ if ( isJabber(ci.szProto)) {
+ if ( DBGetContactSettingTString(hcontact, ci.szProto, *p == 'i' ? "Resource" : "System", &dbv))
+ goto LBL_noData;
+
+ _tcscpy(szdbsetting, dbv.ptszVal);
+ db_free(&dbv);
+ charPtr = szdbsetting;
+ }
+ else {
+ dwsetting = db_get_dw(hcontact, ci.szProto, *p == 'i' ? "IP" : "RealIP", 0);
+ if (!dwsetting)
+ goto LBL_noData;
+
+ ia.S_un.S_addr = htonl(dwsetting);
+ _tcscpy(szdbsetting, _A2T( inet_ntoa(ia)));
+ charPtr = szdbsetting;
+ }
+ goto LBL_charPtr;
+
+ case 'P':
+ _tcscpy(szdbsetting, _A2T(ci.szProto ? ci.szProto : (wantempty ? "" : "ProtoUnknown")));
+ goto LBL_charPtr;
+
+ case 'b':
+ charPtr = _T("x0D\x0A");
+ goto LBL_charPtr;
+
+ case 'C': // Get Client Info
+ if (isMSN(ci.szProto)) {
+ if (hcontact) {
+ dwsetting = (int)db_get_dw(hcontact,ci.szProto,"FlagBits",0);
+ wsprintf(szdbsetting, _T("MSNC%i"), (dwsetting&0x70000000)>>28);
+ if (dwsetting & 0x00000001) _tcscat(szdbsetting, _T(" MobD")); //Mobile Device
+ if (dwsetting & 0x00000004) _tcscat(szdbsetting, _T(" InkG")); //GIF Ink Send/Receive
+ if (dwsetting & 0x00000008) _tcscat(szdbsetting, _T(" InkI")); //ISF Ink Send/Receive
+ if (dwsetting & 0x00000010) _tcscat(szdbsetting, _T(" WCam")); //Webcam
+ if (dwsetting & 0x00000020) _tcscat(szdbsetting, _T(" MPkt")); //Multi packet messages
+ if (dwsetting & 0x00000040) _tcscat(szdbsetting, _T(" SMSr")); //Paging
+ if (dwsetting & 0x00000080) _tcscat(szdbsetting, _T(" DSMS")); //Using MSN Direct
+ if (dwsetting & 0x00000200) _tcscat(szdbsetting, _T(" WebM")); //WebMessenger
+ if (dwsetting & 0x00001000) _tcscat(szdbsetting, _T(" MS7+")); //Unknown (Msgr 7 always[?] sets it)
+ if (dwsetting & 0x00004000) _tcscat(szdbsetting, _T(" DirM")); //DirectIM
+ if (dwsetting & 0x00008000) _tcscat(szdbsetting, _T(" Wink")); //Send/Receive Winks
+ if (dwsetting & 0x00010000) _tcscat(szdbsetting, _T(" MSrc")); //MSN Search ??
+ if (dwsetting & 0x00040000) _tcscat(szdbsetting, _T(" VoiC")); //Voice Clips
+ }
+ else _tcscpy(szdbsetting, _T("Miranda"));
+ }
+ else {
+ if ( !DBGetContactSettingTString(hcontact, ci.szProto, "MirVer", &dbv)) {
+ _tcscpy(szdbsetting, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else goto LBL_noData;
+ }
+ charPtr = szdbsetting;
+ goto LBL_charPtr;
+
+ case 't':
+ charPtr = _T("\t");
+ goto LBL_charPtr;
+
+ default:
+ _tcsncpy(szdbsetting, p-1, 2);
+ goto LBL_charPtr;
}
}
+ *d = 0;
return sztemp;
}
-
-
void _DBWriteTime(SYSTEMTIME *st,HANDLE hcontact)
{
- DBWriteContactSettingWord((HANDLE)hcontact,S_MOD,"Day",st->wDay);
- DBWriteContactSettingWord((HANDLE)hcontact,S_MOD,"Month",st->wMonth);
- DBWriteContactSettingWord((HANDLE)hcontact,S_MOD,"Year",st->wYear);
- DBWriteContactSettingWord((HANDLE)hcontact,S_MOD,"Hours",st->wHour);
- DBWriteContactSettingWord((HANDLE)hcontact,S_MOD,"Minutes",st->wMinute);
- DBWriteContactSettingWord((HANDLE)hcontact,S_MOD,"Seconds",st->wSecond);
- DBWriteContactSettingWord((HANDLE)hcontact,S_MOD,"WeekDay",st->wDayOfWeek);
+ db_set_w((HANDLE)hcontact,S_MOD,"Day",st->wDay);
+ db_set_w((HANDLE)hcontact,S_MOD,"Month",st->wMonth);
+ db_set_w((HANDLE)hcontact,S_MOD,"Year",st->wYear);
+ db_set_w((HANDLE)hcontact,S_MOD,"Hours",st->wHour);
+ db_set_w((HANDLE)hcontact,S_MOD,"Minutes",st->wMinute);
+ db_set_w((HANDLE)hcontact,S_MOD,"Seconds",st->wSecond);
+ db_set_w((HANDLE)hcontact,S_MOD,"WeekDay",st->wDayOfWeek);
}
@@ -512,45 +501,57 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa return DefWindowProc(hwnd, message, wParam, lParam);
};
-void ShowPopup(HANDLE hcontact, const char * lpzProto, int newStatus){
- if(CallService(MS_IGNORE_ISIGNORED,(WPARAM)hcontact,IGNOREEVENT_USERONLINE)) return;
- if (ServiceExists(MS_POPUP_QUERY)) {
- if (DBGetContactSettingByte(NULL,S_MOD,"UsePopups",0)) {
- if (!DBGetContactSettingByte(hcontact,"CList","Hidden",0)) {
- POPUPDATAEX ppd = {0};
- DBVARIANT dbv = {0};
- char szstamp[10];
- DWORD sett;
- sprintf(szstamp, "Col_%d",newStatus-ID_STATUS_OFFLINE);
- sett = DBGetContactSettingDword(NULL,S_MOD,szstamp,StatusColors15bits[newStatus-ID_STATUS_OFFLINE]);
- GetColorsFromDWord(&ppd.colorBack,&ppd.colorText,sett);
- ppd.lchContact = hcontact;
- ppd.lchIcon = LoadSkinnedProtoIcon(lpzProto, newStatus);
- strncpy(ppd.lpzContactName,ParseString(!DBGetContactSetting(NULL,S_MOD,"PopupStamp",&dbv)?dbv.pszVal:DEFAULT_POPUPSTAMP,hcontact,0),MAX_CONTACTNAME);
- DBFreeVariant(&dbv);
- strncpy(ppd.lpzText,ParseString(!DBGetContactSetting(NULL,S_MOD,"PopupStampText",&dbv)?dbv.pszVal:DEFAULT_POPUPSTAMPTEXT,hcontact,0),MAX_SECONDLINE);
- DBFreeVariant(&dbv);
- ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
- CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0);
- }
- }
+void ShowPopup(HANDLE hcontact, const char * lpzProto, int newStatus)
+{
+ if ( CallService(MS_IGNORE_ISIGNORED, (WPARAM)hcontact, IGNOREEVENT_USERONLINE))
+ return;
+
+ if ( !ServiceExists(MS_POPUP_QUERY))
+ return;
+
+ if ( !db_get_b(NULL, S_MOD, "UsePopups", 0) || !db_get_b(hcontact, "CList", "Hidden", 0))
+ return;
+
+ DBVARIANT dbv;
+ char szSetting[10];
+ sprintf(szSetting, "Col_%d",newStatus-ID_STATUS_OFFLINE);
+ DWORD sett = db_get_dw(NULL, S_MOD, szSetting, StatusColors15bits[newStatus-ID_STATUS_OFFLINE]);
+
+ POPUPDATAT ppd = {0};
+ GetColorsFromDWord(&ppd.colorBack,&ppd.colorText,sett);
+
+ ppd.lchContact = hcontact;
+ ppd.lchIcon = LoadSkinnedProtoIcon(lpzProto, newStatus);
+
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "PopupStamp", &dbv)) {
+ _tcsncpy(ppd.lptzContactName, ParseString(dbv.ptszVal, hcontact, 0), MAX_CONTACTNAME);
+ db_free(&dbv);
+ }
+ else _tcsncpy(ppd.lptzContactName, ParseString(DEFAULT_POPUPSTAMP, hcontact, 0), MAX_CONTACTNAME);
+
+ if ( !DBGetContactSettingTString(NULL, S_MOD, "PopupStampText", &dbv)) {
+ _tcsncpy(ppd.lptzText, ParseString(dbv.ptszVal, hcontact, 0), MAX_SECONDLINE);
+ db_free(&dbv);
}
+ else _tcsncpy(ppd.lptzText, ParseString(DEFAULT_POPUPSTAMPTEXT, hcontact, 0), MAX_SECONDLINE);
+ ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
+ CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0);
}
void myPlaySound(HANDLE hcontact, WORD newStatus, WORD oldStatus){
- if(CallService(MS_IGNORE_ISIGNORED,(WPARAM)hcontact,IGNOREEVENT_USERONLINE)) return;
+ if (CallService(MS_IGNORE_ISIGNORED,(WPARAM)hcontact,IGNOREEVENT_USERONLINE)) return;
//oldStatus and hcontact are not used yet
- if (DBGetContactSettingByte(NULL,"Skin","UseSound",1)) {
+ if ( db_get_b(NULL,"Skin","UseSound",1)) {
char * soundname=0;
if ((newStatus==ID_STATUS_ONLINE) || (newStatus==ID_STATUS_FREECHAT)) soundname = "LastSeenTrackedStatusOnline";
else if (newStatus==ID_STATUS_OFFLINE) soundname = "LastSeenTrackedStatusOffline";
else if (oldStatus==ID_STATUS_OFFLINE) soundname = "LastSeenTrackedStatusFromOffline";
else soundname = "LastSeenTrackedStatusChange";
- if (!DBGetContactSettingByte(NULL,"SkinSoundsOff",soundname,0)) {
+ if (!db_get_b(NULL,"SkinSoundsOff",soundname,0)) {
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL,"SkinSounds",soundname,&dbv)) {
- PlaySoundA(dbv.pszVal, NULL, SND_ASYNC | SND_FILENAME | SND_NOWAIT);
- DBFreeVariant(&dbv);
+ if ( !DBGetContactSettingTString(NULL, "SkinSounds", soundname, &dbv)) {
+ PlaySound(dbv.ptszVal, NULL, SND_ASYNC | SND_FILENAME | SND_NOWAIT);
+ db_free(&dbv);
} } } }
//will give hContact position or zero
@@ -596,18 +597,18 @@ int addContactToQueue(HANDLE hContact){ static DWORD __stdcall waitThread(logthread_info* infoParam)
{
- WORD prevStatus = DBGetContactSettingWord(infoParam->hContact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE);
+ WORD prevStatus = db_get_w(infoParam->hContact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE);
Sleep(1500); // I hope in 1.5 second all the needed info will be set
if (includeIdle)
- if (DBGetContactSettingDword(infoParam->hContact,infoParam->sProtoName,"IdleTS",0))
+ if (db_get_dw(infoParam->hContact,infoParam->sProtoName,"IdleTS",0))
infoParam->courStatus &=0x7FFF;
if (infoParam->courStatus != prevStatus){
- DBWriteContactSettingWord(infoParam->hContact,S_MOD,"OldStatus",(WORD)(prevStatus|0x8000));
+ db_set_w(infoParam->hContact,S_MOD,"OldStatus",(WORD)(prevStatus|0x8000));
if (includeIdle)
- DBWriteContactSettingByte(infoParam->hContact,S_MOD,"OldIdle",(BYTE)((prevStatus&0x8000)==0));
+ db_set_b(infoParam->hContact,S_MOD,"OldIdle",(BYTE)((prevStatus&0x8000)==0));
- DBWriteContactSettingWord(infoParam->hContact,S_MOD,"StatusTriger",infoParam->courStatus);
+ db_set_w(infoParam->hContact,S_MOD,"StatusTriger",infoParam->courStatus);
}
contactQueue[infoParam->queueIndex] = 0;
@@ -624,14 +625,14 @@ int UpdateValues(WPARAM wparam,LPARAM lparam) // to make this code faster
if (!wparam) return 0;
cws=(DBCONTACTWRITESETTING *)lparam;
- //if(CallService(MS_IGNORE_ISIGNORED,(WPARAM)hContact,IGNOREEVENT_USERONLINE)) return 0;
+ //if (CallService(MS_IGNORE_ISIGNORED,(WPARAM)hContact,IGNOREEVENT_USERONLINE)) return 0;
isIdleEvent = includeIdle?(strcmp(cws->szSetting,"IdleTS")==0):0;
if (strcmp(cws->szSetting,"Status") && strcmp(cws->szSetting,"StatusTriger") && (isIdleEvent==0)) return 0;
if (!strcmp(cws->szModule,S_MOD)) {
//here we will come when Settings/SeenModule/StatusTriger is changed
- WORD prevStatus=DBGetContactSettingWord((HANDLE)wparam, S_MOD, "OldStatus", ID_STATUS_OFFLINE);
+ WORD prevStatus=db_get_w((HANDLE)wparam, S_MOD, "OldStatus", ID_STATUS_OFFLINE);
if (includeIdle){
- if (DBGetContactSettingByte((HANDLE)wparam, S_MOD, "OldIdle", 0)) prevStatus &= 0x7FFF;
+ if ( db_get_b((HANDLE)wparam, S_MOD, "OldIdle", 0)) prevStatus &= 0x7FFF;
else prevStatus |= 0x8000;
}
if ((cws->value.wVal|0x8000)<=ID_STATUS_OFFLINE)
@@ -641,21 +642,21 @@ int UpdateValues(WPARAM wparam,LPARAM lparam) if ((prevStatus|0x8000)<=ID_STATUS_OFFLINE)
return 0;
proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wparam, 0);
- DBWriteContactSettingByte((HANDLE)wparam, S_MOD, "Offline", 1);
+ db_set_b((HANDLE)wparam, S_MOD, "Offline", 1);
{
DWORD t;
char *str = (char *)malloc(MAXMODULELABELLENGTH+9);
mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",proto);
- t = DBGetContactSettingDword(NULL,S_MOD,str,0);
+ t = db_get_dw(NULL,S_MOD,str,0);
if (!t) t = time(NULL);
free(str);
DBWriteTimeTS(t, (HANDLE)wparam);
}
- if (!DBGetContactSettingByte(NULL,S_MOD,"IgnoreOffline",1))
+ if (!db_get_b(NULL,S_MOD,"IgnoreOffline",1))
{
char * sProto;
- if(DBGetContactSettingByte(NULL,S_MOD,"FileOutput",0))
+ if ( db_get_b(NULL,S_MOD,"FileOutput",0))
FileWrite((HANDLE)wparam);
if (CallProtoService(sProto =
@@ -663,34 +664,34 @@ int UpdateValues(WPARAM wparam,LPARAM lparam) PS_GETSTATUS,0,0
)>ID_STATUS_OFFLINE) {
myPlaySound((HANDLE)wparam, ID_STATUS_OFFLINE, prevStatus);
- if(DBGetContactSettingByte(NULL, S_MOD, "UsePopups", 0)) {
+ if ( db_get_b(NULL, S_MOD, "UsePopups", 0)) {
ShowPopup((HANDLE)wparam, sProto, ID_STATUS_OFFLINE);
} }
- if(DBGetContactSettingByte(NULL, S_MOD, "KeepHistory", 0))
+ if ( db_get_b(NULL, S_MOD, "KeepHistory", 0))
HistoryWrite((HANDLE)wparam);
- if(DBGetContactSettingByte((HANDLE)wparam, S_MOD, "OnlineAlert", 0))
+ if ( db_get_b((HANDLE)wparam, S_MOD, "OnlineAlert", 0))
ShowHistory((HANDLE)wparam, 1);
}
} else {
- if(cws->value.wVal==prevStatus && !DBGetContactSettingByte((HANDLE)wparam, S_MOD, "Offline", 0))
+ if (cws->value.wVal==prevStatus && !db_get_b((HANDLE)wparam, S_MOD, "Offline", 0))
return 0;
DBWriteTimeTS(time(NULL), (HANDLE)wparam);
- //DBWriteContactSettingWord(hContact,S_MOD,"StatusTriger",(WORD)cws->value.wVal);
+ //db_set_w(hContact,S_MOD,"StatusTriger",(WORD)cws->value.wVal);
- if(DBGetContactSettingByte(NULL, S_MOD, "FileOutput", 0)) FileWrite((HANDLE)wparam);
+ if ( db_get_b(NULL, S_MOD, "FileOutput", 0)) FileWrite((HANDLE)wparam);
if (prevStatus != cws->value.wVal) myPlaySound((HANDLE)wparam, cws->value.wVal, prevStatus);
- if(DBGetContactSettingByte(NULL, S_MOD, "UsePopups", 0))
+ if ( db_get_b(NULL, S_MOD, "UsePopups", 0))
if (prevStatus != cws->value.wVal) ShowPopup((HANDLE)wparam, (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wparam, 0), cws->value.wVal|0x8000);
- if(DBGetContactSettingByte(NULL, S_MOD, "KeepHistory", 0)) HistoryWrite((HANDLE)wparam);
- if(DBGetContactSettingByte((HANDLE)wparam, S_MOD, "OnlineAlert", 0)) ShowHistory((HANDLE)wparam, 1);
- DBWriteContactSettingByte((HANDLE)wparam, S_MOD, "Offline", 0);
+ if ( db_get_b(NULL, S_MOD, "KeepHistory", 0)) HistoryWrite((HANDLE)wparam);
+ if ( db_get_b((HANDLE)wparam, S_MOD, "OnlineAlert", 0)) ShowHistory((HANDLE)wparam, 1);
+ db_set_b((HANDLE)wparam, S_MOD, "Offline", 0);
}
} else if (IsWatchedProtocol(cws->szModule)) {
//here we will come when <User>/<module>/Status is changed or it is idle event and if <module> is watched
@@ -703,7 +704,7 @@ int UpdateValues(WPARAM wparam,LPARAM lparam) unsigned int dwThreadId;
mir_forkthreadex((pThreadFuncEx)waitThread, contactQueue[index], &dwThreadId);
}
- contactQueue[index]->courStatus = isIdleEvent ? DBGetContactSettingWord((HANDLE)wparam, cws->szModule, "Status", ID_STATUS_OFFLINE) : cws->value.wVal;
+ contactQueue[index]->courStatus = isIdleEvent ? db_get_w((HANDLE)wparam, cws->szModule, "Status", ID_STATUS_OFFLINE) : cws->value.wVal;
} }
return 0;
@@ -718,12 +719,12 @@ static DWORD __stdcall cleanThread(logthread_info* infoParam) char *contactProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0);
if (contactProto) {
if ( !strncmp(infoParam->sProtoName, contactProto, MAXMODULELABELLENGTH)) {
- WORD oldStatus = DBGetContactSettingWord(hcontact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE) | 0x8000;
+ WORD oldStatus = db_get_w(hcontact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE) | 0x8000;
if (oldStatus > ID_STATUS_OFFLINE) {
- if (DBGetContactSettingWord(hcontact,contactProto,"Status",ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE){
- DBWriteContactSettingWord(hcontact,S_MOD,"OldStatus",(WORD)(oldStatus|0x8000));
- if (includeIdle)DBWriteContactSettingByte(hcontact,S_MOD,"OldIdle",(BYTE)((oldStatus&0x8000)?0:1));
- DBWriteContactSettingWord(hcontact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE);
+ if (db_get_w(hcontact,contactProto,"Status",ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE){
+ db_set_w(hcontact,S_MOD,"OldStatus",(WORD)(oldStatus|0x8000));
+ if (includeIdle)db_set_b(hcontact,S_MOD,"OldIdle",(BYTE)((oldStatus&0x8000)?0:1));
+ db_set_w(hcontact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE);
}
}
}
@@ -748,7 +749,7 @@ int ModeChange(WPARAM wparam,LPARAM lparam) ack=(ACKDATA *)lparam;
- if(ack->type!=ACKTYPE_STATUS || ack->result!=ACKRESULT_SUCCESS || ack->hContact!=NULL) return 0;
+ if (ack->type!=ACKTYPE_STATUS || ack->result!=ACKRESULT_SUCCESS || ack->hContact!=NULL) return 0;
courProtoName = (char *)ack->szModule;
if (!IsWatchedProtocol(courProtoName) && strncmp(courProtoName,"MetaContacts",12))
{
@@ -784,14 +785,14 @@ int ModeChange(WPARAM wparam,LPARAM lparam) DBWriteContactSettingDword(NULL,S_MOD,str,t);
free(str);
} }
- if (isetting==DBGetContactSettingWord(NULL,S_MOD,courProtoName,ID_STATUS_OFFLINE)) return 0;
- DBWriteContactSettingWord(NULL,S_MOD,courProtoName,isetting);
+ if (isetting==db_get_w(NULL,S_MOD,courProtoName,ID_STATUS_OFFLINE)) return 0;
+ db_set_w(NULL,S_MOD,courProtoName,isetting);
// log "myself"
- if(DBGetContactSettingByte(NULL,S_MOD,"FileOutput",0))
+ if ( db_get_b(NULL,S_MOD,"FileOutput",0))
FileWrite(NULL);
-// if(isetting==ID_STATUS_OFFLINE) //this is removed 'cause I want other contacts to be logged only if the status changed while I was offline
+// if (isetting==ID_STATUS_OFFLINE) //this is removed 'cause I want other contacts to be logged only if the status changed while I was offline
// SetOffline();
courProtoName = NULL;
@@ -799,9 +800,10 @@ int ModeChange(WPARAM wparam,LPARAM lparam) return 0;
}
-short int isDbZero(HANDLE hContact, const char *module_name, const char *setting_name){
+short int isDbZero(HANDLE hContact, const char *module_name, const char *setting_name)
+{
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, module_name, setting_name, &dbv)) {
+ if ( !DBGetContactSetting(hContact, module_name, setting_name, &dbv)) {
short int res = 0;
switch (dbv.type) {
case DBVT_BYTE: res=dbv.bVal==0; break;
@@ -810,9 +812,10 @@ short int isDbZero(HANDLE hContact, const char *module_name, const char *setting case DBVT_BLOB: res=dbv.cpbVal==0; break;
default: res=dbv.pszVal[0]==0; break;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return res;
- } else return -1;
+ }
+ return -1;
}
WCHAR *any_to_IdleNotidleUnknown(HANDLE hContact, const char *module_name, const char *setting_name, WCHAR *buff, int bufflen) {
@@ -827,7 +830,7 @@ WCHAR *any_to_IdleNotidleUnknown(HANDLE hContact, const char *module_name, const }
WCHAR *any_to_Idle(HANDLE hContact, const char *module_name, const char *setting_name, WCHAR *buff, int bufflen) {
- if(isDbZero(hContact, module_name, setting_name)==0) { //DB setting is NOT zero and exists
+ if (isDbZero(hContact, module_name, setting_name)==0) { //DB setting is NOT zero and exists
buff[0] = L'/';
wcsncpy((WCHAR *)&buff[1], TranslateW(L"Idle"), bufflen-1);
} else buff[0] = 0;
|