view plugins/gaiminc.c @ 3458:66b1ad9782a9

[gaim-migrate @ 3506] From KingAnt: aim.h: -Change the #defines for AIM client info so they're shorter. -Add 2 #defines for ICQ--the first one (the default) is what Gaim has been using, it was taken out of auth.c. The other is what an ICQ 2002a client uses. -Add an CLIENTINFO_ICQ_KNOWNGOOD auth.c: -Have the ICQ login use the given client info, rather than using hard coded values. oscar.c: -Rename "gaim_caps" to "caps_aim" and added a "caps_icq," so AIM and ICQ can have different capabilities. -Make changes to gaim_parse_login so the ICQ sends ICQ client info, and AIM sends AIM client info. -Make changes to conninitdone_bos so only ICQ sets the privacy flag and visibility mask. AIM sets this via SSI. -Change a few calls to aim_bos_setprofile so ICQ does not send a profile TLV, and so ICQ uses the ICQ caps and AIM uses the AIM caps. -Change a call to g_show_info_text so a pointer to the window is not left haning around? -Correctly set the occupied and do not disturb ICQ states. This is how winicq does it. -Correctly show winicq users as NA. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 28 Aug 2002 06:48:14 +0000
parents ece2d1543b20
children cd938f18f3f8
line wrap: on
line source

#define GAIM_PLUGINS

#include <gtk/gtk.h>
#include <time.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include "gaim.h"

void echo_hi(void *m) {
	/* this doesn't do much, just lets you know who we are :) */
	show_about(NULL, NULL);
}

void reverse(struct gaim_connection *gc, char **who, char **message, void *m) {
	/* this will drive you insane. whenever you receive a message,
	 * the text of the message (HTML and all) will be reversed. */
	int i, l;
	char tmp;

	/* this check is necessary in case bad plugins do bad things */
	if (message == NULL || *message == NULL)
		return;

	l = strlen(*message);

	if (!strcmp(*who, gc->username))
		return;

	for (i = 0; i < l/2; i++) {
		tmp = (*message)[i];
		(*message)[i] = (*message)[l - i - 1];
		(*message)[l - i - 1] = tmp;
	}
}

void bud(struct gaim_connection *gc, char *who, void *m) {
	/* whenever someone comes online, it sends them a message. if i
	 * cared more, i'd make it so it popped up on your screen too */
	serv_send_im(gc, who, "Hello!", 0);
}

char *gaim_plugin_init(GModule *handle) {
	/* this is for doing something fun when we sign on */
	gaim_signal_connect(handle, event_signon, echo_hi, NULL);

	/* this is for doing something fun when we get a message */
	gaim_signal_connect(handle, event_im_recv, reverse, NULL);

	/* this is for doing something fun when a buddy comes online */
	gaim_signal_connect(handle, event_buddy_signon, bud, NULL);

	return NULL;
}

char *name() {
	return "Gaim Demonstration Plugin";
}

char *description() {
	return "This is a really cool plugin that does a lot of stuff:\n"
		"- It tells you who wrote the program when you log in\n"
		"- It reverses all incoming text\n"
		"- It sends a message to people on your list immediately"
		" when they sign on";
}