Fix RPC calls failing for users with Umlauts in Adium

Fix issue with name normalization by assuring that the id/name lookup always uses composed strings. Remove the now-unused function in the Adium bundle.
This commit is contained in:
mjentsch 2015-12-28 17:46:39 +01:00
parent 8fed82cc75
commit c921a91b42
2 changed files with 6 additions and 14 deletions

View file

@ -103,19 +103,6 @@
intValue]);
}
/**!
* @brief Returns the name passed to new_purple_buddy, when adding a new contact
*
* This function is called when creating a new contact from the purple GUI.
*/
- (NSString *)_UIDForAddingObject:(AIListContact *)object
{
// The contact UID in Adium was encoded with decomposoed unicode codepoints (see http://unicode.org/reports/tr15/).
// Since libtgl and libpurple (and apparently the rest of the world) encode with composed code points, the name
// needs to be converted to the composed format to prevent inequality in binary string comparison.
return [object.UID precomposedStringWithCanonicalMapping];
}
#pragma mark Action Menu
-(NSMenu*)actionMenuForChat:(AIChat*)chat
{

View file

@ -45,6 +45,10 @@ const char *tgp_blist_lookup_purple_name (struct tgl_state *TLS, tgl_peer_id_t i
}
void tgp_blist_lookup_add (struct tgl_state *TLS, tgl_peer_id_t id, const char *purple_name) {
// to avoid issues with differences in string normalization, always store in composed form this helps to avoid
// issues with clients like Adium, that will store strings in decomposed format by default
const char *name = g_utf8_normalize (purple_name, -1, G_NORMALIZE_DEFAULT_COMPOSE);
g_hash_table_replace (tls_get_data (TLS)->id_to_purple_name, GINT_TO_POINTER(tgl_get_peer_id (id)),
g_strdup (name));
@ -53,7 +57,8 @@ void tgp_blist_lookup_add (struct tgl_state *TLS, tgl_peer_id_t id, const char *
}
static tgl_peer_id_t *tgp_blist_lookup_get_id (struct tgl_state *TLS, const char *purple_name) {
return g_hash_table_lookup (tls_get_data (TLS)->purple_name_to_id, purple_name);
return g_hash_table_lookup (tls_get_data (TLS)->purple_name_to_id,
g_utf8_normalize (purple_name, -1, G_NORMALIZE_DEFAULT_COMPOSE));
}
tgl_peer_t *tgp_blist_lookup_peer_get (struct tgl_state *TLS, const char *purple_name) {