diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-31 15:29:24 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-31 15:29:24 +0000 |
commit | 9ac20243efe27f58501c59060a4f22c37104c0e3 (patch) | |
tree | cf00f03c151d21e062a46f1a85eeb0be8a9342f2 /protocols | |
parent | 2738cf4311501acfc1b0e2de74b51b0edc18cdd2 (diff) |
- PROTOCOLDESCRIPTOR_V3_SIZE to identify an ANSI plugin;
- absence of fnInitFunc to identify a protocol without instances;
- whole bunch of ansi crutches discarded
git-svn-id: http://svn.miranda-ng.org/main/trunk@13937 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
44 files changed, 276 insertions, 260 deletions
diff --git a/protocols/AimOscar/src/aim.cpp b/protocols/AimOscar/src/aim.cpp index d6904e1d21..f4f0e39df2 100644 --- a/protocols/AimOscar/src/aim.cpp +++ b/protocols/AimOscar/src/aim.cpp @@ -103,7 +103,8 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "AIM";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index 62d671ee71..5cb097c4ac 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -1343,12 +1343,12 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = mir_utf8decodeT(msg_buf);
- pre.ptszFiles = &filenameT;
+ pre.descr.t = mir_utf8decodeT(msg_buf);
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
- mir_free(pre.tszDescription);
+ mir_free(pre.descr.t);
mir_free(filenameT);
char cip[20];
diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp index b2837e36af..ec1c2e52eb 100644 --- a/protocols/Dummy/src/main.cpp +++ b/protocols/Dummy/src/main.cpp @@ -81,7 +81,8 @@ extern "C" int __declspec(dllexport) Load() mir_getCLI(); // Register protocol module - PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; + PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "Dummy"; pd.fnInit = (pfnInitProto)dummyProtoInit; pd.fnUninit = (pfnUninitProto)dummyProtoUninit; diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp index e55450b78c..0fa30147f4 100644 --- a/protocols/FacebookRM/src/main.cpp +++ b/protocols/FacebookRM/src/main.cpp @@ -92,7 +92,8 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo);
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = FACEBOOK_NAME;
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index c4bc303fa9..5a65872b68 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -776,7 +776,7 @@ retry: {
// Status was changed by the user simultaneously logged on using different Miranda account or IM client
int iStatus = status_gg2m(e->event.status60.status);
- CallProtoService(m_szModuleName, PS_SETAWAYMSGT, iStatus, (LPARAM)descrT);
+ CallProtoService(m_szModuleName, PS_SETAWAYMSG, iStatus, (LPARAM)descrT);
CallProtoService(m_szModuleName, PS_SETSTATUS, iStatus, 0);
}
@@ -1060,8 +1060,8 @@ retry: pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = filenameT;
- pre.ptszFiles = &filenameT;
+ pre.descr.t = filenameT;
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)dcc7;
ProtoChainRecvFile((MCONTACT)dcc7->contact, &pre);
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 3190ac35bb..230784f6c9 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -386,8 +386,8 @@ void __cdecl GGPROTO::dccmainthread(void*) pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = filenameT;
- pre.ptszFiles = &filenameT;
+ pre.descr.t = filenameT;
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)local_dcc;
gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 7, "ft_mutex", 1);
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 45fd51745f..0b1aa1d837 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -340,7 +340,8 @@ extern "C" int __declspec(dllexport) Load(void) hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, gg_modulesloaded);
// Prepare protocol name
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = GGDEF_PROTO;
pd.fnInit = (pfnInitProto)gg_proto_init;
pd.fnUninit = (pfnUninitProto)gg_proto_uninit;
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index f4ec6475b2..3c9380a83c 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -57,7 +57,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) : CreateProtoService(PS_SETMYAVATART, &GGPROTO::setmyavatar);
CreateProtoService(PS_GETMYAWAYMSG, &GGPROTO::getmyawaymsg);
- CreateProtoService(PS_SETAWAYMSGT, (MyServiceFunc)&GGPROTO::SetAwayMsg);
+ CreateProtoService(PS_SETAWAYMSG, (MyServiceFunc)&GGPROTO::SetAwayMsg);
CreateProtoService(PS_CREATEACCMGRUI, &GGPROTO::get_acc_mgr_gui);
CreateProtoService(PS_LEAVECHAT, &GGPROTO::leavechat);
diff --git a/protocols/ICQCorp/src/corp.cpp b/protocols/ICQCorp/src/corp.cpp index 7b27d31966..08619f9d9f 100644 --- a/protocols/ICQCorp/src/corp.cpp +++ b/protocols/ICQCorp/src/corp.cpp @@ -61,22 +61,21 @@ extern "C" __declspec(dllexport) int Load() {
mir_getLP(&pluginInfo);
+ char fileName[MAX_PATH];
+ WIN32_FIND_DATA findData;
+
+ GetModuleFileName(hInstance, fileName, MAX_PATH);
+ FindClose(FindFirstFile(fileName, &findData));
+ findData.cFileName[mir_strlen(findData.cFileName) - 4] = 0;
+ mir_strcpy(protoName, findData.cFileName);
+
PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = protoName;
pd.type = PROTOTYPE_PROTOCOL;
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
- char fileName[MAX_PATH];
- WIN32_FIND_DATA findData;
-
- GetModuleFileName(hInstance, fileName, MAX_PATH);
- FindClose(FindFirstFile(fileName, &findData));
- findData.cFileName[mir_strlen(findData.cFileName) - 4] = 0;
- mir_strcpy(protoName, findData.cFileName);
-
- CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
-
- LoadServices();
- return 0;
+ LoadServices();
+ return 0;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 4c2e783f9e..e6cdea96ee 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -1164,7 +1164,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) pre.dwFlags = PRFF_TCHAR;
pre.timestamp = (DWORD)time(NULL);
pre.fileCount = 1;
- pre.ptszFiles = &tszTemp;
+ pre.files.t = &tszTemp;
pre.lParam = (LPARAM)di;
ProtoChainRecvFile(hContact, &pre);
}
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp index 743dbe1741..7f91134cc1 100644 --- a/protocols/IRCG/src/main.cpp +++ b/protocols/IRCG/src/main.cpp @@ -95,7 +95,8 @@ extern "C" int __declspec(dllexport) Load() InitContactMenus();
// register protocol
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "IRC";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)ircProtoInit;
diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp index 9d6891dfb6..6dd10110d6 100644 --- a/protocols/IcqOscarJ/src/icq_filerequests.cpp +++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp @@ -158,12 +158,12 @@ void CIcqProto::handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = mir_utf8decodeT(pszDescription);
- pre.ptszFiles = &ptszFileName;
+ pre.descr.t = mir_utf8decodeT(pszDescription);
+ pre.files.t = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
- mir_free(pre.tszDescription);
+ mir_free(pre.descr.t);
mir_free(ptszFileName);
}
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index 735b17bf80..a2d005fe47 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -102,7 +102,8 @@ extern "C" int __declspec(dllexport) Load(void) _tzset();
// Register the module
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = ICQ_PROTOCOL_NAME;
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = icqProtoInit;
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index a229dda6a3..cb070ec4bd 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -505,12 +505,12 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char * pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = mir_utf8decodeT(pszDescription);
- pre.ptszFiles = &ptszFileName;
+ pre.descr.t = mir_utf8decodeT(pszDescription);
+ pre.files.t = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
- mir_free(pre.tszDescription);
+ mir_free(pre.descr.t);
mir_free(ptszFileName);
}
else if (wAckType == 2) { // First attempt failed, reverse requested
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 92b8c8872f..97d203b105 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -206,7 +206,8 @@ extern "C" int __declspec(dllexport) Load() hDiscoInfoResult = CreateHookableEvent(ME_JABBER_SRVDISCOINFO);
// Register protocol module
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "JABBER";
pd.fnInit = (pfnInitProto)jabberProtoInit;
pd.fnUninit = (pfnUninitProto)jabberProtoUninit;
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 34688fc5eb..9b19832a8c 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -364,10 +364,10 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.ptszFiles = (TCHAR**)&filename;
+ pre.files.t = (TCHAR**)&filename;
pre.lParam = (LPARAM)ft;
if ((n = xmlGetChild(fileNode , "desc")) != NULL)
- pre.tszDescription = (TCHAR*)xmlGetText(n);
+ pre.descr.t = (TCHAR*)xmlGetText(n);
ProtoChainRecvFile(ft->std.hContact, &pre);
return;
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 9e6c191168..131a3b0ced 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -675,8 +675,8 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) PROTORECVFILET pre;
pre.dwFlags = PRFF_TCHAR;
pre.timestamp = time(NULL);
- pre.tszDescription = desc;
- pre.ptszFiles = &str2;
+ pre.descr.t = desc;
+ pre.files.t = &str2;
pre.fileCount = 1;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index 8cca0b3109..06cd7a8fa2 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -37,49 +37,49 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int JabberSearchFrameProc(HWND hwnd, int msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_COMMAND && lParam != 0) { - HWND hwndDlg=GetParent(hwnd); - JabberSearchData * dat=(JabberSearchData *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + HWND hwndDlg = GetParent(hwnd); + JabberSearchData *dat = (JabberSearchData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (dat && lParam) { - int pos=dat->curPos; + int pos = dat->curPos; RECT MineRect; RECT FrameRect; - GetWindowRect(GetDlgItem(hwndDlg, IDC_FRAME),&FrameRect); + GetWindowRect(GetDlgItem(hwndDlg, IDC_FRAME), &FrameRect); GetWindowRect((HWND)lParam, &MineRect); - if (MineRect.top-10 < FrameRect.top) { - pos=dat->curPos+(MineRect.top-14-FrameRect.top); - if (pos<0) pos=0; + if (MineRect.top - 10 < FrameRect.top) { + pos = dat->curPos + (MineRect.top - 14 - FrameRect.top); + if (pos < 0) pos = 0; } else if (MineRect.bottom > FrameRect.bottom) { - pos=dat->curPos+(MineRect.bottom-FrameRect.bottom); - if (dat->frameHeight+pos>dat->CurrentHeight) - pos=dat->CurrentHeight-dat->frameHeight; + pos = dat->curPos + (MineRect.bottom - FrameRect.bottom); + if (dat->frameHeight + pos > dat->CurrentHeight) + pos = dat->CurrentHeight - dat->frameHeight; } if (pos != dat->curPos) { - ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - pos, NULL, &(dat->frameRect)); + ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - pos, NULL, &(dat->frameRect)); SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, pos, TRUE); - RECT Invalid=dat->frameRect; - if (dat->curPos - pos >0) - Invalid.bottom=Invalid.top+(dat->curPos - pos); + RECT Invalid = dat->frameRect; + if (dat->curPos - pos > 0) + Invalid.bottom = Invalid.top + (dat->curPos - pos); else - Invalid.top=Invalid.bottom+(dat->curPos - pos); + Invalid.top = Invalid.bottom + (dat->curPos - pos); - RedrawWindow(GetDlgItem(hwndDlg, IDC_FRAME), NULL, NULL, RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW |RDW_ALLCHILDREN); + RedrawWindow(GetDlgItem(hwndDlg, IDC_FRAME), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); dat->curPos = pos; } } - if (HIWORD(wParam)==EN_SETFOCUS) { //Transmit focus set notification to parent window - PostMessage(GetParent(hwndDlg),WM_COMMAND, MAKEWPARAM(0,EN_SETFOCUS), (LPARAM)hwndDlg); + if (HIWORD(wParam) == EN_SETFOCUS) { //Transmit focus set notification to parent window + PostMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(0, EN_SETFOCUS), (LPARAM)hwndDlg); } } if (msg == WM_PAINT) { PAINTSTRUCT ps; - HDC hdc=BeginPaint(hwnd, &ps); - FillRect(hdc,&(ps.rcPaint),GetSysColorBrush(COLOR_BTNFACE)); + HDC hdc = BeginPaint(hwnd, &ps); + FillRect(hdc, &(ps.rcPaint), GetSysColorBrush(COLOR_BTNFACE)); EndPaint(hwnd, &ps); } - return DefWindowProc(hwnd,msg,wParam,lParam); + return DefWindowProc(hwnd, msg, wParam, lParam); } /////////////////////////////////////////////////////////////////////////////// @@ -91,42 +91,42 @@ static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat) return FALSE; HFONT hFont = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0); - HWND hwndParent=GetDlgItem(hwndDlg,IDC_FRAME); + HWND hwndParent = GetDlgItem(hwndDlg, IDC_FRAME); LONG_PTR frameExStyle = GetWindowLongPtr(hwndParent, GWL_EXSTYLE); frameExStyle |= WS_EX_CONTROLPARENT; SetWindowLongPtr(hwndParent, GWL_EXSTYLE, frameExStyle); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_FRAME),GWLP_WNDPROC,(LONG_PTR)JabberSearchFrameProc); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWLP_WNDPROC, (LONG_PTR)JabberSearchFrameProc); - int CornerX=1; - int CornerY=1; + int CornerX = 1; + int CornerY = 1; RECT rect; - GetClientRect(hwndParent,&rect); - int width=rect.right-5-CornerX; + GetClientRect(hwndParent, &rect); + int width = rect.right - 5 - CornerX; - int Order=(FieldDat->bHidden) ? -1 : FieldDat->Order; + int Order = (FieldDat->bHidden) ? -1 : FieldDat->Order; - HWND hwndLabel=CreateWindowEx(0,_T("STATIC"),(LPCTSTR)TranslateTS(FieldDat->Label),WS_CHILD, CornerX, CornerY + Order*40, width, 13,hwndParent,NULL,hInst,0); - HWND hwndVar=CreateWindowEx(0|WS_EX_CLIENTEDGE,_T("EDIT"),(LPCTSTR)FieldDat->defValue,WS_CHILD|WS_TABSTOP, CornerX+5, CornerY + Order*40+14, width ,20,hwndParent,NULL,hInst,0); - SendMessage(hwndLabel, WM_SETFONT, (WPARAM)hFont,0); - SendMessage(hwndVar, WM_SETFONT, (WPARAM)hFont,0); + HWND hwndLabel = CreateWindowEx(0, _T("STATIC"), (LPCTSTR)TranslateTS(FieldDat->Label), WS_CHILD, CornerX, CornerY + Order * 40, width, 13, hwndParent, NULL, hInst, 0); + HWND hwndVar = CreateWindowEx(0 | WS_EX_CLIENTEDGE, _T("EDIT"), (LPCTSTR)FieldDat->defValue, WS_CHILD | WS_TABSTOP, CornerX + 5, CornerY + Order * 40 + 14, width, 20, hwndParent, NULL, hInst, 0); + SendMessage(hwndLabel, WM_SETFONT, (WPARAM)hFont, 0); + SendMessage(hwndVar, WM_SETFONT, (WPARAM)hFont, 0); if (!FieldDat->bHidden) { - ShowWindow(hwndLabel,SW_SHOW); - ShowWindow(hwndVar,SW_SHOW); - EnableWindow(hwndLabel,!FieldDat->bReadOnly); - SendMessage(hwndVar, EM_SETREADONLY, (WPARAM)FieldDat->bReadOnly,0); + ShowWindow(hwndLabel, SW_SHOW); + ShowWindow(hwndVar, SW_SHOW); + EnableWindow(hwndLabel, !FieldDat->bReadOnly); + SendMessage(hwndVar, EM_SETREADONLY, (WPARAM)FieldDat->bReadOnly, 0); } //remade list //reallocation - JabberSearchData *dat=(JabberSearchData *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + JabberSearchData *dat = (JabberSearchData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (dat) { - dat->pJSInf=(JabberSearchFieldsInfo*)realloc(dat->pJSInf, sizeof(JabberSearchFieldsInfo)*(dat->nJSInfCount+1)); - dat->pJSInf[dat->nJSInfCount].hwndCaptionItem=hwndLabel; - dat->pJSInf[dat->nJSInfCount].hwndValueItem=hwndVar; - dat->pJSInf[dat->nJSInfCount].szFieldCaption=_tcsdup(FieldDat->Label); - dat->pJSInf[dat->nJSInfCount].szFieldName=_tcsdup(FieldDat->Var); + dat->pJSInf = (JabberSearchFieldsInfo*)realloc(dat->pJSInf, sizeof(JabberSearchFieldsInfo)*(dat->nJSInfCount + 1)); + dat->pJSInf[dat->nJSInfCount].hwndCaptionItem = hwndLabel; + dat->pJSInf[dat->nJSInfCount].hwndValueItem = hwndVar; + dat->pJSInf[dat->nJSInfCount].szFieldCaption = _tcsdup(FieldDat->Label); + dat->pJSInf[dat->nJSInfCount].szFieldName = _tcsdup(FieldDat->Var); dat->nJSInfCount++; } - return CornerY + Order*40+14 +20; + return CornerY + Order * 40 + 14 + 20; } //////////////////////////////////////////////////////////////////////////////// @@ -145,33 +145,33 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) HXML queryNode = xmlGetNthChild(iqNode, _T("query"), 1); HXML xNode = xmlGetChildByTag(queryNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS); - ShowWindow(searchHandleDlg,SW_HIDE); + ShowWindow(searchHandleDlg, SW_HIDE); if (xNode) { //1. Form - PostMessage(searchHandleDlg, WM_USER+11, (WPARAM)xi.copyNode(xNode), 0); + PostMessage(searchHandleDlg, WM_USER + 11, (WPARAM)xi.copyNode(xNode), 0); HXML xcNode = xmlGetNthChild(xNode, _T("instructions"), 1); if (xcNode) SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, xmlGetText(xcNode)); } else { - int Order=0; - for (int i=0; ; i++) { + int Order = 0; + for (int i = 0;; i++) { HXML chNode = xmlGetChild(queryNode, i); if (!chNode) break; if (!mir_tstrcmpi(xmlGetName(chNode), _T("instructions")) && xmlGetText(chNode)) - SetDlgItemText(searchHandleDlg,IDC_INSTRUCTIONS,TranslateTS(xmlGetText(chNode))); + SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, TranslateTS(xmlGetText(chNode))); else if (xmlGetName(chNode)) { - Data *MyData=(Data*)malloc(sizeof(Data)); - memset(MyData,0,sizeof(Data)); + Data *MyData = (Data*)malloc(sizeof(Data)); + memset(MyData, 0, sizeof(Data)); MyData->Label = mir_tstrdup(xmlGetName(chNode)); MyData->Var = mir_tstrdup(xmlGetName(chNode)); MyData->defValue = mir_tstrdup(xmlGetText(chNode)); MyData->Order = Order; if (MyData->defValue) MyData->bReadOnly = TRUE; - PostMessage(searchHandleDlg,WM_USER+10,FALSE,(LPARAM)MyData); + PostMessage(searchHandleDlg, WM_USER + 10, FALSE, (LPARAM)MyData); Order++; } } @@ -179,13 +179,13 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) const TCHAR *szFrom = xmlGetAttrValue(iqNode, _T("from")); if (szFrom) - SearchAddToRecent(szFrom,searchHandleDlg); - PostMessage(searchHandleDlg,WM_USER+10,0,0); - ShowWindow(searchHandleDlg,SW_SHOW); + SearchAddToRecent(szFrom, searchHandleDlg); + PostMessage(searchHandleDlg, WM_USER + 10, 0, 0); + ShowWindow(searchHandleDlg, SW_SHOW); } else if (!mir_tstrcmp(type, _T("error"))) { - const TCHAR *code=NULL; - const TCHAR *description=NULL; + const TCHAR *code = NULL; + const TCHAR *description = NULL; TCHAR buff[255]; HXML errorNode = xmlGetChild(iqNode, "error"); if (errorNode) { @@ -193,7 +193,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) description = xmlGetText(errorNode); } mir_sntprintf(buff, SIZEOF(buff), TranslateT("Error %s %s\r\nPlease select other server"), code ? code : _T(""), description ? description : _T("")); - SetDlgItemText(searchHandleDlg,IDC_INSTRUCTIONS,buff); + SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, buff); } else SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, TranslateT("Error: unknown reply received\r\nPlease select other server")); } @@ -207,20 +207,21 @@ static TCHAR *nickfields[] = { _T("nick"), _T("nickname"), _T("fullname"), _T("n void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_MAP * pmAllFields) { - LIST<TCHAR> ListOfNonEmptyFields(20,(LIST<TCHAR>::FTSortFunc)TCharKeyCmp); + LIST<TCHAR> ListOfNonEmptyFields(20, (LIST<TCHAR>::FTSortFunc)TCharKeyCmp); LIST<TCHAR> ListOfFields(20); LIST<void>* plUsersInfo = (LIST<void>*)pvUsersInfo; int i, nUsersFound = plUsersInfo->getCount(); // lets fill the ListOfNonEmptyFields but in users order - for (i=0; i < nUsersFound; i++) { + for (i = 0; i < nUsersFound; i++) { U_TCHAR_MAP* pmUserData = (U_TCHAR_MAP*)plUsersInfo->operator [](i); int nUserFields = pmUserData->getCount(); - for (int j=0; j < nUserFields; j++) { + for (int j = 0; j < nUserFields; j++) { TCHAR *var = pmUserData->getKeyName(j); if (var && ListOfNonEmptyFields.getIndex(var) < 0) - ListOfNonEmptyFields.insert(var); - } } + ListOfNonEmptyFields.insert(var); + } + } // now fill the ListOfFields but order is from pmAllFields int nAllCount = pmAllFields->getCount(); @@ -240,27 +241,27 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M Results.nFieldCount = nFieldCount; /* Sending Columns Titles */ - for (i=0; i < nFieldCount; i++) { + for (i = 0; i < nFieldCount; i++) { TCHAR *var = ListOfFields[i]; if (var) Results.pszFields[i] = pmAllFields->operator [](var); } Results.psr.cbSize = 0; // sending column names - ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM) &Results); + ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM)&Results); /* Sending Users Data */ Results.psr.cbSize = sizeof(Results.psr); // sending user data - for (i=0; i < nUsersFound; i++) { + for (i = 0; i < nUsersFound; i++) { TCHAR buff[200]; buff[0] = 0; - U_TCHAR_MAP *pmUserData = (U_TCHAR_MAP *) plUsersInfo->operator [](i); - for (int j=0; j < nFieldCount; j++) { + U_TCHAR_MAP *pmUserData = (U_TCHAR_MAP *)plUsersInfo->operator [](i); + for (int j = 0; j < nFieldCount; j++) { TCHAR *var = ListOfFields[j]; TCHAR *value = pmUserData->operator [](var); Results.pszFields[j] = value ? value : (TCHAR *)_T(" "); - if (!mir_tstrcmpi(var,_T("jid")) && value) + if (!mir_tstrcmpi(var, _T("jid")) && value) Results.psr.id.t = value; } @@ -279,7 +280,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M Results.psr.nick.t = nick; Results.psr.flags = PSR_TCHAR; - ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM) &Results); + ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM)&Results); Results.psr.nick.t = NULL; } mir_free(Results.pszFields); @@ -324,9 +325,11 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) if (var) { TCHAR *Label = (TCHAR*)xmlGetAttrValue(fieldNode, _T("label")); mColumnsNames.insert(var, (Label != NULL) ? Label : var); - } } } + } + } + } - int i=1; + int i = 1; HXML itemNode; while (itemNode = xmlGetNthChild(xNode, _T("item"), i++)) { U_TCHAR_MAP *pUserColumn = new U_TCHAR_MAP(10); @@ -335,26 +338,28 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) if (TCHAR* var = (TCHAR*)xmlGetAttrValue(fieldNode, _T("var"))) { if (TCHAR* Text = (TCHAR*)xmlGetText(xmlGetChild(fieldNode, _T("value")))) { if (!mColumnsNames[var]) - mColumnsNames.insert(var,var); - pUserColumn->insert(var,Text); - } } } + mColumnsNames.insert(var, var); + pUserColumn->insert(var, Text); + } + } + } SearchResults.insert((void*)pUserColumn); } } else { //2. Field list search results info - int i=1; + int i = 1; while (HXML itemNode = xmlGetNthChild(queryNode, _T("item"), i++)) { - U_TCHAR_MAP *pUserColumn=new U_TCHAR_MAP(10); + U_TCHAR_MAP *pUserColumn = new U_TCHAR_MAP(10); TCHAR *jid = (TCHAR*)xmlGetAttrValue(itemNode, _T("jid")); TCHAR *keyReturned; - mColumnsNames.insertCopyKey(_T("jid"),_T("jid"),&keyReturned, CopyKey, DestroyKey); + mColumnsNames.insertCopyKey(_T("jid"), _T("jid"), &keyReturned, CopyKey, DestroyKey); mColumnsNames.insert(_T("jid"), keyReturned); pUserColumn->insertCopyKey(_T("jid"), jid, NULL, CopyKey, DestroyKey); - for (int j=0; ; j++) { + for (int j = 0;; j++) { HXML child = xmlGetChild(itemNode, j); if (!child) break; @@ -363,19 +368,22 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) if (szColumnName) { LPCTSTR ptszChild = xmlGetText(child); if (ptszChild && *ptszChild) { - mColumnsNames.insertCopyKey((TCHAR*)szColumnName,_T(""),&keyReturned, CopyKey, DestroyKey); - mColumnsNames.insert((TCHAR*)szColumnName,keyReturned); + mColumnsNames.insertCopyKey((TCHAR*)szColumnName, _T(""), &keyReturned, CopyKey, DestroyKey); + mColumnsNames.insert((TCHAR*)szColumnName, keyReturned); pUserColumn->insertCopyKey((TCHAR*)szColumnName, (TCHAR*)ptszChild, NULL, CopyKey, DestroyKey); - } } } + } + } + } SearchResults.insert((void*)pUserColumn); - } } + } + } } else if (!mir_tstrcmp(type, _T("error"))) { const TCHAR *code = NULL; const TCHAR *description = NULL; TCHAR buff[255]; - HXML errorNode = xmlGetChild(iqNode , "error"); + HXML errorNode = xmlGetChild(iqNode, "error"); if (errorNode) { code = xmlGetAttrValue(errorNode, _T("code")); description = xmlGetText(errorNode); @@ -384,15 +392,15 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) mir_sntprintf(buff, SIZEOF(buff), TranslateT("Error %s %s\r\nTry to specify more detailed"), code ? code : _T(""), description ? description : _T("")); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0); if (searchHandleDlg) - SetDlgItemText(searchHandleDlg,IDC_INSTRUCTIONS,buff); + SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, buff); else - MessageBox(NULL, buff, TranslateT("Search error"), MB_OK|MB_ICONSTOP); + MessageBox(NULL, buff, TranslateT("Search error"), MB_OK | MB_ICONSTOP); return; } SearchReturnResults((HANDLE)id, (void*)&SearchResults, (U_TCHAR_MAP *)&mColumnsNames); - for (int i=0; i < SearchResults.getCount(); i++) + for (int i = 0; i < SearchResults.getCount(); i++) delete ((U_TCHAR_MAP *)SearchResults[i]); //send success to finish searching @@ -407,9 +415,8 @@ static BOOL CALLBACK DeleteChildWindowsProc(HWND hwnd, LPARAM) static void JabberSearchFreeData(HWND hwndDlg, JabberSearchData * dat) { - //lock if (!dat->fSearchRequestIsXForm && dat->nJSInfCount && dat->pJSInf) { - for (int i=0; i < dat->nJSInfCount; i++) { + for (int i = 0; i < dat->nJSInfCount; i++) { if (dat->pJSInf[i].hwndValueItem) DestroyWindow(dat->pJSInf[i].hwndValueItem); if (dat->pJSInf[i].hwndCaptionItem) @@ -420,42 +427,41 @@ static void JabberSearchFreeData(HWND hwndDlg, JabberSearchData * dat) free(dat->pJSInf[i].szFieldName); } free(dat->pJSInf); - dat->pJSInf=NULL; + dat->pJSInf = NULL; } - else EnumChildWindows(GetDlgItem(hwndDlg,IDC_FRAME),DeleteChildWindowsProc,0); + else EnumChildWindows(GetDlgItem(hwndDlg, IDC_FRAME), DeleteChildWindowsProc, 0); if (dat->xNode) xi.destroyNode(dat->xNode); - SendDlgItemMessage(hwndDlg,IDC_FRAME, WM_SETFONT, (WPARAM)SendMessage(hwndDlg, WM_GETFONT, 0, 0),0); - dat->nJSInfCount=0; - ShowWindow(GetDlgItem(hwndDlg,IDC_VSCROLL),SW_HIDE); - SetDlgItemText(hwndDlg,IDC_INSTRUCTIONS,TranslateT("Select/type search service URL above and press <Go>")); - //unlock + SendDlgItemMessage(hwndDlg, IDC_FRAME, WM_SETFONT, (WPARAM)SendMessage(hwndDlg, WM_GETFONT, 0, 0), 0); + dat->nJSInfCount = 0; + ShowWindow(GetDlgItem(hwndDlg, IDC_VSCROLL), SW_HIDE); + SetDlgItemText(hwndDlg, IDC_INSTRUCTIONS, TranslateT("Select/type search service URL above and press <Go>")); } -static void JabberSearchRefreshFrameScroll(HWND hwndDlg, JabberSearchData * dat) +static void JabberSearchRefreshFrameScroll(HWND hwndDlg, JabberSearchData *dat) { HWND hFrame = GetDlgItem(hwndDlg, IDC_FRAME); HWND hwndScroll = GetDlgItem(hwndDlg, IDC_VSCROLL); RECT rc; GetClientRect(hFrame, &rc); GetClientRect(hFrame, &dat->frameRect); - dat->frameHeight = rc.bottom-rc.top; + dat->frameHeight = rc.bottom - rc.top; if (dat->frameHeight < dat->CurrentHeight) { ShowWindow(hwndScroll, SW_SHOW); EnableWindow(hwndScroll, TRUE); } else ShowWindow(hwndScroll, SW_HIDE); - SetScrollRange(hwndScroll, SB_CTL, 0, dat->CurrentHeight-dat->frameHeight, FALSE); + SetScrollRange(hwndScroll, SB_CTL, 0, dat->CurrentHeight - dat->frameHeight, FALSE); } -int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData * dat) +int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData *dat) { TCHAR szServerName[100]; - EnableWindow(GetDlgItem(hwndDlg, IDC_GO),FALSE); - GetDlgItemText(hwndDlg,IDC_SERVER,szServerName,SIZEOF(szServerName)); + EnableWindow(GetDlgItem(hwndDlg, IDC_GO), FALSE); + GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, SIZEOF(szServerName)); dat->CurrentHeight = 0; dat->curPos = 0; SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, 0, FALSE); @@ -463,7 +469,7 @@ int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData * dat) JabberSearchFreeData(hwndDlg, dat); JabberSearchRefreshFrameScroll(hwndDlg, dat); - SetDlgItemText(hwndDlg,IDC_INSTRUCTIONS,m_bJabberOnline ? TranslateT("Please wait...\r\nConnecting search server...") : TranslateT("You have to be connected to server")); + SetDlgItemText(hwndDlg, IDC_INSTRUCTIONS, m_bJabberOnline ? TranslateT("Please wait...\r\nConnecting search server...") : TranslateT("You have to be connected to server")); if (!m_bJabberOnline) return 0; @@ -471,13 +477,13 @@ int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData * dat) searchHandleDlg = hwndDlg; CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultGetSearchFields, JABBER_IQ_TYPE_GET, szServerName); - m_ThreadInfo->send( XmlNodeIq(pInfo) << XQUERY(_T("jabber:iq:search"))); + m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(_T("jabber:iq:search"))); return pInfo->GetIqId(); } static void JabberSearchAddUrlToRecentCombo(HWND hwndDlg, const TCHAR *szAddr) { - int lResult = SendDlgItemMessage(hwndDlg, IDC_SERVER, (UINT) CB_FINDSTRING, 0, (LPARAM)szAddr); + int lResult = SendDlgItemMessage(hwndDlg, IDC_SERVER, (UINT)CB_FINDSTRING, 0, (LPARAM)szAddr); if (lResult == -1) SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)szAddr); } @@ -485,14 +491,14 @@ static void JabberSearchAddUrlToRecentCombo(HWND hwndDlg, const TCHAR *szAddr) void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFromDB) { //search in recent - for (int i=0; i<10; i++) { + for (int i = 0; i < 10; i++) { char key[30]; mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i); - ptrT szValue( getTStringA(key)); + ptrT szValue(getTStringA(key)); if (szValue == NULL || mir_tstrcmpi(szAddr, szValue)) continue; - for (int j=i; j < 10; j++) { + for (int j = i; j < 10; j++) { mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j + 1); szValue = getTStringA(key); if (szValue != NULL) { @@ -502,25 +508,28 @@ void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFr else { if (deleteLastFromDB) { mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j); - delSetting(NULL,key); + delSetting(NULL, key); } break; - } } + } + } break; -} } + } +} void CJabberProto::SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog) { char key[30]; SearchDeleteFromRecent(szAddr); - for (int j=9; j > 0; j--) { + for (int j = 9; j > 0; j--) { mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j - 1); - ptrT szValue( getTStringA(key)); + ptrT szValue(getTStringA(key)); if (szValue != NULL) { mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j); setTString(NULL, key, szValue); - } } + } + } mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", 0); setTString(key, szAddr); @@ -541,27 +550,27 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR /* Server Combo box */ ptrA jud(dat->ppro->getStringA("Jud")); - char *szServerName = (jud == NULL) ? "users.jabber.org": jud; - SetDlgItemTextA(hwndDlg,IDC_SERVER,szServerName); - SendDlgItemMessageA(hwndDlg,IDC_SERVER,CB_ADDSTRING,0,(LPARAM)szServerName); + char *szServerName = (jud == NULL) ? "users.jabber.org" : jud; + SetDlgItemTextA(hwndDlg, IDC_SERVER, szServerName); + SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)szServerName); //TO DO: Add Transports here int i, transpCount = dat->ppro->m_lstTransports.getCount(); - for (i=0; i < transpCount; i++) { + for (i = 0; i < transpCount; i++) { TCHAR *szTransp = dat->ppro->m_lstTransports[i]; if (szTransp) JabberSearchAddUrlToRecentCombo(hwndDlg, szTransp); } - for (i=0; i < 10; i++) { + for (i = 0; i < 10; i++) { char key[30]; mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i); - ptrT szValue( dat->ppro->getTStringA(key)); + ptrT szValue(dat->ppro->getTStringA(key)); if (szValue != NULL) JabberSearchAddUrlToRecentCombo(hwndDlg, szValue); } //TO DO: Add 4 recently used - dat->lastRequestIq = dat->ppro->SearchRenewFields(hwndDlg,dat); + dat->lastRequestIq = dat->ppro->SearchRenewFields(hwndDlg, dat); } return TRUE; @@ -569,21 +578,21 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR if (LOWORD(wParam) == IDC_SERVER) { switch (HIWORD(wParam)) { case CBN_SETFOCUS: - PostMessage(GetParent(hwndDlg),WM_COMMAND, MAKEWPARAM(0,EN_SETFOCUS), (LPARAM)hwndDlg); + PostMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(0, EN_SETFOCUS), (LPARAM)hwndDlg); return TRUE; case CBN_EDITCHANGE: - EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GO), TRUE); return TRUE; case CBN_EDITUPDATE: JabberSearchFreeData(hwndDlg, dat); - EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GO), TRUE); return TRUE; case CBN_SELENDOK: - EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE); - PostMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_GO,BN_CLICKED),0); + EnableWindow(GetDlgItem(hwndDlg, IDC_GO), TRUE); + PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_GO, BN_CLICKED), 0); return TRUE; } } @@ -597,54 +606,55 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR { //Resize IDC_FRAME to take full size RECT rcForm; - GetWindowRect(hwndDlg, &rcForm); + GetWindowRect(hwndDlg, &rcForm); RECT rcFrame; GetWindowRect(GetDlgItem(hwndDlg, IDC_FRAME), &rcFrame); rcFrame.bottom = rcForm.bottom; - SetWindowPos(GetDlgItem(hwndDlg,IDC_FRAME),NULL,0,0,rcFrame.right-rcFrame.left,rcFrame.bottom-rcFrame.top,SWP_NOZORDER|SWP_NOMOVE); - GetWindowRect(GetDlgItem(hwndDlg,IDC_VSCROLL), &rcForm); - SetWindowPos(GetDlgItem(hwndDlg,IDC_VSCROLL),NULL,0,0,rcForm.right-rcForm.left,rcFrame.bottom-rcFrame.top,SWP_NOZORDER|SWP_NOMOVE); + SetWindowPos(GetDlgItem(hwndDlg, IDC_FRAME), NULL, 0, 0, rcFrame.right - rcFrame.left, rcFrame.bottom - rcFrame.top, SWP_NOZORDER | SWP_NOMOVE); + GetWindowRect(GetDlgItem(hwndDlg, IDC_VSCROLL), &rcForm); + SetWindowPos(GetDlgItem(hwndDlg, IDC_VSCROLL), NULL, 0, 0, rcForm.right - rcForm.left, rcFrame.bottom - rcFrame.top, SWP_NOZORDER | SWP_NOMOVE); JabberSearchRefreshFrameScroll(hwndDlg, dat); } return TRUE; - case WM_USER+11: + case WM_USER + 11: { - dat->fSearchRequestIsXForm=TRUE; + dat->fSearchRequestIsXForm = TRUE; dat->xNode = (HXML)wParam; - JabberFormCreateUI(GetDlgItem(hwndDlg, IDC_FRAME), dat->xNode, &dat->CurrentHeight,TRUE); + JabberFormCreateUI(GetDlgItem(hwndDlg, IDC_FRAME), dat->xNode, &dat->CurrentHeight, TRUE); ShowWindow(GetDlgItem(hwndDlg, IDC_FRAME), SW_SHOW); - dat->nJSInfCount=1; - return TRUE; + dat->nJSInfCount = 1; } - case WM_USER+10: + return TRUE; + + case WM_USER + 10: { - Data* MyDat = (Data*)lParam; + Data *MyDat = (Data*)lParam; if (MyDat) { dat->fSearchRequestIsXForm = (BOOL)wParam; - dat->CurrentHeight = JabberSearchAddField(hwndDlg,MyDat); + dat->CurrentHeight = JabberSearchAddField(hwndDlg, MyDat); mir_free(MyDat->Label); mir_free(MyDat->Var); mir_free(MyDat->defValue); free(MyDat); } - else - { - JabberSearchRefreshFrameScroll(hwndDlg,dat); - ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - 0, NULL, &(dat->frameRect)); + else { + JabberSearchRefreshFrameScroll(hwndDlg, dat); + ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - 0, NULL, &(dat->frameRect)); SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, 0, FALSE); - dat->curPos=0; + dat->curPos = 0; } - return TRUE; } + return TRUE; + case WM_MOUSEWHEEL: { short zDelta = GET_WHEEL_DELTA_WPARAM(wParam); if (zDelta) { - int nScrollLines=0; - SystemParametersInfo(SPI_GETWHEELSCROLLLINES,0,(void*)&nScrollLines,0); - for (int i=0; i<(nScrollLines+1)/2; i++) - SendMessage(hwndDlg,WM_VSCROLL, (zDelta<0)?SB_LINEDOWN:SB_LINEUP,0); + int nScrollLines = 0; + SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, (void*)&nScrollLines, 0); + for (int i = 0; i < (nScrollLines + 1) / 2; i++) + SendMessage(hwndDlg, WM_VSCROLL, (zDelta < 0) ? SB_LINEDOWN : SB_LINEUP, 0); } } return TRUE; @@ -676,17 +686,19 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR if (pos < 0) pos = 0; if (dat->curPos != pos) { - ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - pos, NULL , &(dat->frameRect)); + ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - pos, NULL, &(dat->frameRect)); SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, pos, TRUE); - RECT Invalid=dat->frameRect; + RECT Invalid = dat->frameRect; if (dat->curPos - pos >0) - Invalid.bottom=Invalid.top+(dat->curPos - pos); + Invalid.bottom = Invalid.top + (dat->curPos - pos); else - Invalid.top=Invalid.bottom+(dat->curPos - pos); + Invalid.top = Invalid.bottom + (dat->curPos - pos); - RedrawWindow(GetDlgItem(hwndDlg, IDC_FRAME), NULL, NULL, RDW_UPDATENOW |RDW_ALLCHILDREN); + RedrawWindow(GetDlgItem(hwndDlg, IDC_FRAME), NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN); dat->curPos = pos; - } } } + } + } + } return TRUE; case WM_DESTROY: @@ -702,7 +714,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR HWND __cdecl CJabberProto::CreateExtendedSearchUI(HWND parent) { if (parent && hInst) { - ptrT szServer( getTStringA("LoginServer")); + ptrT szServer(getTStringA("LoginServer")); if (szServer == NULL || mir_tstrcmpi(szServer, _T("S.ms"))) return CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEARCHUSER), parent, JabberSearchAdvancedDlgProc, (LPARAM)this); } @@ -718,7 +730,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) if (!m_bJabberOnline || !hwndDlg) return 0; //error - JabberSearchData * dat=(JabberSearchData *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + JabberSearchData * dat = (JabberSearchData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (!dat) return 0; //error @@ -727,7 +739,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) return 0; // formating request - BOOL fRequestNotEmpty=FALSE; + BOOL fRequestNotEmpty = FALSE; // get server name TCHAR szServerName[100]; @@ -744,19 +756,21 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) // next can be 2 cases: // Forms: XEP-0055 Example 7 if (dat->fSearchRequestIsXForm) { - fRequestNotEmpty=TRUE; + fRequestNotEmpty = TRUE; HXML n = JabberFormGetData(GetDlgItem(hwndDlg, IDC_FRAME), dat->xNode); xmlAddChild(query, n); xi.destroyNode(n); } else { //and Simple fields: XEP-0055 Example 3 - for (int i=0; i<dat->nJSInfCount; i++) { + for (int i = 0; i < dat->nJSInfCount; i++) { TCHAR szFieldValue[100]; GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, SIZEOF(szFieldValue)); if (szFieldValue[0] != 0) { xmlAddChild(query, dat->pJSInf[i].szFieldName, szFieldValue); - fRequestNotEmpty=TRUE; - } } } + fRequestNotEmpty = TRUE; + } + } + } if (fRequestNotEmpty) { m_ThreadInfo->send(iq); diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index b86de54e6f..a58b7b23ea 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -86,7 +86,8 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "MRA";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)mraProtoInit;
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index 8ab0e44bb4..c2270d4d16 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -694,9 +694,9 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags PROTORECVFILET prf;
prf.dwFlags = PRFF_UNICODE;
prf.timestamp = _time32(NULL);
- prf.tszDescription = dat->pwszDescription;
- prf.fileCount = 1;//dat->dwFilesCount;
- prf.ptszFiles = &dat->pwszFilesList;
+ prf.descr.w = dat->pwszDescription;
+ prf.fileCount = 1;
+ prf.files.w = &dat->pwszFilesList;
prf.lParam = dwIDRequest;
ProtoChainRecvFile(hContact, &prf);
return NO_ERROR;
diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index de2f5bfb3c..1ddd57cb59 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.cpp @@ -115,7 +115,8 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "MSN";
pd.fnInit = (pfnInitProto)msnProtoInit;
pd.fnUninit = (pfnUninitProto)msnProtoUninit;
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index ddbf398deb..b9136e636e 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -487,11 +487,11 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeT(desc->txt):tComment;
- pre.ptszFiles = &ft->std.tszCurrentFile;
+ pre.descr.t = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeT(desc->txt):tComment;
+ pre.files.t = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
- if (desc) mir_free(pre.tszDescription);
+ if (desc) mir_free(pre.descr.t);
} else uri=NULL;
}
@@ -1439,8 +1439,8 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = tComment;
- pre.ptszFiles = &ft->std.tszCurrentFile;
+ pre.descr.t = tComment;
+ pre.files.t = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
return;
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index fbaa187a5c..2aa880dd6a 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -1232,8 +1232,8 @@ void CMsnProto::p2p_InitFileTransfer( pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = tComment;
- pre.ptszFiles = &ft->std.tszCurrentFile;
+ pre.descr.t = tComment;
+ pre.files.t = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
}
diff --git a/protocols/MinecraftDynmap/src/main.cpp b/protocols/MinecraftDynmap/src/main.cpp index c69daf0ebd..fd618ed8e9 100644 --- a/protocols/MinecraftDynmap/src/main.cpp +++ b/protocols/MinecraftDynmap/src/main.cpp @@ -92,7 +92,8 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo); mir_getCLI(); - PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; + PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "MinecraftDynmap"; pd.type = PROTOTYPE_PROTOCOL; pd.fnInit = protoInit; diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp index 603b1ff1f3..da8afbbcd6 100644 --- a/protocols/Omegle/src/main.cpp +++ b/protocols/Omegle/src/main.cpp @@ -94,7 +94,8 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo);
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "Omegle";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index c90fd4263a..938753c47c 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -42,8 +42,8 @@ void mwFileTransfer_offered(mwFileTransfer* ft) pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = descriptionT;
- pre.ptszFiles = &filenameT;
+ pre.descr.t = descriptionT;
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index 708be8481f..a3824263dd 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -265,7 +265,8 @@ static int sametime_proto_uninit(PROTO_INTERFACE* ppro) extern "C" int __declspec(dllexport) Load(void)
{
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.type = PROTOTYPE_PROTOCOL;
pd.szName = "Sametime";
pd.fnInit = (pfnInitProto)sametime_proto_init;
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 411fdbb0a4..809b3803a3 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -2070,8 +2070,8 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) *ptr = ' ';
}
else if (strncmp(ptr, " CHATMESSAGES ", 14) == 0) {
- int iLen=mir_strlen(ptr+14)+1;
- char *pParam=(char*)calloc(iLen+1, 1);
+ size_t iLen = mir_strlen(ptr+14)+1;
+ char *pParam = (char*)calloc(iLen+1, 1);
*pParam=TRUE;
memcpy(pParam+1, ptr+14, iLen);
pthread_create((pThreadFunc)MessageListProcessingThread, pParam);
@@ -2127,7 +2127,6 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) }
if (!strncmp(szSkypeMsg, "MESSAGES", 8) || !strncmp(szSkypeMsg, "CHATMESSAGES", 12)) {
char *pMsgs;
- int iLen;
if (mir_strlen(szSkypeMsg) <= (UINT)((pMsgs=strchr(szSkypeMsg, ' ')) - szSkypeMsg + 1))
{
LOG(("%s %d %s %d", szSkypeMsg, (UINT)(strchr(szSkypeMsg, ' ') - szSkypeMsg + 1),
@@ -2135,7 +2134,8 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) break;
}
LOG(("MessageListProcessingThread launched"));
- char *pParam=(char*)calloc((iLen=mir_strlen(pMsgs)+1)+1, 1);
+ size_t iLen = mir_strlen(pMsgs)+1;
+ char *pParam=(char*)calloc(iLen+1, 1);
memcpy(pParam+1, pMsgs, iLen);
pthread_create((pThreadFunc)MessageListProcessingThread, pParam);
break;
diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index ad6bc71967..73bf8d50b3 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -1100,21 +1100,8 @@ INT_PTR SkypeSetNick(WPARAM wParam, LPARAM lParam) { * Returns: 0 - Success
* -1 - Failure
*/
-INT_PTR SkypeSetAwayMessage(WPARAM wParam, LPARAM lParam) {
- int retval = -1;
- char *Mood = NULL;
-
- if (!lParam) lParam=(LPARAM)"";
- if(utf8_encode((const char *)lParam, &Mood) == -1 ) return -1;
- db_set_s(NULL, SKYPE_PROTONAME, "MoodText", (const char *)lParam);
-
- if(AttachStatus == SKYPECONTROLAPI_ATTACH_SUCCESS)
- retval = SkypeSend("SET PROFILE MOOD_TEXT %s", Mood);
- free (Mood);
- return retval;
-}
-INT_PTR SkypeSetAwayMessageW(WPARAM wParam, LPARAM lParam) {
+INT_PTR SkypeSetAwayMessage(WPARAM wParam, LPARAM lParam) {
int retval = -1;
char *Mood = NULL;
diff --git a/protocols/SkypeClassic/src/skypeapi.h b/protocols/SkypeClassic/src/skypeapi.h index 120b7fb462..63bf26e425 100644 --- a/protocols/SkypeClassic/src/skypeapi.h +++ b/protocols/SkypeClassic/src/skypeapi.h @@ -44,7 +44,6 @@ INT_PTR SkypeSendGuiFile(WPARAM wParam, LPARAM); INT_PTR SkypeBlockContact(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSetAvatar(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSetAwayMessage(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSetAwayMessageW(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSetNick(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeChatCreate(WPARAM wParam, LPARAM lParam);
int SkypeSetProfile(char *szProperty, char *szValue);
diff --git a/protocols/SkypeClassic/src/skypesvc.cpp b/protocols/SkypeClassic/src/skypesvc.cpp index fae8b8cd3b..1d1d2821bf 100644 --- a/protocols/SkypeClassic/src/skypesvc.cpp +++ b/protocols/SkypeClassic/src/skypesvc.cpp @@ -68,10 +68,10 @@ void CreateServices(void) CreateProtoService(PS_AUTHDENY, SkypeAuthDeny);
CreateProtoService(PSR_FILE, SkypeRecvFile);
- CreateProtoService(PSS_FILEALLOWT, SkypeFileAllow);
+ CreateProtoService(PSS_FILEALLOW, SkypeFileAllow);
CreateProtoService(PSS_FILEDENY, SkypeFileCancel);
CreateProtoService(PSS_FILECANCEL, SkypeFileCancel);
- CreateProtoService(PSS_FILET, SkypeSendFile);
+ CreateProtoService(PSS_FILE, SkypeSendFile);
CreateProtoService(PS_GETAVATARINFO, SkypeGetAvatarInfo);
CreateProtoService(PS_GETAVATARCAPS, SkypeGetAvatarCaps);
@@ -79,7 +79,6 @@ void CreateServices(void) CreateProtoService(PS_SETMYAVATAR, SkypeSetAvatar);
CreateProtoService(PS_SETAWAYMSG, SkypeSetAwayMessage);
- CreateProtoService(PS_SETAWAYMSGW, SkypeSetAwayMessageW);
CreateProtoService(PSS_GETAWAYMSG, SkypeGetAwayMessage);
CreateProtoService(PS_SETMYNICKNAME, SkypeSetNick);
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index 73613c972d..ce02a8ea26 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -62,7 +62,8 @@ extern "C" int __declspec(dllexport) Load(void) CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(g_szMirVer), LPARAM(g_szMirVer));
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "SKYPE";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)CSkypeProto::InitAccount;
diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp index 6fe8317684..fa597983d9 100644 --- a/protocols/Steam/src/main.cpp +++ b/protocols/Steam/src/main.cpp @@ -38,7 +38,8 @@ extern "C" int __declspec(dllexport) Load(void) {
mir_getLP(&pluginInfo);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "STEAM";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)CSteamProto::InitProtoInstance;
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index e87fcac01d..8ec5c7cb06 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -369,7 +369,8 @@ extern "C" int __declspec(dllexport) Load(void) TlenRegisterIcons();
// Register protocol module
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "TLEN";
pd.fnInit = ( pfnInitProto )tlenProtoInit;
pd.fnUninit = ( pfnUninitProto )tlenProtoUninit;
diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index 71ad60185f..4ab81e9819 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -595,8 +595,8 @@ void TlenProcessF(XmlNode *node, ThreadData *info) pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = filenameT;
- pre.ptszFiles = &filenameT;
+ pre.descr.t = filenameT;
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)ft;
ft->proto->debugLogA("sending chainrecv");
ProtoChainRecvFile(ft->hContact, &pre);
diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp index 5401396e96..3234fa47f0 100644 --- a/protocols/Tlen/src/tlen_p2p_new.cpp +++ b/protocols/Tlen/src/tlen_p2p_new.cpp @@ -263,8 +263,8 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = filenameT;
- pre.ptszFiles = &filenameT;
+ pre.descr.t = filenameT;
+ pre.files.t = &filenameT;
pre.lParam = (LPARAM)ft;
ft->proto->debugLogA("sending chainrecv");
ProtoChainRecvFile(ft->hContact, &pre);
diff --git a/protocols/Tox/src/tox.cpp b/protocols/Tox/src/tox.cpp index 613c790e24..f6c89d2a00 100644 --- a/protocols/Tox/src/tox.cpp +++ b/protocols/Tox/src/tox.cpp @@ -43,7 +43,8 @@ extern "C" int __declspec(dllexport) Load(void) mir_getCLI();
mir_getLP(&pluginInfo);
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "TOX";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)CToxProto::InitAccount;
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index e1460b3d53..2586dcfee4 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -48,10 +48,8 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = _T("");
- pre.ptszFiles = (TCHAR**)mir_alloc(sizeof(TCHAR*) * 2);
- pre.ptszFiles[0] = name;
- pre.ptszFiles[1] = NULL;
+ pre.descr.t = _T("");
+ pre.files.t = &name;
pre.lParam = (LPARAM)transfer;
ProtoChainRecvFile(hContact, &pre);
}
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp index 2238b60f10..2503f64da5 100644 --- a/protocols/Twitter/src/main.cpp +++ b/protocols/Twitter/src/main.cpp @@ -90,7 +90,8 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo);
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "Twitter";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp index 460d2ec5b9..9a690049e0 100644 --- a/protocols/VKontakte/src/main.cpp +++ b/protocols/VKontakte/src/main.cpp @@ -83,7 +83,8 @@ extern "C" int __declspec(dllexport) Load() InitIcons();
// Register protocol module
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "VKontakte";
pd.fnInit = (pfnInitProto)vkProtoInit;
pd.fnUninit = (pfnUninitProto)vkProtoUninit;
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index a1c49edf96..c5e2977c73 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -547,7 +547,7 @@ INT_PTR __cdecl CVkProto::SvcAddAsFriend(WPARAM hContact, LPARAM) LONG userID = getDword(hContact, "ID", -1);
if (!IsOnline() || userID == -1 || userID == VK_FEED_USER)
return 1;
- CallContactService(hContact, PSS_AUTHREQUESTW, 0, (LPARAM)TranslateT("Please authorize me to add you to my friend list."));
+ CallContactService(hContact, PSS_AUTHREQUEST, 0, (LPARAM)TranslateT("Please authorize me to add you to my friend list."));
return 0;
}
diff --git a/protocols/WhatsApp/src/main.cpp b/protocols/WhatsApp/src/main.cpp index f199a94d3e..93abf0bbc0 100644 --- a/protocols/WhatsApp/src/main.cpp +++ b/protocols/WhatsApp/src/main.cpp @@ -68,7 +68,8 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo);
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "WhatsApp";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index f757f81a96..603d7d6442 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -506,12 +506,12 @@ void CYahooProto::ext_got_file(const char *me, const char *who, const char *url, pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.tszDescription = mir_a2t(msg);
- pre.ptszFiles = &ptszFileName;
+ pre.descr.t = mir_a2t(msg);
+ pre.files.t = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
- mir_free(pre.tszDescription);
+ mir_free(pre.descr.t);
mir_free(ptszFileName);
}
@@ -550,8 +550,8 @@ void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_ PROTORECVFILET pre = {0};
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.szDescription = "";
- pre.pszFiles = (char**)&fn;
+ pre.descr.a = "";
+ pre.files.a = (char**)&fn;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->hContact, &pre);
}
diff --git a/protocols/Yahoo/src/main.cpp b/protocols/Yahoo/src/main.cpp index feeb9715c6..9789cf760f 100644 --- a/protocols/Yahoo/src/main.cpp +++ b/protocols/Yahoo/src/main.cpp @@ -99,7 +99,8 @@ extern "C" int __declspec(dllexport)Load(void) mir_getLP( &pluginInfo );
mir_getCLI();
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "YAHOO";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = ( pfnInitProto )yahooProtoInit;
|