summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-07-05 00:10:36 +0000
committersje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-07-05 00:10:36 +0000
commite37c2bd12221f2acb255d6b04a537125ddb72e6c (patch)
tree0a4d031cace281353741cec0a46b35de7ee600ec
parent6b79b2082730c0d71a326899d5315d48447d40f4 (diff)
more unicode patches from borkra (thx!)
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@253 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r--metacontacts/meta_menu.c13
-rw-r--r--metacontacts/meta_services.c2
-rw-r--r--metacontacts/meta_utils.c43
3 files changed, 34 insertions, 24 deletions
diff --git a/metacontacts/meta_menu.c b/metacontacts/meta_menu.c
index b2dbb96..9367d3b 100644
--- a/metacontacts/meta_menu.c
+++ b/metacontacts/meta_menu.c
@@ -470,8 +470,17 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam)
mi.pszName = buf;
mi.flags = 0;
} else {
- mi.pszName = CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_UNICODE);
- mi.flags = CMIF_UNICODE;
+ char *name = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0);
+ char *wname = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_UNICODE);
+
+ if(wname && strncmp(name, wname, strlen(name)) != 0) {
+ mi.pszName = wname;
+ mi.flags = CMIF_UNICODE;
+ }
+ else {
+ mi.pszName = name;
+ mi.flags = 0;
+ }
}
mi.flags |= CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
diff --git a/metacontacts/meta_services.c b/metacontacts/meta_services.c
index 0cd2647..e778a20 100644
--- a/metacontacts/meta_services.c
+++ b/metacontacts/meta_services.c
@@ -838,7 +838,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- DBWriteContactSettingString(hMeta, META_PROTO, buffer, dcws->value.pszVal);
+ MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
}
// copy nick to metacontact, if it's the most online
diff --git a/metacontacts/meta_utils.c b/metacontacts/meta_utils.c
index 1121cf3..79cba6f 100644
--- a/metacontacts/meta_utils.c
+++ b/metacontacts/meta_utils.c
@@ -229,7 +229,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
char *proto,
*field;
DWORD num_contacts;
- char buffer[512], buffer2[512], buffer3[512];
+ char buffer[512], buffer2[512];
WORD status;
HANDLE most_online;
@@ -309,27 +309,27 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default)
DBFreeVariant(&cws.value);
}
- // Get the displayname of the subcontact
- strncpy(buffer3, (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)src, 0), 512);
+ {
+ // Get the displayname of the subcontact
+ char *name = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)src, 0);
+ wchar_t *wname = (wchar_t *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)src, GCDNF_UNICODE);
- // write the display name
- strcpy(buffer, "CListName");
- strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
+ // write the display name
+ strcpy(buffer, "CListName");
+ strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
- cws.szModule=META_PROTO;
- cws.szSetting=buffer;
+ if(wname && strncmp(name, (char *)wname, strlen(name)) != 0) {
+ DBWriteContactSettingWString(dest, META_PROTO, buffer, wname);
+ } else
+ DBWriteContactSettingString(dest, META_PROTO, buffer, name);
- if(DBWriteContactSettingString(dest, META_PROTO, buffer, buffer3)) {
- MessageBox(0, Translate("Could not write clist displayname of contact to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
- return FALSE;
+ // Get the status
+ if(!proto)
+ status = ID_STATUS_OFFLINE;
+ else
+ status = DBGetContactSettingWord(src, proto, "Status", ID_STATUS_OFFLINE);
}
- // Get the status
- if(!proto)
- status = ID_STATUS_OFFLINE;
- else
- status = DBGetContactSettingWord(src, proto, "Status", ID_STATUS_OFFLINE);
-
// write the status
strcpy(buffer, "Status");
strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
@@ -1011,14 +1011,14 @@ int Meta_HideLinkedContacts(void) {
if(proto && !DBGetContactSetting(hContact, proto, "Nick", &dbv)) {
strcpy(buffer, "Nick");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- DBWriteContactSettingString(hContact2, META_PROTO, buffer, dbv.pszVal);
+ MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
if(DBGetContactSetting(hContact, "CList", "MyHandle", &dbv2)) {
- DBWriteContactSettingString(hContact2, META_PROTO, buffer, dbv.pszVal);
+ MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
} else {
- DBWriteContactSettingString(hContact2, META_PROTO, buffer, dbv2.pszVal);
+ MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv2);
DBFreeVariant(&dbv2);
}
@@ -1027,7 +1027,7 @@ int Meta_HideLinkedContacts(void) {
if(!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) {
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- DBWriteContactSettingString(hContact2, META_PROTO, buffer, dbv.pszVal);
+ MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
DBFreeVariant(&dbv);
}
}
@@ -1715,3 +1715,4 @@ int Meta_IsEnabled() {
}
+