static void email_response_cb(GtkDialog *dlg, gint id, PidginMailDialog *dialog) { PidginNotifyMailData *data = NULL; GtkTreeIter iter; if (id == GTK_RESPONSE_YES) { GtkTreeSelection *selection; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); if (gtk_tree_selection_get_selected(selection, NULL, &iter)) { gtk_tree_model_get(GTK_TREE_MODEL(dialog->treemodel), &iter, PIDGIN_MAIL_DATA, &data, -1); purple_notify_uri(NULL, data->url); gtk_tree_store_remove(dialog->treemodel, &iter); if (data->purple_has_handle) purple_notify_close(PURPLE_NOTIFY_EMAILS, data); else pidgin_close_notify(PURPLE_NOTIFY_EMAILS, data); if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) return; } else return; } else { while (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) { gtk_tree_model_get(GTK_TREE_MODEL(dialog->treemodel), &iter, PIDGIN_MAIL_DATA, &data, -1); if (id == GTK_RESPONSE_ACCEPT) purple_notify_uri(NULL, data->url); gtk_tree_store_remove(dialog->treemodel, &iter); if (data->purple_has_handle) purple_notify_close(PURPLE_NOTIFY_EMAILS, data); else pidgin_close_notify(PURPLE_NOTIFY_EMAILS, data); } } gtk_widget_destroy(dialog->dialog); g_free(dialog); mail_dialog = NULL; }
static void action_change_password(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; g_return_if_fail(NULL != gc && NULL != gc->proto_data); purple_notify_uri(NULL, "https://password.qq.com"); }
static void action_change_password(PurplePluginAction *action) { purple_debug_warning("np","\n===>"); PurpleConnection *gc = (PurpleConnection *) action->context; g_return_if_fail(NULL != gc && NULL != gc->proto_data); purple_notify_uri(NULL, "https://password.np.com"); }
static void pb_oauth_request_access_token(PurpleAccount *account) { purple_notify_uri(account, "https://www.pushbullet.com/authorize?client_id=0m8Tcu8rNSBxeWL65e6nTKmqXqZSIKEe&redirect_uri=https%3A%2F%2Fwww.pushbullet.com%2Flogin-success&response_type=token&scope=everything"); purple_request_input(NULL, NULL, _("Set your Access Token"), _("Copy the Success URL you are sent to after you accept"), NULL, FALSE, FALSE, "https://www.pushbullet.com/login-success#access_token=...", _("OK"), G_CALLBACK(pb_oauth_set_access_token_cb), _("Cancel"), NULL, account, NULL, NULL, account); }
PurpleCmdRet PurpleLine::cmd_open(PurpleConversation *conv, const gchar *, gchar **args, gchar **error, void *) { static std::map<line::ContentType::type, std::string> attachment_extensions = { { line::ContentType::IMAGE, ".jpg" }, { line::ContentType::VIDEO, ".mp4" }, { line::ContentType::AUDIO, ".mp3" }, }; std::string token(args[0]); Attachment *att = conv_attachment_get(conv, token); if (!att) { *error = g_strdup("No such attachment."); return PURPLE_CMD_RET_FAILED; } if (att->path != "" && g_file_test(att->path.c_str(), G_FILE_TEST_EXISTS)) { purple_notify_uri(conn, att->path.c_str()); return PURPLE_CMD_RET_OK; } // Ensure there's nothing funny about the id as we're going to use it as a path element try { std::stoll(att->id); } catch (...) { *error = g_strdup("Failed to download attachment."); return PURPLE_CMD_RET_FAILED; } std::string ext = ".jpg"; if (attachment_extensions.count(att->type)) ext = attachment_extensions[att->type]; std::string dir = get_tmp_dir(true); gchar *path_p = g_build_filename( dir.c_str(), (att->id + ext).c_str(), nullptr); std::string path(path_p); g_free(path_p); purple_conversation_write( conv, "", "Downloading attachment...", (PurpleMessageFlags)PURPLE_MESSAGE_SYSTEM, time(NULL)); std::string url = std::string(LINE_OS_URL) + "os/m/"+ att->id; PurpleConversationType ctype = purple_conversation_get_type(conv); std::string cname = std::string(purple_conversation_get_name(conv)); http.request(url, HTTPFlag::AUTH | HTTPFlag::LARGE, [this, path, token, ctype, cname] (int status, const guchar *data, gsize len) { if (status == 200 && data && len > 0) { g_file_set_contents(path.c_str(), (const char *)data, len, nullptr); temp_files.push_back(path); PurpleConversation *conv = purple_find_conversation_with_account( ctype, cname.c_str(), acct); if (conv) { Attachment *att = conv_attachment_get(conv, token); if (att) att->path = path; } purple_notify_uri(conn, path.c_str()); } else { notify_error("Failed to download attachment."); } }); return PURPLE_CMD_RET_OK; }
static void url_cmd (MsnCmdProc *cmdproc, MsnCommand *cmd) { MsnSession *session; PurpleConnection *connection; const gchar *rru; const gchar *url; gchar creds[64]; glong tmp_timestamp; session = cmdproc->session; connection = purple_account_get_connection (session->account); rru = cmd->params[1]; url = cmd->params[2]; session->passport_info.mail_url_timestamp = time (NULL); tmp_timestamp = session->passport_info.mail_url_timestamp - session->passport_info.sl; { PurpleCipher *cipher; PurpleCipherContext *context; guchar digest[16]; gchar *buf; buf = pecan_strdup_printf ("%s%ld%s", session->passport_info.mspauth ? session->passport_info.mspauth : "BOGUS", tmp_timestamp, purple_connection_get_password (connection)); cipher = purple_ciphers_find_cipher ("md5"); context = purple_cipher_context_new (cipher, NULL); purple_cipher_context_append (context, (const guchar *) buf, strlen (buf)); purple_cipher_context_digest (context, sizeof (digest), digest, NULL); purple_cipher_context_destroy (context); g_free (buf); memset (creds, 0, sizeof (creds)); { gchar buf2[3]; gint i; for (i = 0; i < 16; i++) { g_snprintf (buf2, sizeof (buf2), "%02x", digest[i]); strcat (creds, buf2); } } } g_free (session->passport_info.mail_url); session->passport_info.mail_url = g_strdup_printf ("%s&auth=%s&creds=%s&sl=%ld&username=%s&mode=ttl&sid=%s&id=2&rru=%ssvc_mail&js=yes", url, session->passport_info.mspauth, creds, tmp_timestamp, msn_session_get_username (session), session->passport_info.sid, rru); /* The user wants to check his email */ if (cmd->trans && cmd->trans->data) { purple_notify_uri (connection, session->passport_info.mail_url); return; } if (purple_account_get_check_mail (session->account)) { static gboolean is_initial = TRUE; if (!is_initial) return; if (session->inbox_unread_count > 0) { const gchar *passport; const gchar *main_url; passport = msn_session_get_username (session); main_url = session->passport_info.mail_url; purple_notify_emails (connection, session->inbox_unread_count, FALSE, NULL, NULL, &passport, &main_url, NULL, NULL); } is_initial = FALSE; } }
static void _purple_notify_plus_email_action_callback(NotifyNotification *notification, char *action, gpointer user_data) { const gchar *url = user_data; purple_notify_uri(notify_plus, url); }
static void release_show() { purple_notify_uri(NULL, PURPLE_WEBSITE); }
static void notify_uri_cb(PurplePluginAction *action) { /* This one should open your web browser of choice. */ purple_notify_uri(question_and_answer_plugin, "http://www.pidgin.im/"); }
static void open_button_cb(GtkButton *button, PidginXferDialog *dialog) { #ifdef _WIN32 /* If using Win32... */ int code; if (G_WIN32_HAVE_WIDECHAR_API ()) { wchar_t *wc_filename = g_utf8_to_utf16( purple_xfer_get_local_filename( dialog->selected_xfer), -1, NULL, NULL, NULL); code = (int) ShellExecuteW(NULL, NULL, wc_filename, NULL, NULL, SW_SHOW); g_free(wc_filename); } else { char *l_filename = g_locale_from_utf8( purple_xfer_get_local_filename( dialog->selected_xfer), -1, NULL, NULL, NULL); code = (int) ShellExecuteA(NULL, NULL, l_filename, NULL, NULL, SW_SHOW); g_free(l_filename); } if (code == SE_ERR_ASSOCINCOMPLETE || code == SE_ERR_NOASSOC) { purple_notify_error(dialog, NULL, _("There is no application configured to open this type of file."), NULL); } else if (code < 32) { purple_notify_error(dialog, NULL, _("An error occurred while opening the file."), NULL); purple_debug_warning("ft", "filename: %s; code: %d\n", purple_xfer_get_local_filename(dialog->selected_xfer), code); } #else const char *filename = purple_xfer_get_local_filename(dialog->selected_xfer); char *command = NULL; char *tmp = NULL; GError *error = NULL; if (purple_running_gnome()) { char *escaped = g_shell_quote(filename); command = g_strdup_printf("gnome-open %s", escaped); g_free(escaped); } else if (purple_running_kde()) { char *escaped = g_shell_quote(filename); if (purple_str_has_suffix(filename, ".desktop")) command = g_strdup_printf("kfmclient openURL %s 'text/plain'", escaped); else command = g_strdup_printf("kfmclient openURL %s", escaped); g_free(escaped); } else { purple_notify_uri(NULL, filename); return; } if (purple_program_is_valid(command)) { gint exit_status; if (!g_spawn_command_line_sync(command, NULL, NULL, &exit_status, &error)) { tmp = g_strdup_printf(_("Error launching %s: %s"), purple_xfer_get_local_filename(dialog->selected_xfer), error->message); purple_notify_error(dialog, NULL, _("Unable to open file."), tmp); g_free(tmp); g_error_free(error); } if (exit_status != 0) { char *primary = g_strdup_printf(_("Error running %s"), command); char *secondary = g_strdup_printf(_("Process returned error code %d"), exit_status); purple_notify_error(dialog, NULL, primary, secondary); g_free(tmp); } } #endif }