Mercurial > pidgin
view plugins/gaiminc.c @ 3752:b32474e522fa
[gaim-migrate @ 3890]
From: "William T. Mahan" <wtm2@duke.edu>
This patch, against CVS HEAD, fixes three bugs in Oscar File Transfer
support. I can split it up further if desired.
* Send a null checksum when initiating a file transfer, which fixes
"files don't match" warnings produced by some versions of WinAIM; add
a compile-time option to actually compute the checksum, which is
slow but necessary when sending to some Mac clients.
* Don't allow sending files to oneself, because it causes all kinds of
subtle problems and it's not useful.
* Don't crash when there is an error writing to the output file when
receiving.
From: "William T. Mahan" <wtm2@duke.edu>
This patch 2 of 3, which applies on top of the first, adds support for
reverse connections for Oscar File Transfer, the lack of which has
been the biggest complaint so far. Reverse connections are used by
newer AIM clients when there is difficulty verifying the IP of the
sender.
From: "William T. Mahan" <wtm2@duke.edu>
This patch 3 of 3, which applies on top of the first 2, removes the
alarm() and sigaction() calls that were added by my original FT patch
to detect transfer timeouts. Besides apparently not working on
Windows, they involved a lot of ugly code to handle a special case.
My new approach is to add destructors that can called when SNACs are
freed; a timeout is detected when a request SNAC is cleaned up before
the transfer is accepted. Although this touches several files, it is
more generic than the old method. I tried to implement this in an
unintrusive manner, so that there is little preformance penalty for
SNACs that do not use destructors.
My first two patches should work fine without this. If there are any
objections to the third patch, I ask that the first two patches be
applied, in which case I will set up a SourceForge page for this one.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sat, 19 Oct 2002 05:22:30 +0000 |
parents | cd938f18f3f8 |
children | fefad67de2c7 |
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; } struct gaim_plugin_description desc; struct gaim_plugin_description *gaim_plugin_desc() { desc.api_version = PLUGIN_API_VERSION; desc.name = g_strdup("Demonstration"); desc.version = g_strdup(VERSION); desc.description = g_strdup( "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";); desc.authors = g_strdup("Eric Warmehoven <eric@warmenhoven.org>"); desc.url = g_strdup(WEBSITE); return &desc; } 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"; }