diff options
Diffstat (limited to 'protocols/Sametime')
-rw-r--r-- | protocols/Sametime/src/conference.cpp | 9 | ||||
-rw-r--r-- | protocols/Sametime/src/files.cpp | 28 | ||||
-rw-r--r-- | protocols/Sametime/src/sametime_proto.cpp | 35 | ||||
-rw-r--r-- | protocols/Sametime/src/sametime_session.cpp | 8 | ||||
-rw-r--r-- | protocols/Sametime/src/session_announce_win.cpp | 7 | ||||
-rw-r--r-- | protocols/Sametime/src/userlist.cpp | 12 | ||||
-rw-r--r-- | protocols/Sametime/src/version.h | 2 |
7 files changed, 48 insertions, 53 deletions
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index aa7bafdf7b..d4aee066df 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -23,7 +23,6 @@ CSametimeProto* getProtoFromMwConference(mwConference* conf) @param inviter the indentity of the user who sent the invitation
@param invite the invitation text
*/
-
void mwServiceConf_on_invited(mwConference* conf, mwLoginInfo* inviter, const char* invite)
{
GList *members, *mem;
@@ -340,12 +339,10 @@ int CSametimeProto::GcEventHook(WPARAM wParam, LPARAM lParam) { if (strcmp(gch->pDest->pszModule, m_szModuleName) != 0) return 0;
- GList *conferences, *conf;
- conferences = conf = mwServiceConference_getConferences(service_conference);
- for (;conf;conf = conf->next) {
+ GList *conferences = mwServiceConference_getConferences(service_conference);
+ for (GList *conf = conferences;conf;conf = conf->next) {
TCHAR* tszConfId = mir_utf8decodeT(mwConference_getName((mwConference*)conf->data));
if (mir_tstrcmp(gch->pDest->ptszID, tszConfId) == 0) {
-
switch(gch->pDest->iType) {
case GC_USER_MESSAGE:
{
@@ -365,7 +362,7 @@ int CSametimeProto::GcEventHook(WPARAM wParam, LPARAM lParam) { }
break;
}
-
+ mir_free(tszConfId);
break;
}
mir_free(tszConfId);
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index 53141f1587..f0df47200d 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -128,7 +128,7 @@ void mwFileTransfer_opened(mwFileTransfer* ft) if (ftcd->sending) {
// create a thread to send chunks - since it seems not all clients send acks for each of our chunks!
- mir_forkthread(SendThread, (void*)ft);
+ mir_forkthread(SendThread, ft);
}
}
@@ -161,24 +161,28 @@ void mwFileTransfer_closed(mwFileTransfer* ft, guint32 code) proto->ProtoBroadcastAck(ftcd->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ftcd->hFt, 0);
if (ftcd->sending) {
- FileTransferClientData* ftcd_next = ftcd->next, *ftcd_temp;
+ FileTransferClientData* ftcd_next = ftcd->next;
while(ftcd_next) {
mwFileTransfer_free((mwFileTransfer*)ftcd_next->ft);
- ftcd_temp = ftcd_next->next;
+ FileTransferClientData *ftcd_temp = ftcd_next->next;
if (ftcd_next->hFile != INVALID_HANDLE_VALUE)
CloseHandle(ftcd->hFile);
- if (ftcd_next->save_path) free(ftcd_next->save_path);
- if (ftcd_next->buffer) delete[] ftcd_next->buffer;
+ if (ftcd_next->save_path)
+ free(ftcd_next->save_path);
+ if (ftcd_next->buffer)
+ delete[] ftcd_next->buffer;
delete ftcd_next;
ftcd_next = ftcd_temp;
}
}
else {
mwFileTransfer_removeClientData(ft);
- if (ftcd->save_path) free(ftcd->save_path);
- if (ftcd->buffer) delete[] ftcd->buffer;
+ if (ftcd->save_path)
+ free(ftcd->save_path);
+ if (ftcd->buffer)
+ delete[] ftcd->buffer;
delete ftcd;
mwFileTransfer_free(ft);
@@ -196,8 +200,10 @@ void mwFileTransfer_closed(mwFileTransfer* ft, guint32 code) proto->ProtoBroadcastAck(ftcd->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ftcd->hFt, 0);
mwFileTransfer_removeClientData(ft);
- if (ftcd->save_path) free(ftcd->save_path);
- if (ftcd->buffer) delete[] ftcd->buffer;
+ if (ftcd->save_path)
+ free(ftcd->save_path);
+ if (ftcd->buffer)
+ delete[] ftcd->buffer;
delete ftcd;
mwFileTransfer_free(ft);
@@ -303,7 +309,7 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, TCHAR** files, const T ft = mwFileTransfer_new(service_files, &idb, T2Utf(ptszDesc), T2Utf(fn), filesize);
ftcd = new FileTransferClientData;
- memset((void*)ftcd, 0, sizeof(FileTransferClientData));
+ memset(ftcd, 0, sizeof(FileTransferClientData));
ftcd->ft = ft;
ftcd->hContact = hContact;
@@ -356,7 +362,7 @@ HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* s debugLog(_T("CSametimeProto::AcceptFileTransfer() start"));
FileTransferClientData* ftcd = new FileTransferClientData;
- memset((void*)ftcd, 0, sizeof(FileTransferClientData));
+ memset(ftcd, 0, sizeof(FileTransferClientData));
ftcd->ft = ft;
ftcd->sending = false;
ftcd->hFt = hFt;
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 5a9b5cd2d5..aa7f4a7409 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -115,31 +115,24 @@ int CSametimeProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** szFi DWORD_PTR CSametimeProto::GetCaps(int type, MCONTACT hContact)
{
- int ret = 0;
switch (type) {
case PFLAGNUM_1:
- ret = PF1_IM | PF1_BASICSEARCH | PF1_EXTSEARCHUI | PF1_ADDSEARCHRES | PF1_MODEMSG | PF1_FILE | PF1_CHAT;
- break;
+ return PF1_IM | PF1_BASICSEARCH | PF1_EXTSEARCHUI | PF1_ADDSEARCHRES | PF1_MODEMSG | PF1_FILE | PF1_CHAT;
case PFLAGNUM_2:
- ret = PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_LIGHTDND;
- break;
+ return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_LIGHTDND;
case PFLAGNUM_3:
- ret = PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_LIGHTDND;
- break;
+ return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_LIGHTDND;
case PFLAGNUM_4:
- ret = PF4_SUPPORTTYPING;
- break;
+ return PF4_SUPPORTTYPING;
case PFLAG_UNIQUEIDTEXT:
- ret = (DWORD_PTR)Translate("ID");
- break;
+ return (DWORD_PTR)Translate("ID");
case PFLAG_MAXLENOFMESSAGE:
- ret = MAX_MESSAGE_SIZE;
- break;
+ return MAX_MESSAGE_SIZE;
case PFLAG_UNIQUEIDSETTING:
- ret = (DWORD_PTR) "stid";
- break;
+ return (DWORD_PTR) "stid";
+ default:
+ return 0;
}
- return ret;
}
int CSametimeProto::GetInfo(MCONTACT hContact, int infoType)
@@ -159,7 +152,7 @@ int CSametimeProto::GetInfo(MCONTACT hContact, int infoType) tfap->proto = this;
tfap->hContact = hContact;
tfap->lParam = NULL;
- mir_forkthread(sttFakeAckInfoSuccessThread, (void*)tfap);
+ mir_forkthread(sttFakeAckInfoSuccessThread, tfap);
return 0;
}
@@ -175,7 +168,7 @@ HWND CSametimeProto::SearchAdvanced(HWND owner) {
TCHAR buf[512];
if (GetDlgItemText(owner, IDC_EDIT1, buf, _countof(buf))) {
- debugLog(_T("CSametimeProto::SearchAdvanced() buf:len=[%d]"), buf == NULL ? -1 : mir_tstrlen(buf));
+ debugLog(_T("CSametimeProto::SearchAdvanced() buf:len=[%d]"), mir_tstrlen(buf));
return (HWND)SearchForUser(T2Utf(buf), TRUE);
}
return NULL;
@@ -231,7 +224,7 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg) tfap->proto = this;
tfap->hContact = hContact;
tfap->lParam = 0;
- mir_forkthread(sttFakeAckMessageFailedThread, (void*)tfap);
+ mir_forkthread(sttFakeAckMessageFailedThread, tfap);
return 0;
}
@@ -244,7 +237,7 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg) tfap->proto = this;
tfap->hContact = hContact;
tfap->lParam = (LPARAM)ret;
- mir_forkthread(sttFakeAckMessageSuccessThread, (void*)tfap);
+ mir_forkthread(sttFakeAckMessageSuccessThread, tfap);
return ret;
}
@@ -274,7 +267,7 @@ HANDLE CSametimeProto::GetAwayMsg(MCONTACT hContact) tfap = (TFakeAckParams*)malloc(sizeof(TFakeAckParams));
tfap->proto = this;
tfap->hContact = hContact;
- mir_forkthread(sttRecvAwayThread, (void*)tfap);
+ mir_forkthread(sttRecvAwayThread, tfap);
return (HANDLE)1;
}
return NULL;
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index 37bff64a3c..1d54872cd9 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -113,7 +113,7 @@ void __cdecl SessionStateChange(mwSession* session, mwSessionState state, gpoint break;
case mwSession_STOPPED:
-
+ break;
case mwSession_LOGIN_REDIR:
proto->OnLogInRedirect((char*)info);
@@ -429,7 +429,7 @@ void __cdecl SessionThread(LPVOID param) mwSession_start(proto->session);
}
- mir_forkthread(KeepAliveThread, (void*)proto);
+ mir_forkthread(KeepAliveThread, proto);
unsigned char* recv_buffer = (unsigned char*)mir_alloc(1024 * 32);
int bytes;
@@ -498,7 +498,7 @@ int CSametimeProto::LogIn(int ls, HANDLE hNetlibUser) login_status = ls;
- mir_forkthread(SessionThread, (void*)this);
+ mir_forkthread(SessionThread, this);
return 0;
}
@@ -519,7 +519,7 @@ int CSametimeProto::LogOut() int CSametimeProto::OnLogInRedirect(char* newHost)
{
- debugLog(_T("OnLogInRedirect() mwSession_LOGIN_REDIR newHost=[%s]"), _A2T(newHost));
+ debugLog(_T("OnLogInRedirect() mwSession_LOGIN_REDIR newHost=[%s]"), newHost ? _A2T(newHost) : "(null)");
if (!newHost || !mir_strcmp(newHost, options.server_name) || db_get_b(0, m_szModuleName, "ForceLogin", 0) == 1) {
debugLog(_T("OnLogInRedirect() forceLogin"));
diff --git a/protocols/Sametime/src/session_announce_win.cpp b/protocols/Sametime/src/session_announce_win.cpp index 8daf9494a9..fe30966af1 100644 --- a/protocols/Sametime/src/session_announce_win.cpp +++ b/protocols/Sametime/src/session_announce_win.cpp @@ -5,8 +5,6 @@ INT_PTR CALLBACK SessionAnnounceDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPara {
SessionAnnounceDialogProc_arg* arg = (SessionAnnounceDialogProc_arg*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
CSametimeProto *proto;
- if (arg != NULL)
- proto = arg->proto;
switch (uMsg) {
case WM_INITDIALOG:
@@ -14,7 +12,7 @@ INT_PTR CALLBACK SessionAnnounceDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPara {
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- SessionAnnounceDialogProc_arg* arg = (SessionAnnounceDialogProc_arg*)lParam;
+ arg = (SessionAnnounceDialogProc_arg*)lParam;
proto = arg->proto;
proto->debugLog(_T("SessionAnnounceDialogProc WM_INITDIALOG"));
@@ -56,12 +54,14 @@ INT_PTR CALLBACK SessionAnnounceDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPara return 0;
case WM_CLOSE:
+ proto = arg->proto;
proto->debugLog(_T("SessionAnnounceDialogProc WM_CLOSE"));
mir_free(arg);
DestroyWindow(hwndDlg);
break;
case WM_COMMAND:
+ proto = arg->proto;
if (HIWORD(wParam) == BN_CLICKED) {
int size;
switch (LOWORD(wParam)) {
@@ -126,6 +126,7 @@ INT_PTR CALLBACK SessionAnnounceDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPara }
g_list_free(safArg->recipients);
}
+ mir_free(safArg);
DestroyWindow(hwndDlg);
}
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index eb4a67fecc..2b85a75c0e 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -511,7 +511,7 @@ void mwAwareList_on_aware(mwAwareList* list, mwAwareSnapshot* aware) db_free(&dbv);
}
- GList* query = g_list_prepend(0, (void*)aware->id.user);
+ GList* query = g_list_prepend(0, aware->id.user);
mwServiceResolve_resolve(proto->service_resolve, query, mwResolveFlag_USERS, mwResolve_handler_dyngroup_callback, (gpointer)stgroup, 0);
g_list_free(query);
@@ -682,14 +682,12 @@ void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code mcsr.psr.cbSize = sizeof(MYPROTOSEARCHRESULT);
if (code == mwResolveCode_SUCCESS) {
- GList *ri = results, *mri;
- for (; ri; ri = ri->next) {
- mri = ((mwResolveResult *)ri->data)->matches;
- for (; mri; mri = mri->next) {
+ for (GList *ri = results; ri; ri = ri->next) {
+ for (GList *mri = ((mwResolveResult *)ri->data)->matches; mri; mri = mri->next) {
strncpy_s(mcsr.stid, ((mwResolveMatch *)mri->data)->id, _TRUNCATE);
MultiByteToWideChar(CP_UTF8, 0, mcsr.stid, -1, mcsr.pszFields[0], 512);
- strncpy(mcsr.name, ((mwResolveMatch *)mri->data)->name, _TRUNCATE);
+ strncpy_s(mcsr.name, ((mwResolveMatch *)mri->data)->name, _TRUNCATE);
MultiByteToWideChar(CP_UTF8, 0, mcsr.name, -1, mcsr.pszFields[1], 512);
if (((mwResolveMatch *)mri->data)->desc)
@@ -742,7 +740,7 @@ void mwResolve_handler_details_callback(mwServiceResolve* srvc, guint32 id, guin int CSametimeProto::SearchForUser(const char* name, BOOLEAN advanced)
{
if (m_iStatus != ID_STATUS_OFFLINE && service_resolve) {
- GList *query = g_list_prepend(0, (void*)name);
+ GList *query = g_list_prepend(0, (gpointer) name);
guint32 id = mwServiceResolve_resolve(service_resolve, query, (mwResolveFlag)(mwResolveFlag_USERS | mwResolveFlag_GROUPS), &mwResolve_handler_callback, (gpointer)advanced, 0);
g_list_free(query);
return id; // search handle
diff --git a/protocols/Sametime/src/version.h b/protocols/Sametime/src/version.h index eac0e4cf48..8f6582afa0 100644 --- a/protocols/Sametime/src/version.h +++ b/protocols/Sametime/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 7
#define __RELEASE_NUM 0
-#define __BUILD_NUM 3
+#define __BUILD_NUM 4
#include <stdver.h>
|