Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#13358 closed patch (fixed)

Add possibility to show status only to friends.

Reported by: pielas Owned by: bartosz
Milestone: 2.8.0 Component: Gadu-Gadu
Version: Keywords:
Cc:

Description

# # old_revision [54e7873c4e78229f13e9d60f11a6e65a96bbd9dd] # # patch "libpurple/protocols/gg/gg.c" # from [7f0250c8f719abd7922cac75d0eb20da58b5a991] # to [68116fb0561c92ab8beb86a07f8af19aa0a89459] # # patch "libpurple/protocols/gg/gg.h" # from [e5ca05fc0e1945e7d729acc0a9bcb7c57682b6b5] # to [174220d8802b40f910662633c10a5312f041bec6] # ============================================================ --- libpurple/protocols/gg/gg.c 7f0250c8f719abd7922cac75d0eb20da58b5a991 +++ libpurple/protocols/gg/gg.c 68116fb0561c92ab8beb86a07f8af19aa0a89459 @@ -49,6 +49,10 @@ static PurplePlugin? *my_protocol = NULL;

static PurplePlugin? *my_protocol = NULL;

+/* Prototypes */ +static void ggp_set_status(PurpleAccount? *account, PurpleStatus? *status); +static int ggp_to_gg_status(PurpleStatus? *status, char msg); +

/* ---------------------------------------------------------------------- */ /* ----- EXTERNAL CALLBACKS --------------------------------------------- */ /* ---------------------------------------------------------------------- */

@@ -755,6 +759,61 @@ static void ggp_change_passwd(PurplePlug?

ggp_token_request(gc, ggp_change_passwd_dialog);

}

+/* ----- CHANGE STATUS BROADCASTING ------------------------------------------------ */ + +static void ggp_action_change_status_broadcasting_ok(PurpleConnection? *gc, PurpleRequestFields? *fields) +{ + GGPInfo *info = gc->proto_data; + int selected_field; + PurpleAccount? *account = purple_connection_get_account(gc); + PurpleStatus? *status; + + selected_field = purple_request_fields_get_choice(fields, "status_broadcasting"); + + if (selected_field == 0) + info->status_broadcasting = TRUE; + else + info->status_broadcasting = FALSE; + + status = purple_account_get_active_status(account); + + ggp_set_status(account, status); +} + +static void ggp_action_change_status_broadcasting(PurplePluginAction? *action) +{ + PurpleConnection? *gc = (PurpleConnection? *)action->context; + GGPInfo *info = gc->proto_data; + + PurpleRequestFields? *fields; + PurpleRequestFieldGroup? *group; + PurpleRequestField? *field; + + fields = purple_request_fields_new(); + group = purple_request_field_group_new(NULL); + purple_request_fields_add_group(fields, group); + + field = purple_request_field_choice_new("status_broadcasting", _("Show status to:"), 0); + purple_request_field_choice_add(field, _("All people")); + purple_request_field_choice_add(field, _("Only friends")); + purple_request_field_group_add_field(group, field); + + if (info->status_broadcasting) + purple_request_field_choice_set_default_value(field, 0); + else + purple_request_field_choice_set_default_value(field, 1); + + purple_request_fields(gc, + _("Change status broadcasting"), + _("Change status broadcasting"), + _("Please, select who can see your status"), + fields, + _("OK"), G_CALLBACK(ggp_action_change_status_broadcasting_ok), + _("Cancel"), NULL, + purple_connection_get_account(gc), NULL, NULL, + gc); +} +

/* ----- CONFERENCES ---------------------------------------------------- */

static void ggp_callback_add_to_chat_ok(PurpleBuddy? *buddy, PurpleRequestFields? *fields)

@@ -856,10 +915,6 @@ static void ggp_bmenu_block(PurpleBlistN

/* ----- INTERNAL CALLBACKS --------------------------------------------- */ /* ---------------------------------------------------------------------- */

-/* Prototypes */ -static void ggp_set_status(PurpleAccount? *account, PurpleStatus? *status); -static int ggp_to_gg_status(PurpleStatus? *status, char msg); -

struct gg_fetch_avatar_data {

PurpleConnection? *gc;

@@ -1948,7 +2003,8 @@ static void ggp_login(PurpleAccount? *acc

info->searches = ggp_search_new(); info->pending_richtext_messages = NULL; info->pending_images = g_hash_table_new(g_int_hash, g_int_equal);

- + info->status_broadcasting = purple_account_get_bool(account, "status_broadcasting", TRUE); +

gc->proto_data = info;

glp->uin = ggp_get_uin(account);

@@ -1965,6 +2021,9 @@ static void ggp_login(PurpleAccount? *acc

glp->status = ggp_to_gg_status(status, &glp->status_descr); glp->tls = 0;

+ if (!info->status_broadcasting) + glp->status = glp->status|GG_STATUS_FRIENDS_MASK; +

address = purple_account_get_string(account, "gg_server", ""); if (address && *address) {

/* TODO: Make this non-blocking */

@@ -2021,6 +2080,8 @@ static void ggp_close(PurpleConnection? *

gg_free_session(info->session);

}

+ purple_account_set_bool(account, "status_broadcasting", info->status_broadcasting); +

/* Immediately close any notifications on this handle since that process depends

  • upon the contents of info->searches, which we are about to destroy. */

@@ -2243,6 +2304,9 @@ static void ggp_set_status(PurpleAccount?

new_status = ggp_to_gg_status(status, &new_msg);

+ if (!info->status_broadcasting) + new_status = new_status|GG_STATUS_FRIENDS_MASK; +

if (new_msg == NULL) {

gg_change_status(info->session, new_status);

} else {

@@ -2431,6 +2495,10 @@ static GList *ggp_actions(PurplePlugin? *

ggp_action_buddylist_load);

m = g_list_append(m, act);

+ act = purple_plugin_action_new(_("Change status broadcasting"), + ggp_action_change_status_broadcasting); + m = g_list_append(m, act); +

return m;

}

============================================================ --- libpurple/protocols/gg/gg.h e5ca05fc0e1945e7d729acc0a9bcb7c57682b6b5 +++ libpurple/protocols/gg/gg.h 174220d8802b40f910662633c10a5312f041bec6 @@ -64,6 +64,7 @@ typedef struct {

int chats_count; GList *pending_richtext_messages; GHashTable *pending_images;

+ gboolean status_broadcasting; When TRUE status is visible to all, when FALSE status is visible only to friends.

} GGPInfo;

#endif /* _PURPLE_GG_H */

Attachments (1)

diff.path (5.6 KB) - added by pielas 8 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 8 years ago by Robby

  • Milestone set to Patches Needing Review

comment:2 Changed 8 years ago by datallah

Please submit the patch as an attached file.

Changed 8 years ago by pielas

comment:3 follow-up: Changed 8 years ago by rekkanoryo

If this patch compiles tomorrow when I look at applying it, I will commit it. I need a name and (preferably) an e-mail address to credit you with.

comment:4 in reply to: ↑ 3 Changed 8 years ago by pielas

Replying to rekkanoryo:

If this patch compiles tomorrow when I look at applying it, I will commit it. I need a name and (preferably) an e-mail address to credit you with.

My name is Mateusz Piękos. And my e-mail address is mateuszpiekos@…

comment:5 Changed 8 years ago by mateuszpiekos@…

  • Milestone changed from Patches Needing Review to 2.7.12
  • Resolution set to fixed
  • Status changed from new to closed

(In 0def6190f1792037a4b56d7e6c76bbd7ba704eba):
Gadu-Gadu: Allow showing your status only to people on your buddy list. Fixes #13358.

comment:6 Changed 8 years ago by rekkanoryo@…

(In d38f6aa4122f846cb3e03aecdd8da0e42064321f):
Make terminology more consistent with the rest of our strings. Refs #13358.

comment:7 Changed 8 years ago by rekkanoryo@…

(In c9d9df8328b3821943ad9922c10837433df34d46):
Credit where due. Refs #13358.

comment:8 Changed 8 years ago by rekkanoryo

  • Milestone changed from 2.7.12 to 2.8.0
Note: See TracTickets for help on using tickets.
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!