@@ -2334,6 +2334,10 @@ discord_create_nickname(DiscordUser *author, DiscordGuild *guild, DiscordChannel
23342334 return g_strdup (author -> name );
23352335 }
23362336
2337+ if (author -> global_name ) {
2338+ return g_strdup (author -> global_name );
2339+ }
2340+
23372341 return discord_create_fullname (author );
23382342 }
23392343
@@ -3269,7 +3273,8 @@ discord_process_message(DiscordAccount *da, JsonObject *data, unsigned special_t
32693273 g_free (emoji_str );
32703274 g_free (url );
32713275 } else {
3272- gchar * reaction_str = discord_get_react_text (da , NULL , username , reaction_data );
3276+ DiscordUser * user = discord_get_user_fullname (da , username );
3277+ gchar * reaction_str = discord_get_react_text (da , NULL , user -> global_name ? user -> global_name : (user -> name ? user -> name : username ), reaction_data );
32733278 discord_free_reaction (reaction_data );
32743279
32753280 if (reaction_str != NULL && conv != NULL ) {
@@ -5186,6 +5191,7 @@ discord_friends_auth_reject(
51865191 DiscordUser * user = store -> user ;
51875192 DiscordAccount * da = store -> da ;
51885193
5194+ //TODO should this be a DELETE without the /ignore ?
51895195 gchar * url = g_strdup_printf ("https://" DISCORD_API_SERVER "/api/" DISCORD_API_VERSION "/users/@me/relationships/%" G_GUINT64_FORMAT "/ignore" , user -> id );
51905196 discord_fetch_url_with_method (da , "PUT" , url , NULL , NULL , NULL );
51915197 g_free (url );
@@ -8486,6 +8492,8 @@ discord_got_info(DiscordAccount *da, JsonNode *node, gpointer user_data)
84868492 JsonObject * info = json_node_get_object (node );
84878493 JsonArray * connected_accounts = json_object_get_array_member (info , "connected_accounts" );
84888494 JsonArray * mutual_guilds = json_object_get_array_member (info , "mutual_guilds" );
8495+ JsonArray * badges = json_object_get_array_member (info , "badges" );
8496+ JsonObject * user_profile = json_object_get_object_member (info , "user_profile" );
84898497 gint i ;
84908498
84918499 user_info = purple_notify_user_info_new ();
@@ -8496,6 +8504,10 @@ discord_got_info(DiscordAccount *da, JsonNode *node, gpointer user_data)
84968504
84978505 purple_notify_user_info_add_pair_html (user_info , _ ("Username" ), user -> name );
84988506
8507+ if (user -> global_name && * user -> global_name ) {
8508+ purple_notify_user_info_add_pair_html (user_info , _ ("Display Name" ), user -> global_name );
8509+ }
8510+
84998511 /* Display other non-profile info that we know about this buddy */
85008512 gchar * status_strings [8 ] = {
85018513 _ ("Online" ),
@@ -8517,6 +8529,18 @@ discord_got_info(DiscordAccount *da, JsonNode *node, gpointer user_data)
85178529 purple_notify_user_info_add_pair_html (user_info , _ ("Custom Status" ), user -> custom_status );
85188530 }
85198531
8532+ if (user_profile ) {
8533+ const gchar * bio = json_object_get_string_member (user_profile , "bio" );
8534+ if (bio && * bio ) {
8535+ purple_notify_user_info_add_pair_html (user_info , _ ("Bio" ), bio );
8536+ }
8537+
8538+ const gchar * pronouns = json_object_get_string_member (user_profile , "pronouns" );
8539+ if (pronouns && * pronouns ) {
8540+ purple_notify_user_info_add_pair_html (user_info , _ ("Pronouns" ), pronouns );
8541+ }
8542+ }
8543+
85208544 if (json_array_get_length (connected_accounts )) {
85218545 purple_notify_user_info_add_section_break (user_info );
85228546 purple_notify_user_info_add_pair_html (user_info , _ ("Connected Accounts" ), NULL );
@@ -8567,6 +8591,18 @@ discord_got_info(DiscordAccount *da, JsonNode *node, gpointer user_data)
85678591 }
85688592 }
85698593
8594+ if (json_array_get_length (badges )) {
8595+ purple_notify_user_info_add_section_break (user_info );
8596+ purple_notify_user_info_add_pair_html (user_info , _ ("Badges" ), NULL );
8597+ }
8598+
8599+ for (i = json_array_get_length (badges ) - 1 ; i >= 0 ; i -- ) {
8600+ JsonObject * badge = json_array_get_object_element (badges , i );
8601+ const gchar * name = json_object_get_string_member (badge , "description" );
8602+
8603+ purple_notify_user_info_add_pair_plaintext (user_info , NULL , name );
8604+ }
8605+
85708606 gchar * username = discord_create_fullname (user );
85718607 purple_notify_userinfo (da -> pc , username , user_info , NULL , NULL );
85728608 g_free (username );
0 commit comments