diff options
Diffstat (limited to 'plugins/FileAsMessage')
-rw-r--r-- | plugins/FileAsMessage/fileecho_10.vcxproj | 8 | ||||
-rw-r--r-- | plugins/FileAsMessage/fileecho_12.vcxproj | 8 | ||||
-rw-r--r-- | plugins/FileAsMessage/src/dialog.cpp | 192 | ||||
-rw-r--r-- | plugins/FileAsMessage/src/dialog.h | 12 | ||||
-rw-r--r-- | plugins/FileAsMessage/src/main.cpp | 7 | ||||
-rw-r--r-- | plugins/FileAsMessage/src/main.h | 6 |
6 files changed, 116 insertions, 117 deletions
diff --git a/plugins/FileAsMessage/fileecho_10.vcxproj b/plugins/FileAsMessage/fileecho_10.vcxproj index ee7d876f61..b11ebef3e6 100644 --- a/plugins/FileAsMessage/fileecho_10.vcxproj +++ b/plugins/FileAsMessage/fileecho_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>Unicode</CharacterSet>
+ <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
+ <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
+ <CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
+ <CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
diff --git a/plugins/FileAsMessage/fileecho_12.vcxproj b/plugins/FileAsMessage/fileecho_12.vcxproj index e25eb41aca..c078c6ec5c 100644 --- a/plugins/FileAsMessage/fileecho_12.vcxproj +++ b/plugins/FileAsMessage/fileecho_12.vcxproj @@ -25,23 +25,23 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
+ <CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
+ <CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
+ <CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
+ <CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index e79e3a0006..5b50ef19d7 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -1,12 +1,12 @@ #include"main.h"
-TCHAR *szFEMode[] =
+char *szFEMode[] =
{
- _T("Recv file"),
- _T("Send file")
+ "Recv file",
+ "Send file"
};
-TCHAR * ltoax(TCHAR *s, DWORD value)
+char* ltoax(char* s, DWORD value)
{
if(value == 0)
{
@@ -30,8 +30,7 @@ TCHAR * ltoax(TCHAR *s, DWORD value) }
return s;
}
-
-uint atolx(TCHAR *&value)
+uint atolx(char* &value)
{
uint result = 0;
uchar ch;
@@ -113,7 +112,7 @@ static int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM //
// Just create simple Popup for specified contact
//
-void MakePopupMsg(HWND hDlg, MCONTACT hContact, TCHAR *msg)
+void MakePopupMsg(HWND hDlg, MCONTACT hContact, char *msg)
{
HWND hFocused = GetForegroundWindow();
if(hDlg == hFocused || hDlg == GetParent(hFocused)) return;
@@ -121,22 +120,22 @@ void MakePopupMsg(HWND hDlg, MCONTACT hContact, TCHAR *msg) //
//The text for the second line. You could even make something like: char lpzText[128]; lstrcpy(lpzText, "Hello world!"); It's your choice.
//
- POPUPDATAT ppd = { 0 };
+ POPUPDATA ppd = { 0 };
ppd.lchContact = hContact;
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SMALLICON));
- lstrcpy(ppd.lptzContactName, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
- lstrcpy(ppd.lptzText, msg);
+ lstrcpy(ppd.lpzContactName, (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0));
+ lstrcpy(ppd.lpzText, msg);
ppd.colorBack = GetSysColor(COLOR_INFOBK);
ppd.colorText = GetSysColor(COLOR_INFOTEXT);
ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
ppd.PluginData = (void*)hDlg;
ppd.iSeconds = -1;
- PUAddPopupT(&ppd);
+ PUAddPopup(&ppd);
}
//
// Get ID of string message
//
-int getMsgId(TCHAR *msg)
+int getMsgId(char *msg)
{
for(int indx = 0; indx < CMD_COUNT; indx++)
{
@@ -145,9 +144,9 @@ int getMsgId(TCHAR *msg) return -1;
};
-int RetrieveFileSize(TCHAR *filename)
+int RetrieveFileSize(char *filename)
{
- int handle = _topen(filename, O_RDONLY|O_BINARY,0);
+ int handle = open(filename, O_RDONLY|O_BINARY,0);
if(handle != -1)
{
int size = filelength(handle);
@@ -257,13 +256,13 @@ void FILEECHO::setState(DWORD state) void FILEECHO::updateTitle()
{
- TCHAR newtitle[256], *contactName;
+ char newtitle[256], *contactName;
- contactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
+ contactName=(char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,0);
if(iState == STATE_OPERATE && chunkCount != 0)
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%d%% - %s: %s"), chunkSent * 100 / chunkCount, TranslateTS(szFEMode[inSend]), contactName);
+ mir_snprintf(newtitle, sizeof(newtitle), "%d%% - %s: %s", chunkSent * 100 / chunkCount, Translate(szFEMode[inSend]), contactName);
else
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s: %s"), TranslateTS(szFEMode[inSend]), contactName);
+ mir_snprintf(newtitle, sizeof(newtitle), "%s: %s", Translate(szFEMode[inSend]), contactName);
SetWindowText(hDlg, newtitle);
}
@@ -288,8 +287,8 @@ int FILEECHO::createTransfer() hFile = CreateFile(filename, inSend ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE), inSend ? FILE_SHARE_READ : 0, NULL, inSend ? OPEN_EXISTING : (bAuto ? CREATE_ALWAYS : CREATE_NEW), FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile == INVALID_HANDLE_VALUE && !inSend && GetLastError() == ERROR_FILE_EXISTS)
{
- if(MessageBox(hDlg, TranslateT("File already exists. Overwrite?"),
- TranslateT(SERVICE_TITLE),
+ if(MessageBox(hDlg, Translate("File already exists. Overwrite?"),
+ Translate(SERVICE_TITLE),
MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) != IDYES) return 0;
hFile = CreateFile(filename, GENERIC_READ|GENERIC_WRITE, 0,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -416,52 +415,52 @@ void FILEECHO::destroyTransfer() void FILEECHO::sendReq()
{
- TCHAR sendbuf[MAX_PATH];
+ char sendbuf[MAX_PATH];
if(!createTransfer())
{
- SetDlgItemText(hDlg, IDC_FILESIZE, TranslateT("Couldn't open a file"));
+ SetDlgItemText(hDlg, IDC_FILESIZE, Translate("Couldn't open a file"));
return;
}
///!!!!!!!
- TCHAR *p = filename + _tcslen(filename);
+ char *p = filename + strlen(filename);
while(p != filename && *p != '\\')
p--;
if(*p == '\\')
- _tcscpy(filename, p + 1);
+ strcpy(filename,p+1);
- mir_sntprintf(sendbuf, SIZEOF(sendbuf), TranslateT("Size: %d bytes"), fileSize);
+ mir_snprintf(sendbuf, sizeof(sendbuf), Translate("Size: %d bytes"), fileSize);
SetDlgItemText(hDlg, IDC_FILESIZE, sendbuf);
- mir_sntprintf(sendbuf, SIZEOF(sendbuf), _T("?%c%c%d:%d \n") NOPLUGIN_MESSAGE, asBinary+'0', codeSymb, chunkCount, fileSize);
+ mir_snprintf(sendbuf, sizeof(sendbuf), "?%c%c%d:%d \n" NOPLUGIN_MESSAGE, asBinary+'0', codeSymb, chunkCount, fileSize);
sendCmd(0, CMD_REQ, sendbuf, filename);
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Request sent. Awaiting of acceptance.."));
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Request sent. Awaiting of acceptance.."));
setState(STATE_REQSENT);
}
-void FILEECHO::incomeRequest(TCHAR *param)
+void FILEECHO::incomeRequest(char *param)
{
// param: filename?cCOUNT:SIZE
- TCHAR buf[MAX_PATH];
+ char buf[MAX_PATH];
// param == &filename
- TCHAR *p = _tcschr(param, '?');
+ char *p = strchr(param, '?');
if(p == NULL) return; *p++ = 0;
CallService(MS_FILE_GETRECEIVEDFILESFOLDER, hContact, (LPARAM)buf);
- _tcsncat(buf, param, SIZEOF(buf));
- mir_free(filename);
- filename = mir_tstrdup(buf);
+ strncat(buf, param, sizeof(buf));
+ free(filename);
+ filename = strdup(buf);
// p == &c
if(*p == 0) return; asBinary = (*p++) != '0';
if(*p == 0) return; codeSymb = *p++;
// p == &COUNT
- if(*p == 0) return; param = _tcschr(p, ':');
+ if(*p == 0) return; param = strchr(p, ':');
// param == &SIZE
if(param == NULL) return; *param++ = 0;
if(*param == 0) return;
- chunkCountx = _ttoi(p);
- fileSize = _ttoi(param);
+ chunkCountx = atoi(p);
+ fileSize = atoi(param);
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("Size: %d bytes"), fileSize);
+ mir_snprintf(buf, sizeof(buf), Translate("Size: %d bytes"), fileSize);
SetDlgItemText(hDlg, IDC_FILENAME, filename);
SetDlgItemText(hDlg, IDC_FILESIZE, buf);
@@ -491,7 +490,7 @@ void FILEECHO::incomeRequest(TCHAR *param) cle.pszService = SERVICE_NAME "/FERecvFile";
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
- MakePopupMsg(hDlg, hContact, _T("Incoming file..."));
+ MakePopupMsg(hDlg, hContact, "Incoming file...");
}
}
@@ -499,7 +498,7 @@ void FILEECHO::cmdACCEPT() {
if(chunkCount == 0) return;
setState(STATE_OPERATE);
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Sending..."));
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Sending..."));
lastTimestamp = GetTickCount();
//PostMessage(hDlg, WM_TIMER, 0,0);
//onSendTimer();
@@ -518,8 +517,8 @@ void FILEECHO::updateProgress() void FILEECHO::onRecvTimer()
{
if(chunkCount == 0) return;
- TCHAR *buffer = (TCHAR *)malloc(1024);
- TCHAR *p = buffer;
+ char *buffer = (char*)malloc(1024);
+ char *p = buffer;
uchar prev_value;
uint indx, jndx;
@@ -559,7 +558,7 @@ void FILEECHO::onRecvTimer() *p = 0;
if(*buffer == 0)
{
- TCHAR *msg = TranslateT("Received successfully");
+ char *msg = Translate("Received successfully");
SetDlgItemText(hDlg, IDC_STATUS, msg);
MakePopupMsg(hDlg, hContact, msg);
setState(STATE_FINISHED);
@@ -594,9 +593,9 @@ void FILEECHO::onSendTimer() while(chunkIndx < chunkCount && chunkAck[chunkIndx] != CHUNK_UNSENT) chunkIndx++;
if(iState == STATE_ACKREQ || chunkIndx == chunkCount)
{
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Requesting of missing chunks"));
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Requesting of missing chunks"));
setState(STATE_OPERATE);
- sendCmd(0, CMD_END, _T(""), NULL);
+ sendCmd(0, CMD_END, "", NULL);
chunkIndx = chunkCount+1;
return;
}
@@ -635,12 +634,12 @@ void FILEECHO::onSendTimer() strncpy((char*)buffer, enc, chunkMaxLen*2);
}
- TCHAR prefix[128];
- mir_sntprintf(prefix, SIZEOF(prefix), _T("%X,%X,%X>"), chunkIndx+1, chunkPos[chunkIndx], chksum);
+ char prefix[128];
+ mir_snprintf(prefix, sizeof(prefix), "%X,%X,%X>", chunkIndx+1, chunkPos[chunkIndx], chksum);
#ifdef DEBUG
overhead += lstrlen((char*)buffer);
#endif
- sendCmd(0, CMD_DATA, _A2T((char*)buffer), prefix);
+ sendCmd(0, CMD_DATA, (char*)buffer, (char*)prefix);
chunkAck[chunkIndx] = CHUNK_SENT;
free(buffer);
@@ -651,12 +650,12 @@ void FILEECHO::onSendTimer() setState(STATE_ACKREQ);
else
{
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Sending..."));
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Sending..."));
updateProgress();
}
SetTimer(hDlg, TIMER_SEND, dwSendInterval, 0);
}
-void FILEECHO::cmdDATA(TCHAR *param)
+void FILEECHO::cmdDATA(char *param)
{
if(chunkCount == 0) return;
chunkIndx = atolx(param); param++;
@@ -701,7 +700,7 @@ void FILEECHO::cmdDATA(TCHAR *param) else
{
unsigned bufLen;
- mir_ptr<BYTE> buf((BYTE*)mir_base64_decode(_T2A(param), &bufLen));
+ mir_ptr<BYTE> buf((BYTE*)mir_base64_decode(param, &bufLen));
memcpy(data, buf, min(bufLen, unsigned(data_end - data)));
data += bufLen;
}
@@ -715,7 +714,7 @@ void FILEECHO::cmdDATA(TCHAR *param) chunkAck[chunkIndx] = CHUNK_ACK;
//chunkPos[chunkIndx++] = filepos;
}
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Receiving..."));
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Receiving..."));
updateProgress();
cmdDATA_corrupted:
//SetTimer(hDlg, TIMER_SEND, lastDelay*2, 0);
@@ -725,7 +724,7 @@ void FILEECHO::cmdEND() {
SetTimer(hDlg, TIMER_SEND, dwSendInterval, 0);
}
-void FILEECHO::cmdDACK(TCHAR *param)
+void FILEECHO::cmdDACK(char *param)
{
uint indx, jndx;
@@ -736,7 +735,7 @@ void FILEECHO::cmdDACK(TCHAR *param) // All chunks has been received successfully
//
{
- TCHAR *msg = TranslateT("Sent successfully");
+ char *msg = Translate("Sent successfully");
SetDlgItemText(hDlg, IDC_STATUS, msg);
SkinPlaySound("FileDone");
@@ -784,22 +783,22 @@ void FILEECHO::cmdDACK(TCHAR *param) SetTimer(hDlg, TIMER_SEND, dwSendInterval, 0);
}
-void FILEECHO::perform(TCHAR *str)
+void FILEECHO::perform(char *str)
{
int msgId = getMsgId(str);
if(msgId == -1)
{
- MakePopupMsg(hDlg, hContact, TranslateT("Unknown command for \"File As Message\" was received"));
+ MakePopupMsg(hDlg, hContact, Translate("Unknown command for \"File As Message\" was received"));
return;
}
if(inSend)
switch(msgId)
{
case CMD_REQ:
- if(MessageBox(hDlg, TranslateT("Incoming file request. Do you want to proceed?"),
- TranslateT(SERVICE_TITLE), MB_YESNO | MB_ICONWARNING) == IDYES)
+ if(MessageBox(hDlg, Translate("Incoming file request. Do you want to proceed?"),
+ Translate(SERVICE_TITLE), MB_YESNO | MB_ICONWARNING) == IDYES)
{
- SetDlgItemText(hDlg, IDC_STATUS, _T(""));
+ SetDlgItemText(hDlg, IDC_STATUS, "");
SendMessage(hDlg, WM_COMMAND, IDC_STOP, 0);
incomeRequest(str+1);
@@ -814,7 +813,7 @@ void FILEECHO::perform(TCHAR *str) {
if(iState & (STATE_PRERECV|STATE_REQSENT|STATE_OPERATE|STATE_ACKREQ|STATE_PAUSED))
{
- TCHAR *msg = TranslateT("Canceled by remote user");
+ char *msg = Translate("Canceled by remote user");
SetDlgItemText(hDlg, IDC_STATUS, msg);
MakePopupMsg(hDlg, hContact, msg);
destroyTransfer();
@@ -833,7 +832,7 @@ void FILEECHO::perform(TCHAR *str) {
if(iState & (STATE_PRERECV|STATE_REQSENT|STATE_OPERATE|STATE_ACKREQ|STATE_PAUSED))
{
- TCHAR *msg = TranslateT("Canceled by remote user");
+ char *msg = Translate("Canceled by remote user");
SetDlgItemText(hDlg, IDC_STATUS, msg);
MakePopupMsg(hDlg, hContact, msg);
destroyTransfer();
@@ -844,13 +843,13 @@ void FILEECHO::perform(TCHAR *str) case CMD_REQ:
if(chunkCount)
{
- if(MessageBox(hDlg, TranslateT("New incoming file request. Do you want to proceed?"),
- TranslateT(SERVICE_TITLE), MB_YESNO | MB_ICONWARNING) != IDYES)
+ if(MessageBox(hDlg, Translate("New incoming file request. Do you want to proceed?"),
+ Translate(SERVICE_TITLE), MB_YESNO | MB_ICONWARNING) != IDYES)
break;
//sendCmd(0, CMD_CANCEL, "", NULL);
destroyTransfer();
}
- SetDlgItemText(hDlg, IDC_STATUS, _T(""));
+ SetDlgItemText(hDlg, IDC_STATUS, "");
incomeRequest(str+1);
break;
case CMD_DATA:
@@ -862,7 +861,7 @@ void FILEECHO::perform(TCHAR *str) };
};
-int FILEECHO::sendCmd(int id, int cmd, TCHAR *szParam, TCHAR *szPrefix)
+int FILEECHO::sendCmd(int id, int cmd, char *szParam, char *szPrefix)
{
char *buf;
int retval;
@@ -882,15 +881,15 @@ int FILEECHO::sendCmd(int id, int cmd, TCHAR *szParam, TCHAR *szPrefix) }
-void CreateDirectoryTree(TCHAR *szDir)
+void CreateDirectoryTree(char *szDir)
{
DWORD dwAttributes;
- TCHAR *pszLastBackslash, szTestDir[MAX_PATH];
+ char *pszLastBackslash,szTestDir[MAX_PATH];
- lstrcpyn(szTestDir, szDir, SIZEOF(szTestDir));
+ lstrcpyn(szTestDir,szDir,sizeof(szTestDir));
if((dwAttributes=GetFileAttributes(szTestDir))!=0xffffffff
&& dwAttributes&FILE_ATTRIBUTE_DIRECTORY) return;
- pszLastBackslash=_tcsrchr(szTestDir,'\\');
+ pszLastBackslash=strrchr(szTestDir,'\\');
if(pszLastBackslash==NULL) {GetCurrentDirectory(MAX_PATH,szDir); return;}
*pszLastBackslash='\0';
CreateDirectoryTree(szTestDir);
@@ -1003,7 +1002,7 @@ LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa return mir_callNextSubclass(hwnd, ProgressWndProc, uMsg, wParam, lParam);
}
-INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
struct FILEECHO *dat = (struct FILEECHO*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
HWND hwndStatus = NULL;
@@ -1016,7 +1015,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) dat->updateTitle();
- hwndStatus = CreateStatusWindow(WS_CHILD | WS_VISIBLE, _T(""), hDlg, IDC_STATUS);
+ hwndStatus = CreateStatusWindow(WS_CHILD|WS_VISIBLE, "", hDlg, IDC_STATUS);
SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)dat);
WindowList_Add(hFileList, hDlg, dat->hContact);
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcons[ICON_MAIN]);
@@ -1043,8 +1042,8 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) }
case WM_FE_MESSAGE:
{
- dat->perform((TCHAR *)lParam);
- delete (TCHAR *)lParam;
+ dat->perform((char *)lParam);
+ delete (char *)lParam;
return TRUE;
}
@@ -1072,7 +1071,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
if(dat->iState & (STATE_OPERATE|STATE_ACKREQ))
{
- TCHAR *msg = TranslateT("File transfer is paused because of dropped connection");
+ char *msg = Translate("File transfer is paused because of dropped connection");
SetDlgItemText(hDlg, IDC_STATUS, msg);
MakePopupMsg(dat->hDlg, dat->hContact, msg);
dat->setState(STATE_PAUSED);
@@ -1106,7 +1105,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
int len = GetWindowTextLength(GetDlgItem(hDlg, IDC_FILENAME))+1;
free(dat->filename);
- dat->filename = (TCHAR*)malloc(len);
+ dat->filename = (char*)malloc(len);
GetDlgItemText(hDlg, IDC_FILENAME, dat->filename, len);
if(dat->inSend)
// Send offer to remote side
@@ -1116,20 +1115,20 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) else
// Send the accept and starting to receive
{
- TCHAR buff[MAX_PATH];
- TCHAR *bufname;
+ char buff[MAX_PATH];
+ char *bufname;
- GetFullPathName(dat->filename, SIZEOF(buff), buff, &bufname);
+ GetFullPathName(dat->filename, sizeof(buff), buff, &bufname);
*bufname = 0;
CreateDirectoryTree(buff);
if(!dat->createTransfer())
{
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Failed on file initialization"));
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Failed on file initialization"));
break;
}
- dat->sendCmd(0, CMD_ACCEPT, _T(""));
+ dat->sendCmd(0, CMD_ACCEPT, "");
dat->lastTimestamp = GetTickCount();
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Receiving..."));
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Receiving..."));
dat->setState(STATE_OPERATE);
}
}
@@ -1139,13 +1138,13 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
if(dat->iState == STATE_OPERATE)
{
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Paused..."));
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Paused..."));
dat->setState(STATE_PAUSED);
KillTimer(hDlg, TIMER_SEND);
}
else
{
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Sending..."));
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Sending..."));
if(dat->chunkIndx < dat->chunkCount)
dat->setState(STATE_OPERATE);
else
@@ -1157,7 +1156,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) }
else
{
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Synchronizing..."));
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Synchronizing..."));
dat->setState(STATE_ACKREQ);
PostMessage(hDlg, WM_TIMER, 0,0);
//dat->onRecvTimer();
@@ -1169,19 +1168,20 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) }
case IDC_BROWSE:
{
- TCHAR str[MAX_PATH];
- OPENFILENAME ofn = { 0 };
+ char str[MAX_PATH];
+ OPENFILENAME ofn;
+ ZeroMemory(&ofn, sizeof(ofn));
*str = 0;
- GetDlgItemText(hDlg, IDC_FILENAME, str, SIZEOF(str));
+ GetDlgItemText(hDlg, IDC_FILENAME, str, sizeof(str));
//ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hDlg;
//ofn.lpstrFilter = "*.*";
ofn.lpstrFile = str;
ofn.Flags = dat->inSend?OFN_FILEMUSTEXIST:0;
- ofn.lpstrTitle = dat->inSend?TranslateT("Select a file"):TranslateT("Save as");
- ofn.nMaxFile = SIZEOF(str);
+ ofn.lpstrTitle = dat->inSend?Translate("Select a file"):Translate("Save as");
+ ofn.nMaxFile = sizeof(str);
ofn.nMaxFileTitle = MAX_PATH;
if(!GetOpenFileName(&ofn)) break;
if(!dat->inSend && dat->iState == STATE_FINISHED) break;
@@ -1189,9 +1189,9 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) int size = RetrieveFileSize(str);
if(size != -1)
- mir_sntprintf(str, SIZEOF(str), TranslateT("Size: %d bytes"), size);
+ mir_snprintf(str, sizeof(str), Translate("Size: %d bytes"), size);
else
- mir_sntprintf(str, SIZEOF(str), TranslateT("Can't get a file size"), size);
+ mir_snprintf(str, sizeof(str), Translate("Can't get a file size"), size);
SetDlgItemText(hDlg, IDC_FILESIZE, str);
break;
@@ -1201,18 +1201,18 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case IDCANCEL:
if(dat->iState == STATE_PRERECV)
{
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Canceled by user"));
- dat->sendCmd(0, CMD_CANCEL, _T(""), NULL);
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Canceled by user"));
+ dat->sendCmd(0, CMD_CANCEL, "", NULL);
dat->setState(STATE_CANCELLED);
}
if(dat->chunkCount)
{
- if(MessageBox(hDlg, TranslateT("Transfer is in progress. Do you really want to close?"),
- TranslateT(SERVICE_TITLE), MB_ICONWARNING|MB_YESNO|MB_DEFBUTTON2) == IDYES)
+ if(MessageBox(hDlg, Translate("Transfer is in progress. Do you really want to close?"),
+ Translate(SERVICE_TITLE), MB_ICONWARNING|MB_YESNO|MB_DEFBUTTON2) == IDYES)
{
- SetDlgItemText(hDlg, IDC_STATUS, TranslateT("Canceled by user"));
+ SetDlgItemText(hDlg, IDC_STATUS, Translate("Canceled by user"));
dat->setState(STATE_CANCELLED);
- dat->sendCmd(0, CMD_CANCEL, _T(""), NULL);
+ dat->sendCmd(0, CMD_CANCEL, "", NULL);
dat->destroyTransfer();
if(wParam == IDCANCEL)
DestroyWindow(hDlg);
diff --git a/plugins/FileAsMessage/src/dialog.h b/plugins/FileAsMessage/src/dialog.h index cf6696f956..962781b661 100644 --- a/plugins/FileAsMessage/src/dialog.h +++ b/plugins/FileAsMessage/src/dialog.h @@ -64,7 +64,7 @@ public: HANDLE hFile, hMapping;
uchar *lpData;
- TCHAR *filename;
+ char *filename;
uint chunkIndx; // next chunk to send
uint chunkCount; // count of chunks
uint chunkSent;
@@ -96,13 +96,13 @@ public: void updateProgress();
void updateTitle();
- void perform(TCHAR *str);
+ void perform(char *str);
void cmdACCEPT();
- void cmdDACK(TCHAR *data);
+ void cmdDACK(char *data);
void sendReq();
- int sendCmd(int id, int cmd, TCHAR *szParam, TCHAR *szPrefix = NULL);
+ int sendCmd(int id, int cmd, char *szParam, char *szPrefix = NULL);
- void cmdDATA(TCHAR *data);
+ void cmdDATA(char *data);
void cmdEND();
int createTransfer();
@@ -110,7 +110,7 @@ public: void onSendTimer();
void onRecvTimer();
- void incomeRequest(TCHAR *data);
+ void incomeRequest(char *data);
};
diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index bea4aead0b..72165723c6 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -20,7 +20,7 @@ HINSTANCE hInst; int hLangpack;
char *szServiceTitle = SERVICE_TITLE;
-TCHAR *szServicePrefix = SERVICE_PREFIX;
+char *szServicePrefix = SERVICE_PREFIX;
HANDLE hHookDbSettingChange, hHookContactAdded, hHookSkinIconsChanged;
HICON hIcons[5];
@@ -118,9 +118,8 @@ INT_PTR OnRecvMessage(WPARAM wParam, LPARAM lParam) {
CCSDATA *pccsd = (CCSDATA *)lParam;
PROTORECVEVENT *ppre = ( PROTORECVEVENT * )pccsd->lParam;
- ppre->flags = PREF_TCHAR;
- if(_tcsncmp(ppre->tszMessage, szServicePrefix, _tcslen(szServicePrefix)))
+ if(strncmp(ppre->szMessage, szServicePrefix, strlen(szServicePrefix)))
return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
HWND hwnd = WindowList_Find(hFileList, pccsd->hContact);
@@ -136,7 +135,7 @@ INT_PTR OnRecvMessage(WPARAM wParam, LPARAM lParam) return 0;
}
}
- TCHAR *msg = _tcsdup(ppre->tszMessage + _tcslen(szServicePrefix));
+ char *msg = strdup(ppre->szMessage + strlen(szServicePrefix));
PostMessage(hwnd, WM_FE_MESSAGE, (WPARAM)pccsd->hContact, (LPARAM)msg);
return 0;
diff --git a/plugins/FileAsMessage/src/main.h b/plugins/FileAsMessage/src/main.h index 3413b26c32..001b24de2e 100644 --- a/plugins/FileAsMessage/src/main.h +++ b/plugins/FileAsMessage/src/main.h @@ -29,12 +29,12 @@ #define SERVICE_TITLE LPGEN("File As Message")
#define SERVICE_NAME "FileAsMessage"
-#define SERVICE_PREFIX _T("<%fAM-0023%>")
+#define SERVICE_PREFIX "<%fAM-0023%>"
-#define NOPLUGIN_MESSAGE _T("If you see this \"garbage\", probably you have no \"fileAsMessage\" plugin installed, see http://miranda-ng.org/p/FileAsMessage/ for more information and download.")
+#define NOPLUGIN_MESSAGE "If you see this \"garbage\", probably you have no \"fileAsMessage\" plugin installed, see http://miranda-ng.org/p/FileAsMessage/ for more information and download."
extern char *szServiceTitle;
-extern TCHAR *szServicePrefix;
+extern char *szServicePrefix;
extern const ulong INITCRC;
#define WM_FE_MESSAGE WM_USER+100
|