diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-22 16:04:17 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-22 16:04:17 +0000 |
commit | e2c2a1f5a84c6c9b705dc85c6a2dd1f97edd57e4 (patch) | |
tree | ba79bdcede96f80039f8b88d2791f198b9ec2981 /protocols/Sametime | |
parent | f8e34b5f83f3ce5f39d541e9068b6b8cb6d92acd (diff) |
T2Utf - handy replacement for ptrA<mir_utf8decodeT()>
git-svn-id: http://svn.miranda-ng.org/main/trunk@13758 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Sametime')
-rw-r--r-- | protocols/Sametime/src/conference.cpp | 46 | ||||
-rw-r--r-- | protocols/Sametime/src/files.cpp | 11 | ||||
-rw-r--r-- | protocols/Sametime/src/options.cpp | 7 | ||||
-rw-r--r-- | protocols/Sametime/src/sametime_proto.cpp | 12 | ||||
-rw-r--r-- | protocols/Sametime/src/sametime_session.cpp | 7 |
5 files changed, 25 insertions, 58 deletions
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index a34be253cf..4f3402413a 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -34,9 +34,7 @@ void mwServiceConf_on_invited(mwConference* conf, mwLoginInfo* inviter, const ch for (;mem;mem=mem->next) {
if (proto->my_login_info && strcmp(proto->my_login_info->login_id, ((mwLoginInfo*)mem->data)->login_id) == 0) {
proto->debugLog(_T("mwServiceConf_on_invited() already present"));
- char* utfs = mir_utf8encodeT(TranslateT("Invitation rejected - already present."));
- mwConference_reject(conf, 0, utfs);
- mir_free(utfs);
+ mwConference_reject(conf, 0, T2Utf(TranslateT("Invitation rejected - already present.")));
return;
}
}
@@ -75,14 +73,11 @@ void CSametimeProto::ClearInviteQueue() MCONTACT hContact = FindContactByUserId(idb.user);
if (!hContact) {
mwSametimeList* user_list = mwSametimeList_new();
- char* utfs = mir_utf8encodeT(TranslateT("None"));
- mwSametimeGroup* stgroup = mwSametimeGroup_new(user_list, mwSametimeGroup_NORMAL, utfs);
+ mwSametimeGroup* stgroup = mwSametimeGroup_new(user_list, mwSametimeGroup_NORMAL, T2Utf(TranslateT("None")));
mwSametimeUser* stuser = mwSametimeUser_new(stgroup, mwSametimeUser_NORMAL, &idb);
hContact = AddContact(stuser, (options.add_contacts ? false : true));
mwSametimeList_free(user_list);
- mir_free(utfs);
-
}
bool found = false;
@@ -96,11 +91,8 @@ void CSametimeProto::ClearInviteQueue() }
g_list_free(members);
- if (!found) {
- char* temp = mir_utf8encodeT(TranslateT("Please join this meeting."));
- mwConference_invite(my_conference, &idb, temp);
- mir_free(temp);
- }
+ if (!found)
+ mwConference_invite(my_conference, &idb, T2Utf(TranslateT("Please join this meeting.")));
invite_queue.pop();
}
@@ -209,14 +201,12 @@ void mwServiceConf_on_peer_joined(mwConference* conf, mwLoginInfo *user) idb.community = 0;
mwSametimeList* user_list = mwSametimeList_new();
- char* utfs = mir_utf8encodeT(TranslateT("None"));
- mwSametimeGroup* stgroup = mwSametimeGroup_new(user_list, mwSametimeGroup_NORMAL, utfs);
+ mwSametimeGroup* stgroup = mwSametimeGroup_new(user_list, mwSametimeGroup_NORMAL, T2Utf(TranslateT("None")));
mwSametimeUser* stuser = mwSametimeUser_new(stgroup, mwSametimeUser_NORMAL, &idb);
hContact = proto->AddContact(stuser, (proto->options.add_contacts ? false : true));
mwSametimeList_free(user_list);
- mir_free(utfs);
}
ptrT tszConfId(mir_utf8decodeT(mwConference_getName(conf)));
@@ -360,10 +350,7 @@ int CSametimeProto::GcEventHook(WPARAM wParam, LPARAM lParam) { case GC_USER_MESSAGE:
{
debugLog(_T("CSametimeProto::GcEventHook() GC_USER_MESSAGE"));
- char* utf_msg;
- utf_msg = mir_utf8encodeT(gch->ptszText);
- mwConference_sendText((mwConference*)conf->data, utf_msg);
- mir_free(utf_msg);
+ mwConference_sendText((mwConference*)conf->data, T2Utf(gch->ptszText));
}
break;
case GC_SESSION_TERMINATE:
@@ -373,9 +360,7 @@ int CSametimeProto::GcEventHook(WPARAM wParam, LPARAM lParam) { CloseMyConference(this);
} else {
debugLog(_T("CSametimeProto::GcEventHook() GC_SESSION_TERMINATE mwConference_destroy"));
- char* utfs = mir_utf8encodeT(TranslateT("I'm outa here."));
- mwConference_destroy((mwConference*)conf->data, 0, utfs);
- mir_free(utfs);
+ mwConference_destroy((mwConference*)conf->data, 0, T2Utf(TranslateT("I'm outa here.")));
}
}
break;
@@ -435,11 +420,10 @@ INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM lParam) if (!my_conference) {
debugLog(_T("CSametimeProto::onMenuCreateChat() mwConference_open"));
- char* utfs;
- my_conference = mwConference_new(service_conference, utfs = mir_utf8encodeT(title));
+ my_conference = mwConference_new(service_conference, T2Utf(title));
mwConference_open(my_conference);
- mir_free(utfs);
- } else {
+ }
+ else {
debugLog(_T("CSametimeProto::onMenuCreateChat() ClearInviteQueue"));
ClearInviteQueue();
}
@@ -503,12 +487,10 @@ void CSametimeProto::DeinitConference() if (service_conference){
conferences = conf = mwServiceConference_getConferences(service_conference);
for (;conf;conf = conf->next) {
- if (my_conference == conf->data) CloseMyConference(this);
- else {
- char* utfs = mir_utf8encodeT(TranslateT("I'm outa here."));
- mwConference_destroy((mwConference*)conf->data, 0, utfs);
- mir_free(utfs);
- }
+ if (my_conference == conf->data)
+ CloseMyConference(this);
+ else
+ mwConference_destroy((mwConference*)conf->data, 0, T2Utf(TranslateT("I'm outa here.")));
}
g_list_free(conferences);
}
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index e3836b75ae..f65b6c3b87 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -297,17 +297,10 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, PROTOCHAR** files, con TCHAR *fn = _tcsrchr(files[i], '\\');
if (fn)
fn++;
-
- char* pszDesc_utf8 = mir_utf8encodeT(ptszDesc);
- char* pszFile_utf8;
- if (fn)
- pszFile_utf8 = mir_utf8encodeT(fn);
else
- pszFile_utf8 = mir_utf8encodeT(files[i]);
+ fn = files[i];
- ft = mwFileTransfer_new(service_files, &idb, pszDesc_utf8, pszFile_utf8, filesize);
- mir_free(pszFile_utf8);
- mir_free(pszDesc_utf8);
+ ft = mwFileTransfer_new(service_files, &idb, T2Utf(ptszDesc), T2Utf(fn), filesize);
ftcd = new FileTransferClientData;
memset((void*)ftcd, 0, sizeof(FileTransferClientData));
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index cd44b6c915..5d1f077911 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -292,14 +292,13 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
TCHAR ws[2048];
- char* utf;
GetDlgItemText(hwndDlg, IDC_ED_SNAME, ws, LSTRINGLEN);
- strcpy(proto->options.server_name, utf = mir_utf8encodeT(ws)); mir_free(utf);
+ strcpy(proto->options.server_name, T2Utf(ws));
GetDlgItemText(hwndDlg, IDC_ED_NAME, ws, LSTRINGLEN);
- strcpy(proto->options.id, utf = mir_utf8encodeT(ws)); mir_free(utf);
+ strcpy(proto->options.id, T2Utf(ws));
GetDlgItemText(hwndDlg, IDC_ED_PWORD, ws, LSTRINGLEN);
- strcpy(proto->options.pword, utf = mir_utf8encodeT(ws)); mir_free(utf);
+ strcpy(proto->options.pword, T2Utf(ws));
BOOL translated;
int port = GetDlgItemInt(hwndDlg, IDC_ED_PORT, &translated, FALSE);
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index e0a01850ac..6aa6eb2325 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -171,24 +171,18 @@ int CSametimeProto::GetInfo(MCONTACT hContact, int infoType) HANDLE CSametimeProto::SearchBasic(const PROTOCHAR* id)
{
debugLog(_T("CSametimeProto::SearchBasic() id:len=[%d]"), id == NULL ? -1 : mir_tstrlen(id));
- char* id_utf8 = mir_utf8encodeT(id);
- int ret = SearchForUser(id_utf8, FALSE);
- mir_free(id_utf8);
- return (HANDLE)ret;
+ return (HANDLE)SearchForUser(T2Utf(id), FALSE);
///TODO - add timeout (like at GGPROTO::searchthread)
}
HWND CSametimeProto::SearchAdvanced(HWND owner)
{
TCHAR buf[512];
- int ret = 0;
if (GetDlgItemText(owner, IDC_EDIT1, buf, SIZEOF(buf))) {
debugLog(_T("CSametimeProto::SearchAdvanced() buf:len=[%d]"), buf == NULL ? -1 : mir_tstrlen(buf));
- char* buf_utf8 = mir_utf8encodeT(buf);
- ret = SearchForUser(buf_utf8, TRUE);
- mir_free(buf_utf8);
+ return (HWND)SearchForUser(T2Utf(buf), TRUE);
}
- return (HWND)ret;
+ return NULL;
}
HWND CSametimeProto::CreateExtendedSearchUI(HWND owner)
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index 3adfbdf8ec..c0ee790d85 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -319,7 +319,7 @@ void CSametimeProto::SetSessionAwayMessage(int status, const PROTOCHAR* msgT) {
debugLog(_T("SetSessionAwayMessage() status=[%d], msgT:len=[%d]"), status, msgT == NULL ? -1 : mir_tstrlen(msgT));
- ptrA msg(mir_utf8encodeT(msgT));
+ T2Utf msg(msgT);
if (status == ID_STATUS_ONLINE)
replaceStr(AwayMessages.szOnline, msg);
else if (status == ID_STATUS_AWAY)
@@ -540,9 +540,8 @@ void CSametimeProto::DeinitAwayMsg() void SendAnnouncement(SendAnnouncementFunc_arg* arg)
{
CSametimeProto* proto = arg->proto;
- char* utfs = mir_utf8encodeT(arg->msg);
- if (proto->session && arg->recipients) mwSession_sendAnnounce(proto->session, false, utfs, arg->recipients);
- mir_free(utfs);
+ if (proto->session && arg->recipients)
+ mwSession_sendAnnounce(proto->session, false, T2Utf(arg->msg), arg->recipients);
}
INT_PTR CSametimeProto::SessionAnnounce(WPARAM wParam, LPARAM lParam)
|