rendered paste bodystatic void
do_fetch(gchar *message)
{ // Code below is pretty much not finished. the commented code would be best (but non working) way
char *url = g_strdup_printf("http://translate.google.com/translate_t?langpair=en|fr&hl=en&ie=UTF8&text=%s",
purple_url_encode(message));
purple_debug_info("ARGS", "%s\n",purple_url_encode(purple_prefs_get_string("/plugins/core/trivia/url")));
purple_debug_info("ARGS", "%s\n",url);
purple_debug_info("ARGS", "%s\n",args[0]);
purple_util_fetch_url(url, TRUE, NULL, FALSE, fetch_page, NULL);
}
static PurpleCmdRet
fr_it(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar *error, void *data)
{
gchar *msg;
do_fetch(args[0]);
msg = g_strdup_printf("%s",it);
if(conv->type == PURPLE_CONV_TYPE_IM)
purple_conv_im_send(PURPLE_CONV_IM(conv), msg);
else if(conv->type == PURPLE_CONV_TYPE_CHAT)
purple_conv_chat_send(PURPLE_CONV_CHAT(conv), msg);
g_free(msg);
return PURPLE_CMD_RET_OK;
}