pidgin/purple-plugin-pack
Remove the stress plugin as it doesn't build by default
--- a/meson.build Sun Mar 01 20:10:18 2020 -0600
+++ b/meson.build Sun Mar 01 20:19:07 2020 -0600
@@ -191,7 +191,6 @@
--- a/stress/README.md Sun Mar 01 20:10:18 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
--- a/stress/meson.build Sun Mar 01 20:10:18 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-if TYPES.contains('abusive') and PURPLE.found()
- stress = shared_library('stress',
- dependencies : [PURPLE, GLIB],
- install_dir : PURPLE_LIBDIR)
- PP_PURPLE_BUILD += 'stress'
--- a/stress/stress.c Sun Mar 01 20:10:18 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,494 +0,0 @@
- * stress - stresses libpurple's event system
- * Copyright (C) 2008 Gary Kramlich <grim@reaperworld.com>
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
-#include "../common/pp_internal.h"
-#define STRESS_BUDDY(buddy) \
- ((StressBuddy *)purple_buddy_get_protocol_data(buddy))
-/******************************************************************************
- *****************************************************************************/
-/******************************************************************************
- *****************************************************************************/
- STRESS_EVENT_STOPPED_TYPING,
- STRESS_EVENT_SEND_MESSAGE,
-/******************************************************************************
- *****************************************************************************/
-static GList *buddies = NULL;
-static GList *events = NULL;
-static gint nevents = 0;
-static gint message_min = 0;
-static gint message_max = 0;
-/******************************************************************************
- *****************************************************************************/
-stress_send_im(PurpleAccount *account, PurpleBuddy *buddy, const gchar *name) {
- PurpleConnection *pc = NULL;
- gint length = 0, i = 0;
- /* build the message */
- msg = g_string_new("");
- length = (rand() % (message_max - message_min)) + message_min;
- for(i = 0; i < length; i += 4) {
- gint value = rand() % 65536;
- g_string_append_printf(msg, "%04x", value);
- pc = purple_account_get_connection(account);
- serv_got_im(pc, name, msg->str, 0, time(NULL));
- g_string_free(msg, TRUE);
-stress_close_convs(PurpleAccount *account, const gchar *name) {
- PurpleConversation *conv = NULL;
- conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name,
- purple_conversation_destroy(conv);
-stress_event_cb(gpointer data) {
- StressBuddy *sb = (StressBuddy *)data;
- PurpleAccount *account = purple_buddy_get_account(sb->buddy);
- PurpleStatus *status = NULL;
- gint event = rand() % nevents;
- const gchar *name = purple_buddy_get_name(sb->buddy), *sevent = NULL;
- /* increment our event counter */
- event = GPOINTER_TO_INT(g_list_nth_data(events, event));
- case STRESS_EVENT_SIGN_ON: sevent = "signon"; break;
- case STRESS_EVENT_SIGN_OFF: sevent = "signoff"; break;
- case STRESS_EVENT_IDLE: sevent = "idle"; break;
- case STRESS_EVENT_UNIDLE: sevent = "unidle"; break;
- case STRESS_EVENT_AWAY: sevent = "away"; break;
- case STRESS_EVENT_BACK: sevent = "back"; break;
- case STRESS_EVENT_TYPING: sevent = "typing"; break;
- case STRESS_EVENT_STOPPED_TYPING: sevent = "stopped typing"; break;
- case STRESS_EVENT_SEND_MESSAGE: sevent = "message"; break;
- purple_debug_info("stress", "firing '%s' for '%s' (event %d of %d)\n",
- sevent, name, sb->nevents, sb->maxevents);
- case STRESS_EVENT_SIGN_ON:
- case STRESS_EVENT_BACK:
- purple_prpl_got_user_status(account, name, "available", NULL);
- case STRESS_EVENT_SIGN_OFF:
- purple_prpl_got_user_status(account, name, "offline", NULL);
- case STRESS_EVENT_IDLE:
- purple_prpl_got_user_idle(account, name, TRUE, 0);
- case STRESS_EVENT_UNIDLE:
- purple_prpl_got_user_idle(account, name, FALSE, 0);
- case STRESS_EVENT_AWAY:
- purple_prpl_got_user_status(account, name, "away", NULL);
- case STRESS_EVENT_SEND_MESSAGE:
- stress_send_im(account, sb->buddy, name);
- msg = g_strdup_printf("event %d of %d", sb->nevents, sb->maxevents);
- status = purple_presence_get_active_status(sb->buddy->presence);
- purple_status_set_attr_string(status, "message", msg);
- if(sb->maxevents > 0 && sb->nevents >= sb->maxevents) {
- purple_prpl_got_user_status(account, name, "available",
- purple_prpl_got_user_idle(account, name, FALSE, 0);
- stress_close_convs(account, name);
-/******************************************************************************
- *****************************************************************************/
-stress_list_icon(PurpleAccount *account, PurpleBuddy *b) {
-stress_status_text(PurpleBuddy *buddy) {
- PurplePresence *presence = purple_buddy_get_presence(buddy);
- PurpleStatus *status = purple_presence_get_active_status(presence);
- const gchar *msg = NULL;
- msg = purple_status_get_attr_string(status, "message");
- return (msg) ? g_strdup(msg) : NULL;
-#define add_event(setting, e1, e2) G_STMT_START { \
- if(purple_account_get_bool(account, (setting), TRUE)) { \
- events = g_list_prepend(events, GINT_TO_POINTER((e1))); \
- events = g_list_prepend(events, GINT_TO_POINTER((e2))); \
-stress_login(PurpleAccount *account) {
- PurpleConnection *pc = NULL;
- gint n_buddies = 0, i = 0, interval = 0, maxevents = 0;
- /* build our possible events from the account settings */
- add_event("trigger_signon", STRESS_EVENT_SIGN_ON, STRESS_EVENT_SIGN_OFF);
- add_event("trigger_idle", STRESS_EVENT_IDLE, STRESS_EVENT_UNIDLE);
- add_event("trigger_away", STRESS_EVENT_AWAY, STRESS_EVENT_BACK);
- add_event("trigger_typing", STRESS_EVENT_TYPING, STRESS_EVENT_STOPPED_TYPING);
- add_event("send_messages", STRESS_EVENT_SEND_MESSAGE, -1);
- nevents = g_list_length(events);
- /* get our connection and set it as online */
- pc = purple_account_get_connection(account);
- purple_connection_set_state(pc, PURPLE_CONNECTED);
- /* grab the account settings we need for buddies */
- n_buddies = purple_account_get_int(account, "nbuddies", 50);
- maxevents = purple_account_get_int(account, "maxevents", 100);
- interval = (guint)purple_account_get_int(account, "interval", 500);
- message_min = purple_account_get_int(account, "message_min", 16);
- message_max = purple_account_get_int(account, "message_max", 128);
- g = purple_group_new("prpl-stress");
- for(i = 0; i < n_buddies; i++) {
- StressBuddy *sb = NULL;
- /* create the buddy and it's name */
- name = g_strdup_printf("stress-%04x", i);
- b = purple_buddy_new(account, name, NULL);
- /* add our data to the buddy */
- sb = g_new0(StressBuddy, 1);
- sb->maxevents = maxevents;
- purple_buddy_set_protocol_data(b, sb);
- /* add the buddy to our list and the purple blist */
- buddies = g_list_prepend(buddies, sb);
- purple_blist_add_buddy(b, NULL, g, NULL);
- /* add our event timer to the buddy */
- sb->timer_id = g_timeout_add(interval, stress_event_cb, sb);
-stress_close(PurpleConnection *pc) {
- for(l = buddies; l; l = l->next) {
- StressBuddy *sb = l->data;
- purple_blist_remove_buddy(sb->buddy);
- g = purple_find_group("prpl-stress");
- purple_blist_remove_group(g);
-stress_buddy_free(PurpleBuddy *buddy) {
- StressBuddy *sb = STRESS_BUDDY(buddy);
- g_source_remove(sb->timer_id);
-stress_status_types(PurpleAccount *account) {
- PurpleStatusType *type = NULL;
- g_return_val_if_fail(account != NULL, NULL);
- purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, NULL,
- NULL, TRUE, TRUE, FALSE,
- "message", _("Message"),
- purple_value_new(PURPLE_TYPE_STRING),
- types = g_list_prepend(types, type);
- purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE, NULL,
- NULL, TRUE, TRUE, FALSE,
- "message", _("Message"),
- purple_value_new(PURPLE_TYPE_STRING),
- types = g_list_prepend(types, type);
- purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, NULL,
- NULL, TRUE, TRUE, FALSE,
- "message", _("Message"),
- purple_value_new(PURPLE_TYPE_STRING),
- types = g_list_prepend(types, type);
-static PurplePluginProtocolInfo prpl_info = {
- NULL, /* stress_send_im, */
- NULL, /* stress_add_buddies, */
- NULL, /* stress_remove_buddies, */
-/******************************************************************************
- *****************************************************************************/
-plugin_load(PurplePlugin *plugin) {
-plugin_unload(PurplePlugin *plugin) {
-stress_actions(PurplePlugin *plugin, gpointer context) {
- PurplePluginAction *act = NULL;
- action = purple_plugin_action_new(_("Start"));
- menu = g_list_append(menu, action);
-static PurplePluginInfo info = {
- PURPLE_PLUGIN_PROTOCOL,
- PURPLE_PRIORITY_DEFAULT,
- "core-plugin_pack-stress",
- "Gary Kramlich <grim@reaperworld.com>",
-#define add_option(type, label, name, def) G_STMT_START { \
- option = purple_account_option_##type##_new((label), (name), (def)); \
- prpl_info.protocol_options = g_list_prepend(prpl_info.protocol_options, (option)); \
-init_plugin(PurplePlugin *plugin) {
- PurpleAccountOption *option = NULL;
- bindtextdomain(GETTEXT_PACKAGE, PP_LOCALEDIR);
- bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
- /* seed the randome number generator */
- info.name = _("Stress");
- info.summary = _("A PRPL to stress libpurple");
- info.description = info.summary;
- add_option(int, _("Buddies to stress with"), "nbuddies", 50);
- add_option(int, _("Event interval, in milliseconds"), "interval", 500);
- add_option(int, _("Max events per buddy"), "maxevents", 100);
- add_option(bool, _("Trigger signoff/signoff"), "trigger_signon", TRUE);
- add_option(bool, _("Trigger idle/unidle"), "trigger_idle", TRUE);
- add_option(bool, _("Trigger away/back"), "trigger_away", TRUE);
- add_option(bool, _("Trigger typing/stopped typing"), "trigger_typing", TRUE);
- add_option(bool, _("Send messages"), "send_messages", TRUE);
- add_option(int, _("Minimum message length"), "message_min", 16);
- add_option(int, _("Maxium message length"), "message_max", 128);
- prpl_info.protocol_options = g_list_reverse(prpl_info.protocol_options);
-PURPLE_INIT_PLUGIN(stress, init_plugin, info)