summaryrefslogtreecommitdiff
path: root/metacontacts/meta_utils.c
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 /metacontacts/meta_utils.c
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
Diffstat (limited to 'metacontacts/meta_utils.c')
-rw-r--r--metacontacts/meta_utils.c43
1 files changed, 22 insertions, 21 deletions
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() {
}
+