static void purplemot_get_info(PurpleConnection *gc, const char *username) { const char *body; PurpleNotifyUserInfo *info = purple_notify_user_info_new(); PurpleAccount *acct; purple_debug_info("purplemot", "Fetching %s's user info for %s\n", username, gc->account->username); if (!get_purplemot_gc(username)) { char *msg = g_strdup_printf(_("%s is not logged in."), username); purple_notify_error(gc, _("User Info"), _("User info not available. "), msg); g_free(msg); } acct = purple_accounts_find(username, PURPLEMOT_ID); if (acct) body = purple_account_get_user_info(acct); else body = _("No user info."); purple_notify_user_info_add_pair(info, "Info", body); /* show a buddy's user info in a nice dialog box */ purple_notify_userinfo(gc, /* connection the buddy info came through */ username, /* buddy's username */ info, /* body */ NULL, /* callback called when dialog closed */ NULL); /* userdata for callback */ }
static void purplemot_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *info, int full) { PurpleConnection *gc = get_purplemot_gc(buddy->name); if (gc) { /* they're logged in */ PurplePresence *presence = purple_buddy_get_presence(buddy); PurpleStatus *status = purple_presence_get_active_status(presence); char *msg = purplemot_status_text(buddy); purple_notify_user_info_add_pair(info, purple_status_get_name(status), msg); g_free(msg); if (full) { const char *user_info = purple_account_get_user_info(gc->account); if (user_info) purple_notify_user_info_add_pair(info, _("User info"), user_info); } } else { /* they're not logged in */ purple_notify_user_info_add_pair(info, _("User info"), _("not logged in")); } purple_debug_info("purplemot", "showing %s tooltip for %s\n", (full) ? "full" : "short", buddy->name); }
static void nullprpl_get_info(PurpleConnection *gc, const char *username) { const char *body; PurpleNotifyUserInfo *info = purple_notify_user_info_new(); PurpleAccount *acct; purple_debug_info("nullprpl", "Fetching %s's user info for %s\n", username, purple_account_get_username(purple_connection_get_account(gc))); acct = purple_accounts_find(username, NULLPRPL_ID); if (!get_nullprpl_gc(username)) { char *msg = g_strdup_printf(_("%s is not logged in."), username); purple_notify_error(gc, _("User Info"), _("User info not available. "), msg, purple_request_cpar_from_account(acct)); g_free(msg); } if (acct) body = purple_account_get_user_info(acct); else body = _("No user info."); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair_html(info, "Info", body); /* show a buddy's user info in a nice dialog box */ purple_notify_userinfo(gc, /* connection the buddy info came through */ username, /* buddy's username */ info, /* body */ NULL, /* callback called when dialog closed */ NULL); /* userdata for callback */ }
static void nullprpl_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *info, gboolean full) { PurpleConnection *gc = get_nullprpl_gc(purple_buddy_get_name(buddy)); if (gc) { /* they're logged in */ PurplePresence *presence = purple_buddy_get_presence(buddy); PurpleStatus *status = purple_presence_get_active_status(presence); char *msg = nullprpl_status_text(buddy); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair_html(info, purple_status_get_name(status), msg); g_free(msg); if (full) { const char *user_info = purple_account_get_user_info(purple_connection_get_account(gc)); if (user_info) /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair_html(info, _("User info"), user_info); } } else { /* they're not logged in */ purple_notify_user_info_add_pair_plaintext(info, _("User info"), _("not logged in")); } purple_debug_info("nullprpl", "showing %s tooltip for %s\n", (full) ? "full" : "short", purple_buddy_get_name(buddy)); }
void QuetzalAccount::save() { if (m_isLoading) return; // Test it else return; Config cfg = config(); cfg.beginGroup(QLatin1String("general")); cfg.setValue(QLatin1String("alias"), purple_account_get_alias(m_account)); cfg.setValue(QLatin1String("userInfo"), purple_account_get_user_info(m_account)); if (purple_account_get_remember_password(m_account)) cfg.setValue(QLatin1String("passwd"), purple_account_get_password(m_account), Config::Crypted); else cfg.remove(QLatin1String("passwd")); QVariantMap settings; g_hash_table_foreach(m_account->settings, (GHFunc)quetzal_serialize_node, &settings); cfg.setValue(QLatin1String("quetzal_settings"), settings); }
// update the info for the connection gc // prevInfo and prevStat are the previously set data for that account (so we don't keep setting the same thing over) char* updateInfo(PurpleConnection *gc, char* prevInfo, char* title, char* artist, gboolean isPlaying, gboolean updateStatus) { PurpleAccount* account; char* curAcct; char* statusText = NULL; char* servStatusText = NULL; const char* sid = NULL; const char* acctInfo = NULL; gboolean hasStatus = FALSE; account = purple_connection_get_account(gc); acctInfo = purple_account_get_user_info(account); if(acctInfo != NULL) { curAcct = g_strdup(acctInfo); } else { curAcct = g_strdup("\0"); } hasStatus = getStatusText(&statusText, &servStatusText, account, &sid); if(isPlaying) { //replace the appropriate text replaceText(&curAcct, start_songText, "\0"); replaceText(&curAcct, end_songText, "\0"); replaceText(&curAcct, artist_replace, artist); replaceText(&curAcct, title_replace, title); //hide everything in the "no song" tag hideBetween(&curAcct, start_noSongText, end_noSongText); //and do it for the status if(hasStatus) { replaceText(&statusText, start_songText, "\0"); replaceText(&statusText, end_songText, "\0"); replaceText(&statusText, artist_replace, artist); replaceText(&statusText, title_replace, title); hideBetween(&statusText, start_noSongText, end_noSongText); } } else { //replace the appropriate text replaceText(&curAcct, start_noSongText, "\0"); replaceText(&curAcct, end_noSongText, "\0"); //hide everything in the song tag hideBetween(&curAcct, start_songText, end_songText); //and for the status: if(hasStatus) { replaceText(&statusText, start_noSongText, "\0"); replaceText(&statusText, end_noSongText, "\0"); hideBetween(&statusText, start_songText, end_songText); } } //this is so we don't update the server if we don't have to if(strcmp(curAcct, prevInfo) != 0) { serv_set_info(gc, curAcct); } if(hasStatus) { if(updateStatus || strcmp(statusText, servStatusText) != 0) { under_recursion = TRUE; purple_account_set_status(account, sid, TRUE, "message", statusText, NULL); under_recursion = FALSE; } g_free(statusText); g_free(servStatusText); } return curAcct; }