org.guifications.plugins: 8c889fd47ab1d8c93e5cb1480afe211e6285a546
grim at guifications.org
grim at guifications.org
Sun Dec 2 17:50:05 CST 2007
-----------------------------------------------------------------
Revision: 8c889fd47ab1d8c93e5cb1480afe211e6285a546
Ancestor: 49dad1dc1c6b205e86e7dd4ce9d496324b6d51c0
Author: grim at guifications.org
Date: 2007-12-02T23:48:42
Branch: org.guifications.plugins
Modified files:
dice/dice.c
ChangeLog:
Chained /dice to /me, so we get a '/me rolled 2 6-sided dice: 2 4' instead of just sending 'Rolls 2 6-sided dice 1 5'
-----------------------------------------------------------------
This revision's diffstat output:
dice.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
-------------- next part --------------
============================================================
--- dice/dice.c 507109bb51c7e1e79bdd1a8dfdfdd1f86a8a987b
+++ dice/dice.c 9eb38fd4d9131f16a90422e84e43617d225c85ae
@@ -53,7 +53,7 @@ old_school_roll(gint dice, gint sides) {
BOUNDS_CHECK(dice, 1, 2, 15, 15);
BOUNDS_CHECK(sides, 2, 2, 999, 999);
- g_string_append_printf(str, "Rolls %d %d-sided %s:",
+ g_string_append_printf(str, "%d %d-sided %s:",
dice, sides,
(dice == 1) ? "die" : "dice");
@@ -218,7 +218,8 @@ roll(PurpleConversation *conv, const gch
roll(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar *error,
void *data)
{
- gchar *str = NULL;
+ PurpleCmdStatus ret;
+ gchar *str = NULL, *newcmd = NULL;
if(!args[0]) {
str = old_school_roll(DEFAULT_DICE, DEFAULT_SIDES);
@@ -291,14 +292,14 @@ roll(PurpleConversation *conv, const gch
}
#endif
- if(conv->type == PURPLE_CONV_TYPE_IM)
- purple_conv_im_send(PURPLE_CONV_IM(conv), str);
- else if(conv->type == PURPLE_CONV_TYPE_CHAT)
- purple_conv_chat_send(PURPLE_CONV_CHAT(conv), str);
+ newcmd = g_strdup_printf("me rolls %s", str);
+ ret = purple_cmd_do_command(conv, newcmd, newcmd, &error);
+
g_free(str);
+ g_free(newcmd);
- return PURPLE_CMD_RET_OK;
+ return ret;
}
static gboolean
More information about the Plugins-commits
mailing list