summaryrefslogtreecommitdiff
path: root/protocols/AimOscar
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-22 16:04:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-22 16:04:17 +0000
commite2c2a1f5a84c6c9b705dc85c6a2dd1f97edd57e4 (patch)
treeba79bdcede96f80039f8b88d2791f198b9ec2981 /protocols/AimOscar
parentf8e34b5f83f3ce5f39d541e9068b6b8cb6d92acd (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/AimOscar')
-rw-r--r--protocols/AimOscar/src/chat.cpp7
-rw-r--r--protocols/AimOscar/src/conv.cpp3
-rw-r--r--protocols/AimOscar/src/file.cpp14
-rw-r--r--protocols/AimOscar/src/server.cpp6
-rw-r--r--protocols/AimOscar/src/services.cpp24
5 files changed, 19 insertions, 35 deletions
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp
index a861dccb84..0188d4609f 100644
--- a/protocols/AimOscar/src/chat.cpp
+++ b/protocols/AimOscar/src/chat.cpp
@@ -123,12 +123,9 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam)
case GC_USER_MESSAGE:
if (gch->ptszText && mir_tstrlen(gch->ptszText))
- {
- char* msg = mir_utf8encodeT(gch->ptszText);
- aim_chat_send_message(item->hconn, item->seqno, msg);
- mir_free(msg);
- }
+ aim_chat_send_message(item->hconn, item->seqno, T2Utf(gch->ptszText));
break;
+
case GC_USER_CHANMGR:
DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, invite_to_chat_dialog,
LPARAM(new invite_chat_param(item->id, this)));
diff --git a/protocols/AimOscar/src/conv.cpp b/protocols/AimOscar/src/conv.cpp
index f0458f7fde..75c95e2cc7 100644
--- a/protocols/AimOscar/src/conv.cpp
+++ b/protocols/AimOscar/src/conv.cpp
@@ -771,10 +771,9 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem)
}
else
{
- char* txt = mir_utf8encodeT(text);
+ T2Utf txt(text);
strcpy(&buf[pos], txt);
pos += mir_strlen(txt);
- mir_free(txt);
}
start++;
end++;
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp
index b8eb1840f0..d47aa56b02 100644
--- a/protocols/AimOscar/src/file.cpp
+++ b/protocols/AimOscar/src/file.cpp
@@ -120,24 +120,22 @@ bool setup_next_file_send(file_transfer *ft)
ft->pfts.currentFileProgress = 0;
char* fnamea;
- char* fname = mir_utf8encodeT(file);
+ T2Utf fname(file);
if (ft->pfts.totalFiles > 1 && ft->file[0])
{
size_t dlen = mir_strlen(ft->file);
if (strncmp(fname, ft->file, dlen) == 0 && fname[dlen] == '\\')
{
fnamea = &fname[dlen+1];
- for (char *p = fnamea; *p; ++p) { if (*p == '\\') *p = 1; }
+ for (char *p = fnamea; *p; ++p)
+ if (*p == '\\')
+ *p = 1;
}
- else
- fnamea = get_fname(fname);
+ else fnamea = get_fname(fname);
}
- else
- fnamea = get_fname(fname);
+ else fnamea = get_fname(fname);
send_init_oft2(ft, fnamea);
-
- mir_free(fname);
return true;
}
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp
index 1f3a2403d9..a48b25df92 100644
--- a/protocols/AimOscar/src/server.cpp
+++ b/protocols/AimOscar/src/server.cpp
@@ -1264,11 +1264,10 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
if (channel == 1) { //Message not file
if (auto_response) { //this message must be an autoresponse
- char* away = mir_utf8encodeT(TranslateT("[Auto-Response]:"));
+ T2Utf away(TranslateT("[Auto-Response]:"));
size_t len = mir_strlen(msg_buf) + mir_strlen(away) + 2;
char* buf = (char*)mir_alloc(len);
mir_snprintf(buf, len, "%s %s", away, msg_buf);
- mir_free(away);
mir_free(msg_buf);
msg_buf = buf;
}
@@ -1291,11 +1290,10 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
{
char* s_msg = process_status_msg(*msgptr, sn);
- char* away = mir_utf8encodeT(TranslateT("[Auto-Response]:"));
+ T2Utf away(TranslateT("[Auto-Response]:"));
size_t len = mir_strlen(s_msg) + mir_strlen(away) + 2;
char* buf = (char*)alloca(len);
mir_snprintf(buf, len, "%s %s", away, s_msg);
- mir_free(away);
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = m_szModuleName;
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp
index 5097b0d080..01944ef024 100644
--- a/protocols/AimOscar/src/services.cpp
+++ b/protocols/AimOscar/src/services.cpp
@@ -204,34 +204,26 @@ int CAimProto::OnGroupChange(WPARAM hContact,LPARAM lParam)
if (hContact == NULL) {
if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL) {
- char* szOldName = mir_utf8encodeT(grpchg->pszOldName);
+ T2Utf szOldName(grpchg->pszOldName);
unsigned short group_id = group_list.find_id(szOldName);
if (group_id) {
aim_delete_contact(hServerConn, seqno, szOldName, 0, group_id, 1, false);
group_list.remove_by_id(group_id);
update_server_group("", 0);
}
- mir_free(szOldName);
}
else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL) {
- char* szOldName = mir_utf8encodeT(grpchg->pszOldName);
- unsigned short group_id = group_list.find_id(szOldName);
- if (group_id) {
- char* szNewName = mir_utf8encodeT(grpchg->pszNewName);
- update_server_group(szNewName, group_id);
- mir_free(szNewName);
- }
- mir_free(szOldName);
+ unsigned short group_id = group_list.find_id(T2Utf(grpchg->pszOldName));
+ if (group_id)
+ update_server_group(T2Utf(grpchg->pszNewName), group_id);
}
}
else {
if (is_my_contact(hContact) && getBuddyId(hContact, 1) && !db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0)) {
- if (grpchg->pszNewName) {
- char* szNewName = mir_utf8encodeT(grpchg->pszNewName);
- add_contact_to_group(hContact, szNewName);
- mir_free(szNewName);
- }
- else add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
+ if (grpchg->pszNewName)
+ add_contact_to_group(hContact, T2Utf(grpchg->pszNewName));
+ else
+ add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
}
}
return 0;