Ejemplo n.º 1
0
static int gaym_im_send(GaimConnection * gc, const char *who,
                        const char *what, GaimConvImFlags flags)
{
    struct gaym_conn *gaym = gc->proto_data;
    const char *args[2];
    char *automsg = NULL;
    char *stripped_msg = NULL;
    if (strchr(status_chars, *who) != NULL) {
        args[0] = who + 1;
    } else {
        args[0] = who;
    }
    if (flags & GAIM_CONV_IM_AUTO_RESP) {
        stripped_msg = gaim_markup_strip_html(what);
        automsg = g_strdup_printf("<AUTO-REPLY> %s", stripped_msg);
        g_free(stripped_msg);
        args[1] = automsg;

    } else {
        args[1] = what;
    }
    gaym_cmd_privmsg(gaym, "msg", NULL, args);
    if (automsg) {
        g_free(automsg);
    }
    return 1;
}
Ejemplo n.º 2
0
Archivo: chat.c Proyecto: VoxOx/VoxOx
/* merge this with the function below when we get everyone on the same page wrt /commands */
void jabber_chat_change_topic(JabberChat *chat, const char *topic)
{
	if(topic && *topic) {
		JabberMessage *jm;
		jm = g_new0(JabberMessage, 1);
		jm->js = chat->js;
		jm->type = JABBER_MESSAGE_GROUPCHAT;
		jm->subject = gaim_markup_strip_html(topic);
		jm->to = g_strdup_printf("%s@%s", chat->room, chat->server);
		jabber_message_send(jm);
		jabber_message_free(jm);
	} else {
		const char *cur = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(chat->conv));
		char *buf, *tmp, *tmp2;

		if(cur) {
			tmp = g_markup_escape_text(cur, -1);
			tmp2 = gaim_markup_linkify(tmp);
			buf = g_strdup_printf(_("current topic is: %s"), tmp2);
			g_free(tmp);
			g_free(tmp2);
		} else
			buf = g_strdup(_("No topic is set"));
		gaim_conv_chat_write(GAIM_CONV_CHAT(chat->conv), "", buf,
				GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_NO_LOG, time(NULL));
		g_free(buf);
	}

}
Ejemplo n.º 3
0
/* send IM to a group */
void qq_send_packet_group_im(GaimConnection *gc, qq_group *group, const gchar *msg)
{
	gint data_len, bytes;
	guint8 *raw_data, *cursor, *send_im_tail;
	guint16 msg_len;
	gchar *msg_filtered;

	g_return_if_fail(group != NULL && msg != NULL);

	msg_filtered = gaim_markup_strip_html(msg);
	msg_len = strlen(msg_filtered);
	data_len = 7 + msg_len + QQ_SEND_IM_AFTER_MSG_LEN;
	raw_data = g_newa(guint8, data_len);
	cursor = raw_data;

	bytes = 0;
	bytes += create_packet_b(raw_data, &cursor, QQ_GROUP_CMD_SEND_MSG);
	bytes += create_packet_dw(raw_data, &cursor, group->internal_group_id);
	bytes += create_packet_w(raw_data, &cursor, msg_len + QQ_SEND_IM_AFTER_MSG_LEN);
	bytes += create_packet_data(raw_data, &cursor, (guint8 *) msg_filtered, msg_len);
	send_im_tail = qq_get_send_im_tail(NULL, NULL, NULL,
						   FALSE, FALSE, FALSE,
						   QQ_SEND_IM_AFTER_MSG_LEN);
	bytes += create_packet_data(raw_data, &cursor, send_im_tail, QQ_SEND_IM_AFTER_MSG_LEN);
	g_free(send_im_tail);
	g_free(msg_filtered);

	if (bytes == data_len)	/* create OK */
		qq_send_group_cmd(gc, group, raw_data, data_len);
	else
		gaim_debug(GAIM_DEBUG_ERROR, "QQ",
			   "Fail creating group_im packet, expect %d bytes, build %d bytes\n", data_len, bytes);
}