in reply to Gaim to read from a file using Perl?

Here's a plugin that will do it for you. Put it in the plugins directory for Gaim, restart Gaim, and then load it via Preferences -> Plugins. When talking to someone, if you send a message in the format of /send /path/to/file the contents of /path/to/file will be sent to them. If you wanted, you could also make the contents display in the IM window for you, but I'll leave that as an exercise to try out yourself.

This plugin uses the new Gaim Perl API, so make sure you have a pretty recent copy (I tested it on 0.74). Be aware that there are message size limits in AIM (and most other protocols) that this plugin does not take into account; you may get "Unable to send message" dialogs if the file contents are too big. If the file doesn't exist, this plugin leaves the message untouched (i.e. the user you're sending it to will see exactly what you typed).

Finally, to learn more about Gaim plugins, check out the examples in the source tree (downloadable from the website) and the API doc (online version is slightly outdated).

#!/usr/bin/perl use strict; use warnings; use Gaim; my $plugin; our %PLUGIN_INFO = ( perl_api_version => 2, name => "Send File", version => "0.1", summary => "Sends a file to a person in an IM.", description => "Sends a file to a person in an IM.\n\nJust se +nd an IM to someone like: /send /some/filename", author => "Thomas Sibley", url => "http://trs.perlmonk.org/", load => "plugin_load", unload => "plugin_unload", ); sub plugin_init { return %PLUGIN_INFO; } sub plugin_load { $plugin = shift; # Set signal handlers # # This handler is called before the message is actually sent to th +e # receiver, but after the user has entered a message to send # Gaim::signal_connect(Gaim::Conversations::handle, "sending-im-msg" +, $plugin, \&message_handler, 0); return 1; } sub plugin_unload { return 1; } sub message_handler { # $_[2] is the message... modify it to change the message # strip HTML off very crudely $_[2] =~ s|</?[^>]+>||g; if ($_[2] =~ m|^/send (.+)|) { if (open FH, '<', $1) { $_[2] = ""; # reset message text $_[2] .= $_ while <FH>; close FH; } } }