Esempio n. 1
0
void PurpleLine::register_commands() {
    purple_cmd_register(
        "sticker",
        "w",
        PURPLE_CMD_P_PRPL,
        (PurpleCmdFlag)(PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT),
        LINE_PRPL_ID,
        WRAPPER(PurpleLine::cmd_sticker),
        "Sends a sticker. The argument should be of the format VER/PKGID/ID.",
        nullptr);

    purple_cmd_register(
        "history",
        "w",
        PURPLE_CMD_P_PRPL,
        (PurpleCmdFlag)
            (PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS),
        LINE_PRPL_ID,
        WRAPPER(PurpleLine::cmd_history),
        "Shows more chat history. Optional argument specifies number of messages to show.",
        nullptr);

    purple_cmd_register(
        "open",
        "w",
        PURPLE_CMD_P_PRPL,
        (PurpleCmdFlag)(PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT),
        LINE_PRPL_ID,
        WRAPPER(PurpleLine::cmd_open),
        "Opens an attachment (image, audio) by number.",
        nullptr);
}
Esempio n. 2
0
static void
campfire_login(PurpleAccount * account)
{
	/*don't really login (it's stateless), but init the CampfireConn */
	PurpleConnection *gc = purple_account_get_connection(account);
	const char *username = purple_account_get_username(account);
	CampfireConn *conn;
	char *pos;
	PurpleCmdFlag f = PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY;
	gchar *prpl_id = "prpl-analog_g-campfire";	/* analog_g = developer.pidgin.im Trac username */

	conn = g_new0(CampfireConn, 1);
	purple_debug_info("campfire", "num_xaction_malloc:%d: num_xaction_free:%d\n",
	                  conn->num_xaction_malloc,
	                  conn->num_xaction_free);
	conn->gc = gc;
	conn->account = account;

        /* Find the last '@'; usernames can have '@' in them. */
	pos = strrchr(username, '@');
	conn->hostname = g_strdup(pos+1);
	pos[0] = 0;
	purple_connection_set_display_name(gc, username);
	pos[0] = '@';

	purple_debug_info("campfire", "username: %s\n", username);
	purple_debug_info("campfire", "hostname: %s\n", conn->hostname);

	gc->proto_data = conn;

	/*register campfire commands */
	purple_cmd_register(CAMPFIRE_CMD_ME, "s", PURPLE_CMD_P_PRPL, f, prpl_id,
			    campfire_parse_cmd,
			    "me <action to perform>:  Perform an action.",
			    conn);
	purple_cmd_register(CAMPFIRE_CMD_TOPIC, "s", PURPLE_CMD_P_PRPL,
			    f | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, prpl_id,
			    campfire_parse_cmd,
			    "topic <new topic>:  Change the room topic.",
			    conn);
	purple_cmd_register(CAMPFIRE_CMD_ROOM, "s", PURPLE_CMD_P_PRPL, f,
			    prpl_id, campfire_parse_cmd,
			    "room <new room name>:  Change the room name (admin only).",
			    conn);
	purple_cmd_register(CAMPFIRE_CMD_PLAY, "w", PURPLE_CMD_P_PRPL, f,
			    prpl_id, campfire_parse_cmd,
			    "play <sound>:  Play a sound (trombone, rimshot, crickets, live).",
			    conn);

	purple_connection_set_state(gc, PURPLE_CONNECTED);
}
Esempio n. 3
0
/*******************************************************************************
 * Plugin stuff
 ******************************************************************************/
static gboolean
plonkers_load(PurplePlugin *plugin) {
	const gchar *help = _("<pre>plonkers;\nTell people in a chat what you "
			"really think of them\n</pre>");

	/* register our command */
	plonkers_cmd = purple_cmd_register("plonkers", "", PURPLE_CMD_P_PLUGIN,
								PURPLE_CMD_FLAG_CHAT, NULL,
								plonkers_cmd_cb, help, NULL);
	plonk_cmd = purple_cmd_register("plonk", "s", PURPLE_CMD_P_PLUGIN,
								PURPLE_CMD_FLAG_CHAT|PURPLE_CMD_FLAG_IM, NULL,
								plonk_cmd_cb, help, NULL);

	return TRUE;
}
Esempio n. 4
0
static void irc_register_command(struct _irc_user_cmd *c)
{
	PurpleCmdFlag f;
	char args[10];
	char *format;
	size_t i;

	f = PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY
	    | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS;

	format = c->format;

	for (i = 0; (i < (sizeof(args) - 1)) && *format; i++, format++)
		switch (*format) {
		case 'v':
		case 'n':
		case 'c':
		case 't':
			args[i] = 'w';
			break;
		case ':':
		case '*':
			args[i] = 's';
			break;
		}

	args[i] = '\0';

	purple_cmd_register(c->name, args, PURPLE_CMD_P_PRPL, f, "prpl-irc",
	                  irc_parse_purple_cmd, _(c->help), NULL);
}
Esempio n. 5
0
PurpleCmdId
purple_perl_cmd_register(PurplePlugin *plugin, const gchar *command,
                       const gchar *args, PurpleCmdPriority priority,
                       PurpleCmdFlag flag, const gchar *prpl_id, SV *callback,
                       const gchar *helpstr, SV *data)
{
	PurplePerlCmdHandler *handler;

	handler          = g_new0(PurplePerlCmdHandler, 1);
	handler->plugin  = plugin;
	handler->cmd     = g_strdup(command);
	handler->prpl_id = g_strdup(prpl_id);

	if (callback != NULL && callback != &PL_sv_undef)
		handler->callback = newSVsv(callback);
	else
		handler->callback = NULL;

	if (data != NULL && data != &PL_sv_undef)
		handler->data = newSVsv(data);
	else
		handler->data = NULL;

	cmd_handlers = g_slist_append(cmd_handlers, handler);

	handler->id = purple_cmd_register(command, args, priority, flag, prpl_id,
	                                PURPLE_CMD_FUNC(perl_cmd_cb), helpstr,
	                                handler);

	return handler->id;
}
Esempio n. 6
0
static void nullprpl_init(PurplePlugin *plugin)
{
  /* see accountopt.h for information about user splits and protocol options */
  PurpleAccountUserSplit *split = purple_account_user_split_new(
    _("Example user split"),  /* text shown to user */
    "default",                /* default value */
    '@');                     /* field separator */
  PurpleAccountOption *option = purple_account_option_string_new(
    _("Example option"),      /* text shown to user */
    "example",                /* pref name */
    "default");               /* default value */

  purple_debug_info("nullprpl", "starting up\n");

  prpl_info.user_splits = g_list_append(NULL, split);
  prpl_info.protocol_options = g_list_append(NULL, option);

  /* register whisper chat command, /msg */
  purple_cmd_register("msg",
                    "ws",                  /* args: recipient and message */
                    PURPLE_CMD_P_DEFAULT,  /* priority */
                    PURPLE_CMD_FLAG_CHAT,
                    "prpl-null",
                    send_whisper,
                    "msg &lt;username&gt; &lt;message&gt;: send a private message, aka a whisper",
                    NULL);                 /* userdata */

  /* get ready to store offline messages */
  goffline_messages = g_hash_table_new_full(g_str_hash,  /* hash fn */
                                            g_str_equal, /* key comparison fn */
                                            g_free,      /* key free fn */
                                            NULL);       /* value free fn */

  _null_protocol = plugin;
}
Esempio n. 7
0
static gboolean
plugin_load(PurplePlugin *plugin)
{
	PurplePlugin *prpl = NULL;
	PurpleAccountOption *option;
	void *gc_handle = NULL;
#if !PURPLE_VERSION_CHECK(2,4,0)
	gchar *notice_help = NULL;
#endif

	prpl = purple_find_prpl("prpl-irc");

	/* if we didn't find the prpl, bail */
	if (!prpl)
		return FALSE;

#if !PURPLE_VERSION_CHECK(2,4,0)
	/* specify our help string and register our command */
	notice_help = _("notice target message:  Send a notice to the specified target.");

	notice_cmd_id = purple_cmd_register("notice", "ws", PURPLE_CMD_P_PLUGIN,
			PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
			"prpl-irc", notice_cmd_cb, notice_help, NULL);
#endif

	/* we need this handle for the signed-on signal */
	gc_handle = purple_connections_get_handle();

	/* list signals in alphabetical order for consistency */
	purple_signal_connect(prpl, "irc-sending-text", plugin,
				G_CALLBACK(irc_sending_text), NULL);
	purple_signal_connect(prpl, "irc-receiving-text", plugin,
				G_CALLBACK(irc_receiving_text), NULL);
	purple_signal_connect(gc_handle, "signed-on", plugin,
				G_CALLBACK(signed_on_cb), NULL);

	irc_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);

	/* Alphabetize the option label strings */
	option = purple_account_option_string_new(_("Auto-Join Channels"), "autojoin", "");
	irc_info->protocol_options = g_list_append(irc_info->protocol_options, option);

	option = purple_account_option_string_new(_("CTCP Version reply"), "ctcp-message", "Purple IRC");
	irc_info->protocol_options = g_list_append(irc_info->protocol_options, option);

	option = purple_account_option_string_new(_("Default Quit Message"), "quit-message", "Leaving.");
	irc_info->protocol_options = g_list_append(irc_info->protocol_options, option);

	option = purple_account_option_string_new(_("Default Part Message"), "part-message", "Leaving.");
	irc_info->protocol_options = g_list_append(irc_info->protocol_options, option);

	option = purple_account_option_string_new(_("Set User Modes On Connect"), "setumodes", "i");
	irc_info->protocol_options = g_list_append(irc_info->protocol_options, option);

	option = purple_account_option_string_new(_("Unset User Modes On Connect"), "unsetumodes", "");
	irc_info->protocol_options = g_list_append(irc_info->protocol_options, option);
	return TRUE;
}
Esempio n. 8
0
static gboolean
plugin_load(PurplePlugin *plugin)
{
	cmd = purple_cmd_register("lastlog", "s", PURPLE_CMD_P_DEFAULT,
			PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL,
			/* Translators: The "backlog" here refers to the the conversation buffer/history. */
			lastlog_cb, _("lastlog: Searches for a substring in the backlog."), NULL);
	return TRUE;
}
Esempio n. 9
0
static gboolean plugin_load(PurplePlugin *plugin) {
	void *convs_handle;
	convs_handle = purple_conversations_get_handle();

	purple_signal_connect(convs_handle, "conversation-created", plugin, PURPLE_CALLBACK(conversation_created_cb), NULL);

	cmd_order_id = purple_cmd_register("ordertabs", "", PURPLE_CMD_P_DEFAULT, PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, PLUGIN_ID, cmd_reorder_cb, "Order conversation tabs alphabetically", NULL);

	return TRUE;
}
Esempio n. 10
0
static gboolean
plugin_load(PurplePlugin *plugin) {
    cmd_id = purple_cmd_register("all", "s", PURPLE_CMD_P_PLUGIN,
                                    PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT,
                                    NULL, PURPLE_CMD_FUNC(send_to_all),
                                    "Sends message to all open windows",
                                    NULL);

    return TRUE;
}
Esempio n. 11
0
static void yahoo_register_commands(void)
{
	purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL,
	                  PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
	                  PURPLE_CMD_FLAG_PRPL_ONLY,
	                  "prpl-yahoo", yahoopurple_cmd_chat_join,
	                  _("join &lt;room&gt;:  Join a chat room on the Yahoo network"), NULL);
	purple_cmd_register("list", "", PURPLE_CMD_P_PRPL,
	                  PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
	                  PURPLE_CMD_FLAG_PRPL_ONLY,
	                  "prpl-yahoo", yahoopurple_cmd_chat_list,
	                  _("list: List rooms on the Yahoo network"), NULL);
	purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL,
	                  PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
	                  "prpl-yahoo", yahoopurple_cmd_buzz,
	                  _("buzz: Buzz a user to get their attention"), NULL);
	purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL,
	                  PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
	                  "prpl-yahoo", yahoo_doodle_purple_cmd_start,
	                 _("doodle: Request user to start a Doodle session"), NULL);
}
Esempio n. 12
0
/**
 * @brief The implementation function that is called when the plugin is loaded into memory.
 * @arg plugin The libpurple plugin instance.
 * @return A boolean value indicating if the plugin has been successfully loaded.
 */
static gboolean
plugin_load (PurplePlugin * plugin) {
    const char * help = "bitly: replaces the argument URL with one through the bit.ly service";

    curl_global_init(CURL_GLOBAL_ALL);
    bitly_url = g_string_new("");
    curl_handle = curl_easy_init();
    bitly_cmd_id = purple_cmd_register( "bitly", "wws", PURPLE_CMD_P_PLUGIN,
                                        PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
                                        PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
                                        NULL, PURPLE_CMD_FUNC (purple_cmd_bitly), help, NULL );
    return TRUE;
}
Esempio n. 13
0
/******************************************************************************
 * "API"
 *****************************************************************************/
void
irssi_window_init(PurplePlugin *plugin) {
	const gchar *help;

	if(irssi_window_cmd_id != 0 || irssi_win_cmd_id != 0)
		return;
	
	/*
	 * XXX: Translators: DO NOT TRANSLATE the first occurance of the word
	 * "window" below, or "close", "next", "previous", "left", or "right"
	 * at the *beginning* of the lines below!  The options to /window are
	 * NOT going to be translatable.  Also, please don't translate the HTML
	 * tags.
	 */
	help = _("<pre>window &lt;option&gt;: Operations for windows (tabs).  "
			 "Valid options are:\n"
			 "close - closes the current conversation\n"
			 "next - move to the next conversation\n"
			 "previous - move to the previous conversation\n"
			 "left - move one conversation to the left\n"
			 "right - move one conversation to the right\n"
			 "&lt;number&gt; - go to tab <number>\n"
			 "</pre>");

	irssi_window_cmd_id =
		purple_cmd_register("window", "w", PURPLE_CMD_P_PLUGIN,
						  PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT, NULL, 
						  PURPLE_CMD_FUNC(irssi_window_cmd_cb), help, NULL);

	/* same thing as above, except for the /win command */
	help = _("<pre>win: THis command is synonymous with /window.  Try /help "
			 "window for further details.</pre>");

	irssi_win_cmd_id =
		purple_cmd_register("win", "w", PURPLE_CMD_P_PLUGIN, 
						  PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT, NULL,
						  PURPLE_CMD_FUNC(irssi_window_cmd_cb), help, NULL);
}
Esempio n. 14
0
static gboolean
plugin_load(PurplePlugin *plugin)
{
	const gchar *bash_help, *qdb_help;
	PurpleCmdFlag flags = PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
						PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS;

	bash_help = _("bash [n]: sends a link to a bash.org quote.  Specify a"
				" number for n and it will send a link to the quote with the"
				" specified number.");

	qdb_help = _("qdb [n]: sends a link to a qdb.us quote.  Specify a number "
				"for n and it will send a link to the quite with the specified "
				"number.");

	bash = purple_cmd_register("bash", "w", PURPLE_CMD_P_PLUGIN, flags, NULL,
							PURPLE_CMD_FUNC(cmd_func), bash_help, NULL);

	qdb = purple_cmd_register("qdb", "w", PURPLE_CMD_P_PLUGIN, flags, NULL,
							PURPLE_CMD_FUNC(cmd_func), qdb_help, NULL);

	return TRUE;
}
static gboolean plugin_load(PurplePlugin* plg) {
    plugin = plg;

    radio_command = purple_cmd_register("radio",
            "s",
            PURPLE_CMD_P_DEFAULT,
            PURPLE_CMD_FLAG_IM,
            PLUGIN_ID,
            radio_callback,
            "Converts a mesasge to Radio alphabet",
            NULL);

    return TRUE;
}
Esempio n. 16
0
File: simple.c Progetto: ralight/ggz
static gboolean
plugin_load(PurplePlugin *plugin)
{
//	purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin loaded.\n");

	void *conv_handle = purple_conversations_get_handle();
	purple_signal_connect(conv_handle, "conversation-created",
		plugin, PURPLE_CALLBACK(nouvelle_convers), NULL);
        /*purple_signal_connect(conv_handle, "receiving-chat-msg",
		plugin, PURPLE_CALLBACK(message_recu), NULL);*/
        purple_signal_connect(conv_handle, "receiving-im-msg",
		plugin, PURPLE_CALLBACK(message_recu2), NULL);
	purple_cmd_register("jeu", "w", PURPLE_CMD_P_PLUGIN, PURPLE_CMD_FLAG_IM|PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, PURPLE_CMD_FUNC(commande), "jeu nom_du_jeu",NULL);
	return TRUE;
}
Esempio n. 17
0
static gboolean
plugin_load(PurplePlugin *plugin
#if PURPLE_VERSION_CHECK(3, 0, 0)
, GError **error
#endif
)
{
	
#if PURPLE_VERSION_CHECK(3, 0, 0)
	skypeweb_protocol = purple_protocols_add(SKYPEWEB_TYPE_PROTOCOL, error);
	if (!skypeweb_protocol)
		return FALSE;
#endif
	
	
	
	purple_signal_connect(purple_conversations_get_handle(), "conversation-updated", plugin, PURPLE_CALLBACK(skypeweb_mark_conv_seen), NULL);
	
	
	
	//leave
	purple_cmd_register("leave", "", PURPLE_CMD_P_PRPL, PURPLE_CMD_FLAG_CHAT |
						PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
						plugin->info->id, skypeweb_cmd_leave,
						_("leave:  Leave the group chat"), NULL);
	//kick
	purple_cmd_register("kick", "s", PURPLE_CMD_P_PRPL, PURPLE_CMD_FLAG_CHAT |
						PURPLE_CMD_FLAG_PRPL_ONLY,
						plugin->info->id, skypeweb_cmd_kick,
						_("kick &lt;user&gt;:  Kick a user from the group chat."),
						NULL);
	//add
	purple_cmd_register("add", "s", PURPLE_CMD_P_PRPL, PURPLE_CMD_FLAG_CHAT |
						PURPLE_CMD_FLAG_PRPL_ONLY,
						plugin->info->id, skypeweb_cmd_invite,
						_("add &lt;user&gt;:  Add a user to the group chat."),
						NULL);
	//topic
	purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, PURPLE_CMD_FLAG_CHAT |
						PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
						plugin->info->id, skypeweb_cmd_topic,
						_("topic [&lt;new topic&gt;]:  View or change the topic"),
						NULL);
	/*
	//call, as in call person
	//kickban
	purple_cmd_register("kickban", "s", PURPLE_CMD_P_PRPL, PURPLE_CMD_FLAG_CHAT |
						PURPLE_CMD_FLAG_PRPL_ONLY,
						plugin->info->id, skypeweb_cmd_kickban,
						_("kickban &lt;user&gt; [room]:  Kick and ban a user from the room."),
						NULL);
	//setrole
	purple_cmd_register("setrole", "ss", PURPLE_CMD_P_PRPL, PURPLE_CMD_FLAG_CHAT |
						PURPLE_CMD_FLAG_PRPL_ONLY,
						plugin->info->id, skypeweb_cmd_setrole,
						_("setrole &lt;user&gt; &lt;MASTER | USER | ADMIN&gt;:  Change the role of a user."),
						NULL);
	*/
	
	purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, PURPLE_CMD_FLAG_CHAT |
						PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_IM,
						plugin->info->id, skypeweb_cmd_list,
						_("list: Display a list of multi-chat group chats you are in."),
						NULL);
	
	purple_signal_connect(purple_get_core(), "uri-handler", plugin, PURPLE_CALLBACK(skypeweb_uri_handler), NULL);
	
	return TRUE;
}