Mercurial > pidgin
comparison plugins/PERL-HOWTO @ 750:c4c4a18bb2f9
[gaim-migrate @ 760]
don't get too excited, perl doesn't do many useful things yet
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Wed, 23 Aug 2000 20:37:16 +0000 |
| parents | |
| children | dc9ad68fc30e |
comparison
equal
deleted
inserted
replaced
| 749:94edd99b7302 | 750:c4c4a18bb2f9 |
|---|---|
| 1 This is really the wrong place for a HOWTO on writing perl scripts for gaim, | |
| 2 but there didn't seem to be a much better place. | |
| 3 | |
| 4 If you've ever written a perl script for X-Chat then you've basically written | |
| 5 one for gaim as well. perl.c in gaim's source is basically an exact copy of | |
| 6 X-Chat's perl.c file, with small modifications to suit AIM rather than IRC. | |
| 7 | |
| 8 Basically the reason for including perl is based on the experience with the | |
| 9 plugins. X-Chat's docs on Perl Scripting sums it up nicely: | |
| 10 it's not quite as simple to stick a module together in C and make it | |
| 11 stable compared to the development time of perl code | |
| 12 | |
| 13 Plugins are more powerful as they can directly access gaim's functions and | |
| 14 variables; as such they should be used for things like modifying the UI or | |
| 15 when something takes quite a bit of trickery not offered by perl. But for | |
| 16 the most part things should be written in Perl. It's more stable than | |
| 17 plugins. | |
| 18 | |
| 19 Right now, the only way to test that your script is working correctly is to | |
| 20 load the perl plugin and load the script through that. Though, right now | |
| 21 there really isn't much point in writing a script, since the two major | |
| 22 functions in the AIM module (message_handler and command_handler) haven't | |
| 23 been implemented yet. | |
| 24 | |
| 25 Everything available in normal perl scripts should be available in gaim's | |
| 26 perl interface, so I'm not going to bother describing that. The important | |
| 27 things are the functions provided by gaim's internal AIM module, which is | |
| 28 what most of this document is about. So, onto the functions. | |
| 29 | |
| 30 AIM::register(name, version, shutdownroutine, unused) | |
| 31 Just like X-Chat. This is the first function your script should call. | |
| 32 shutdownroutine is a function that will be called when the script | |
| 33 gets unloaded (like when gaim gets closed). This function returns | |
| 34 gaim's version number. | |
| 35 | |
| 36 AIM::get_info(integer) | |
| 37 This function returns different information based on the integer passed | |
| 38 to it. | |
| 39 0 - the version of gaim you're running ("0.10.0" for example). | |
| 40 1 - the screenname to last attempt to sign on | |
| 41 2 - either "Offline", "TOC", or "Oscar" | |
| 42 | |
| 43 AIM::print(title, message) | |
| 44 This displays a nice little dialog window. | |
| 45 | |
| 46 | |
| 47 AIM::buddy_list() | |
| 48 This returns the buddy list (no groups, just the names of the buddies) | |
| 49 | |
| 50 AIM::online_list() | |
| 51 This returns the list of online buddies. | |
| 52 | |
| 53 AIM::deny_list() | |
| 54 This returns the deny list. This is probably going to be modified before | |
| 55 0.10.0 is released to return either the deny or the permit list and the | |
| 56 current mode. | |
| 57 | |
| 58 | |
| 59 AIM::command(command, ...) | |
| 60 This sends commands to the server, and each command takes various | |
| 61 arguments. The command should be self-explanatory: | |
| 62 "signon" - no args. | |
| 63 "signoff" - no args. | |
| 64 "away" - the second arg is the away message | |
| 65 "back" - no args. | |
| 66 "idle" - the second arg is how long (in seconds) to set the idle time | |
| 67 "warn" - the second arg is the name of the person to warn | |
| 68 | |
| 69 AIM::user_info(nick) | |
| 70 Returns 7 data items: | |
| 71 the screenname of the buddy | |
| 72 "Online" or "Offline" | |
| 73 their warning level | |
| 74 signon time, in seconds since the epoch | |
| 75 idle time, in seconds (?) | |
| 76 user class, an integer with bit values | |
| 77 AOL 1 | |
| 78 ADMIN 2 | |
| 79 UNCONFIRMED 4 | |
| 80 NORMAL 8 | |
| 81 AWAY 16 | |
| 82 their capabilites, an integer with bit values | |
| 83 BUDDYICON 1 | |
| 84 VOICE 2 | |
| 85 IMIMAGE 4 | |
| 86 CHAT 8 | |
| 87 GETFILE 16 | |
| 88 SENDFILE 32 | |
| 89 | |
| 90 This is probably going to change before 0.10.0 is released to | |
| 91 also return the alias of the buddy. | |
| 92 | |
| 93 AIM::print_to_conv(who, what) | |
| 94 This should be obvious. If you can't figure this out on your own, you | |
| 95 shouldn't be using a computer. | |
| 96 | |
| 97 AIM::print_to_chat(room, what) | |
| 98 This should be just as obvious as the last command. | |
| 99 | |
| 100 AIM::add_message_handler | |
| 101 This actually hasn't been implemented yet, so don't worry about it | |
| 102 | |
| 103 AIM::add_command_handler | |
| 104 This hasn't been implemented yet either. Pay no attention. | |
| 105 | |
| 106 AIM::add_timeout_handler(integer, function) | |
| 107 This calls function after integer number of seconds. It only calls function | |
| 108 once, so if you want to keep calling function, keep reading the handler. |
