diff options
Diffstat (limited to 'plugins/Msg_Export/src')
-rwxr-xr-x | plugins/Msg_Export/src/FileViewer.cpp | 12 | ||||
-rw-r--r-- | plugins/Msg_Export/src/Version.h | 4 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/main.cpp | 9 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/options.cpp | 4 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/stdafx.h | 1 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/utils.cpp | 46 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/utils.h | 2 |
7 files changed, 32 insertions, 46 deletions
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index c39b00d719..fca90eae40 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -141,6 +141,7 @@ mir_cs csHistoryList; class CLStreamRTFInfo
{
private:
+ MCONTACT hContact;
HANDLE hFile;
bool bHeaderWriten;
bool bTailWriten;
@@ -158,9 +159,10 @@ private: int nWriteHeader(char *pszTarget, int nLen);
public:
bool bUtf8File;
- CLStreamRTFInfo(HANDLE hFile)
+ CLStreamRTFInfo(HANDLE _hFile, MCONTACT _hContact)
{
- this->hFile = hFile;
+ hContact = _hContact;
+ hFile = _hFile;
bHeaderWriten = false;
bTailWriten = false;
bCheckFirstForNick = false;
@@ -256,7 +258,7 @@ int CLStreamRTFInfo::nLoadFileStream(LPBYTE pbBuff, LONG cb) }
dwCurrent += nWriteHeader((char*)pbBuff, cb);
- tstring sMyNick = NickFromHandle(0);
+ tstring sMyNick = ptrT(GetMyOwnNick(hContact));
nNickLen = WideCharToMultiByte(bUtf8File ? CP_UTF8 : CP_ACP, 0, sMyNick.c_str(), (int)sMyNick.length(), szMyNick, sizeof(szMyNick), NULL, NULL);
}
@@ -652,7 +654,7 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg * pclDlg) if (bUseSyntaxHL) {
SendMessage(hRichEdit, EM_EXLIMITTEXT, 0, 0x7FFFFFFF);
- CLStreamRTFInfo clInfo(hFile);
+ CLStreamRTFInfo clInfo(hFile, pclDlg->hContact);
eds.dwCookie = (DWORD_PTR)&clInfo;
eds.pfnCallback = RichEditRTFStreamLoadFile;
@@ -980,7 +982,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, TCHAR szFormat[200];
TCHAR szTitle[200];
if (GetWindowText(hwndDlg, szFormat, _countof(szFormat))) {
- const TCHAR *pszNick = NickFromHandle(pclDlg->hContact);
+ const TCHAR *pszNick = pcli->pfnGetContactDisplayName(pclDlg->hContact, 0);
tstring sPath = pclDlg->sPath;
string::size_type n = sPath.find_last_of('\\');
if (n != sPath.npos)
diff --git a/plugins/Msg_Export/src/Version.h b/plugins/Msg_Export/src/Version.h index aaf3569ca3..be91303528 100644 --- a/plugins/Msg_Export/src/Version.h +++ b/plugins/Msg_Export/src/Version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3
#define __MINOR_VERSION 1
-#define __RELEASE_NUM 0
-#define __BUILD_NUM 3
+#define __RELEASE_NUM 1
+#define __BUILD_NUM 4
#include <stdver.h>
diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp index 2432e2679d..c6a3d41377 100755 --- a/plugins/Msg_Export/src/main.cpp +++ b/plugins/Msg_Export/src/main.cpp @@ -22,8 +22,6 @@ CLIST_INTERFACE *pcli; HINSTANCE hInstance = NULL;
int hLangpack = 0;
-static HANDLE hOpenHistoryMenuItem = 0;
-
MWindowList hInternalWindowList = NULL;
/////////////////////////////////////////////////////
@@ -121,10 +119,7 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) mi.position = 1000090100;
mi.name.a = LPGEN("Open E&xported History");
mi.pszService = MS_SHOW_EXPORT_HISTORY;
- hOpenHistoryMenuItem = Menu_AddContactMenuItem(&mi);
-
- if (!hOpenHistoryMenuItem)
- MessageBox(NULL, TranslateT("Failed to add menu item Open Exported History\nCallService(MS_CLIST_ADDCONTACTMENUITEM,...)"), MSG_BOX_TITEL, MB_OK);
+ Menu_AddContactMenuItem(&mi);
}
HookEvent(ME_SYSTEM_SHUTDOWN, nSystemShutdown);
@@ -242,4 +237,4 @@ extern "C" __declspec(dllexport) int Unload(void) WindowList_Destroy(hInternalWindowList);
bUseInternalViewer(false);
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 6611f692da..1ed9ad9931 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -92,7 +92,7 @@ public: int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
if (lParamSort == 1)
- return mir_tstrcmpi(NickFromHandle((MCONTACT)lParam1), NickFromHandle((MCONTACT)lParam2));
+ return mir_tstrcmpi(pcli->pfnGetContactDisplayName(lParam1, 0), pcli->pfnGetContactDisplayName(lParam2, 0));
if (lParamSort == 2)
return _DBGetString((MCONTACT)lParam1, "Protocol", "p", _T("")).compare(_DBGetString((MCONTACT)lParam2, "Protocol", "p", _T("")));
@@ -693,7 +693,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar sItem.mask = LVIF_TEXT;
sItem.iSubItem = 1;
- sItem.pszText = (TCHAR*)NickFromHandle(hContact);
+ sItem.pszText = pcli->pfnGetContactDisplayName(hContact, 0);
ListView_SetItem(hMapUser, &sItem);
sItem.iSubItem = 2;
diff --git a/plugins/Msg_Export/src/stdafx.h b/plugins/Msg_Export/src/stdafx.h index 88a0a36c5e..a0b6b97e54 100755 --- a/plugins/Msg_Export/src/stdafx.h +++ b/plugins/Msg_Export/src/stdafx.h @@ -31,6 +31,7 @@ using namespace std; #include <newpluginapi.h>
#include <m_database.h>
#include <m_clist.h>
+#include <m_contacts.h>
#include <m_langpack.h>
#include <m_options.h>
#include <m_history.h>
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 2cc790b844..1b60d15d37 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -19,7 +19,6 @@ #include "stdafx.h"
// Default error string used upon errors
-const TCHAR *pszNickError = LPGENT("No_Nick");
const TCHAR *pszGroupError = LPGENT("No_Group");
const TCHAR *pszDbPathError = _T(".");
@@ -205,28 +204,6 @@ void DisplayLastError(const TCHAR *pszError) MessageBox(NULL, sError.c_str(), MSG_BOX_TITEL, MB_OK);
}
-
-/////////////////////////////////////////////////////////////////////
-// Member Function : NickFromHandle
-// Type : Global
-// Parameters : hContact - ?
-// Returns : TCHAR*
-// Description : Reads a Nick from the database and returns a
-// pointer to this.
-// References : -
-// Remarks : -
-// Created : 020422, 22 April 2002
-// Developer : KN
-/////////////////////////////////////////////////////////////////////
-
-const TCHAR* NickFromHandle(MCONTACT hContact)
-{
- const TCHAR *psz = pcli->pfnGetContactDisplayName(hContact, 0);
- if (psz)
- return psz;
- return pszNickError;
-}
-
/////////////////////////////////////////////////////////////////////
// Member Function : _DBGetString
// Type : Global
@@ -560,7 +537,7 @@ tstring GetFilePathFromUser(MCONTACT hContact) // Here we will try to avoide the (Unknown Contact) in cases where the protocol for
// this user has been removed.
- if (bNickUsed && (_tcsstr(NickFromHandle(hContact), LPGENT("(Unknown Contact)")) != 0))
+ if (bNickUsed && (_tcsstr(pcli->pfnGetContactDisplayName(hContact, 0), LPGENT("(Unknown Contact)")) != 0))
return sPrevFileName; // Then the filename must have changed from a correct path to one including the (Unknown Contact)
// file name has changed
@@ -584,7 +561,7 @@ tstring GetFilePathFromUser(MCONTACT hContact) bool bTryRename;
if (enRenameAction != eDAAutomatic) {
- tstring sRemoteUser = NickFromHandle(hContact);
+ tstring sRemoteUser = pcli->pfnGetContactDisplayName(hContact, 0);
mir_sntprintf(szTemp,
TranslateT("File name for the user \"%s\" has changed!\n\nfrom:\t%s\nto:\t%s\n\nDo you wish to rename file?"),
sRemoteUser.c_str(),
@@ -640,7 +617,7 @@ tstring GetFilePathFromUser(MCONTACT hContact) tstring FileNickFromHandle(MCONTACT hContact)
{
- tstring ret = NickFromHandle(hContact);
+ tstring ret = pcli->pfnGetContactDisplayName(hContact, 0);
string::size_type nCur = 0;
while ((nCur = ret.find_first_of(_T(":\\"), nCur)) != ret.npos)
ret[nCur] = cBadCharReplace;
@@ -811,7 +788,7 @@ void UpdateFileToColWidth() clFileTo1ColWidth.clear();
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- tstring sNick = NickFromHandle(hContact);
+ tstring sNick = pcli->pfnGetContactDisplayName(hContact, 0);
string::size_type &rnValue = clFileTo1ColWidth[GetFilePathFromUser(hContact)];
if (rnValue < sNick.size())
rnValue = sNick.size();
@@ -931,8 +908,8 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) nFirstColumnWidth = 4;
}
else {
- sLocalUser = NickFromHandle(0);
- sRemoteUser = NickFromHandle(hContact);
+ sLocalUser = ptrT(GetMyOwnNick(hContact));
+ sRemoteUser = pcli->pfnGetContactDisplayName(hContact, 0);
nFirstColumnWidth = max(sRemoteUser.size(), clFileTo1ColWidth[sFilePath]);
nFirstColumnWidth = max(sLocalUser.size(), nFirstColumnWidth);
nFirstColumnWidth += 2;
@@ -1455,3 +1432,14 @@ void SaveSettings() db_set_b(NULL, MODULE, "RenameAction", (BYTE)enRenameAction);
db_set_b(NULL, MODULE, "DeleteAction", (BYTE)enDeleteAction);
}
+
+/////////////////////////////////////////////////////////////////////
+
+TCHAR* GetMyOwnNick(MCONTACT hContact)
+{
+ CONTACTINFO ci = { 0 };
+ ci.cbSize = sizeof(ci);
+ ci.szProto = GetContactProto(hContact);
+ ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
+ return CallService(MS_CONTACT_GETCONTACTINFO, 0, LPARAM(&ci)) ? NULL : ci.pszVal;
+}
diff --git a/plugins/Msg_Export/src/utils.h b/plugins/Msg_Export/src/utils.h index ce3036fda9..ac567f8808 100755 --- a/plugins/Msg_Export/src/utils.h +++ b/plugins/Msg_Export/src/utils.h @@ -57,7 +57,7 @@ void ShowDebugInfo(); int nExportEvent(WPARAM wparam, LPARAM lparam);
int nContactDeleted(WPARAM wparam, LPARAM lparam);
-const TCHAR *NickFromHandle(MCONTACT hContact);
+TCHAR* GetMyOwnNick(MCONTACT hContact);
tstring __inline _DBGetStringW(MCONTACT hContact, const char *szModule, const char *szSetting, const TCHAR *pszError);
string __inline _DBGetStringA(MCONTACT hContact, const char *szModule, const char *szSetting, const char *pszError);
|