| 2372 } |
2372 } |
| 2373 } |
2373 } |
| 2374 |
2374 |
| 2375 if (status_box->account == NULL) { |
2375 if (status_box->account == NULL) { |
| 2376 PurpleStatusType *acct_status_type = NULL; |
2376 PurpleStatusType *acct_status_type = NULL; |
| |
2377 const char *id = NULL; /* id of acct_status_type */ |
| 2377 PurpleStatusPrimitive primitive = GPOINTER_TO_INT(data); |
2378 PurpleStatusPrimitive primitive = GPOINTER_TO_INT(data); |
| 2378 /* Global */ |
2379 /* Global */ |
| 2379 /* Save the newly selected status to prefs.xml and status.xml */ |
2380 /* Save the newly selected status to prefs.xml and status.xml */ |
| 2380 |
2381 |
| 2381 /* Has the status really been changed? */ |
2382 /* Has the status really been changed? */ |
| 2382 if (status_box->token_status_account) { |
2383 if (status_box->token_status_account) { |
| 2383 gint active; |
2384 gint active; |
| 2384 PurpleStatus *status; |
2385 PurpleStatus *status; |
| 2385 const char *id = NULL; |
|
| 2386 GtkTreePath *path = gtk_tree_row_reference_get_path(status_box->active_row); |
2386 GtkTreePath *path = gtk_tree_row_reference_get_path(status_box->active_row); |
| 2387 active = gtk_tree_path_get_indices(path)[0]; |
2387 active = gtk_tree_path_get_indices(path)[0]; |
| 2388 |
2388 |
| 2389 gtk_tree_path_free(path); |
2389 gtk_tree_path_free(path); |
| 2390 |
2390 |
| 2391 status = purple_account_get_active_status(status_box->token_status_account); |
2391 status = purple_account_get_active_status(status_box->token_status_account); |
| 2392 |
2392 |
| 2393 acct_status_type = find_status_type_by_index(status_box->token_status_account, active); |
2393 acct_status_type = find_status_type_by_index(status_box->token_status_account, active); |
| 2394 id = purple_status_type_get_id(acct_status_type); |
2394 id = purple_status_type_get_id(acct_status_type); |
| 2395 |
2395 |
| 2396 if (strncmp(id, purple_status_get_id(status), strlen(id)) == 0) |
2396 if (strncmp(id, purple_status_get_id(status), strlen(id)) == 0) |
| 2397 { |
2397 { |
| 2398 /* Selected status and previous status is the same */ |
2398 /* Selected status and previous status is the same */ |
| 2418 } |
2418 } |
| 2419 } |
2419 } |
| 2420 |
2420 |
| 2421 if (changed) |
2421 if (changed) |
| 2422 { |
2422 { |
| 2423 /* Manually find the appropriate transient acct */ |
2423 /* Manually find the appropriate transient status */ |
| 2424 if (status_box->token_status_account) { |
2424 if (status_box->token_status_account) { |
| 2425 GList *iter = purple_savedstatuses_get_all(); |
2425 GList *iter = purple_savedstatuses_get_all(); |
| 2426 GList *tmp, *active_accts = purple_accounts_get_all_active(); |
2426 GList *tmp, *active_accts = purple_accounts_get_all_active(); |
| 2427 |
2427 |
| 2428 for (; iter != NULL; iter = iter->next) { |
2428 for (; iter != NULL; iter = iter->next) { |
| 2429 PurpleSavedStatus *ss = iter->data; |
2429 PurpleSavedStatus *ss = iter->data; |
| 2430 const char *ss_msg = purple_savedstatus_get_message(ss); |
2430 const char *ss_msg = purple_savedstatus_get_message(ss); |
| |
2431 /* find a known transient status that is the same as the |
| |
2432 * new selected one */ |
| 2431 if ((purple_savedstatus_get_type(ss) == primitive) && purple_savedstatus_is_transient(ss) && |
2433 if ((purple_savedstatus_get_type(ss) == primitive) && purple_savedstatus_is_transient(ss) && |
| 2432 purple_savedstatus_has_substatuses(ss) && /* Must have substatuses */ |
2434 purple_savedstatus_has_substatuses(ss) && /* Must have substatuses */ |
| 2433 purple_strequal(ss_msg, message)) |
2435 purple_strequal(ss_msg, message)) |
| 2434 { |
2436 { |
| 2435 gboolean found = FALSE; |
2437 gboolean found = FALSE; |
| 2438 PurpleAccount *acct = tmp->data; |
2440 PurpleAccount *acct = tmp->data; |
| 2439 PurpleSavedStatusSub *sub = purple_savedstatus_get_substatus(ss, acct); |
2441 PurpleSavedStatusSub *sub = purple_savedstatus_get_substatus(ss, acct); |
| 2440 if (sub) { |
2442 if (sub) { |
| 2441 const PurpleStatusType *sub_type = purple_savedstatus_substatus_get_type(sub); |
2443 const PurpleStatusType *sub_type = purple_savedstatus_substatus_get_type(sub); |
| 2442 const char *subtype_status_id = purple_status_type_get_id(sub_type); |
2444 const char *subtype_status_id = purple_status_type_get_id(sub_type); |
| 2443 if (subtype_status_id && !strcmp(subtype_status_id, |
2445 if (purple_strequal(subtype_status_id, id)) { |
| 2444 purple_status_type_get_id(acct_status_type))) { |
|
| 2445 found = TRUE; |
2446 found = TRUE; |
| 2446 break; |
2447 break; |
| 2447 } |
2448 } |
| 2448 } |
2449 } |
| 2449 } |
2450 } |