/tircd

mirror of google code project for tircd - An ircd proxy to the twitter API.

Primary LanguagePerl

NAME

tircd - An ircd proxy to the twitter API

DESCRIPTION

tircd presents twitter as an irc channel. You can connect to tircd with any irc client, and twitter as if you were on irc

INSTALLATION

tircd requires a recent version of perl, and the following modules:

POE

POE::Filter::IRCD

Net::Twitter::Lite

JSON::Any

Time::Local

File::Glob

IO::File

LWP::UserAgent

Storable

URI

List::Util

HTML::Entities

Digest::SHA1

You can install them all by running:

cpan -i POE POE::Filter::IRCD Net::Twitter::Lite JSON::Any Time::Local File::Glob IO::File LWP::UserAgent Storable URI List::Util HTML::Entities Digest::SHA1

USAGE

Running tircd

./tircd.pl [/path/to/tircd.cfg]

When started, tircd will look for a configuration file in the following places:

tircd.cfg (in the current directory)

~/.tircd

/etc/tircd.cfg

You can specify an alternate path to the configuration file on the commandline if you want to keep the configuration in another location. There is an example config provided as part of the distribution. The easiest way to get started is to just rename that file from tircd.cfg.example to tircd.cfg

Connecting

By default, tircd listens on localhost port 6667.

Connect to tircd, using your twitter username as your NICK. Optionally, send a password with the PASS command.

With many irc clients you can do this by issuing the command /SERVER <server> 6667 <your password> <your twitter username>. Check your client's documentation for the appropirate syntax.

If this is your first connection tircd needs to be authorized to connect to twitter. This is done using OAuth. Tircd will make a challenege to twitter, and twitter will provide a link to tircd for you to authorize the connection. Follow the link, make sure you are logged into twitter as the user you wish to use tircd as, and then click Allow to allow the connection. Twitter will then present you with a PIN number. To complete your connection to tircd, type: /STATS pin <PIN NUMBER>. On some clients that honor the irc protocol and do not expect you to be sending a stats command before connecting you may have to type: /QUOTE STATS pin <PIN NUMBER>. Tircd will then attempt to authorize the connection using the provided PIN.

Connecting with password

If your tircd installation is running in a shared environment (either listening on the localhost address on a shared computer, or listening on a public IP) you might want to password protect your account, or anyone can access your twitter account knowing the server address and your twitter username. Your tircd-password do NOT need to be (and should not be!) the same as your twitter password.

Tircd supports password protection in the following way.

  • The first time you connect to tircd with a new Username, no password checking is done. You are presented with the OAuth URL, and need to log in to twitter on the web, and enter the PIN as described above.

  • When the PIN is accepted, IF your client connected with a password set, this password is encrypted (hashed) and saved along with your twitter access-tokens.

  • Next time you connect, tircd will first check to see if a password is saved in your Username.config, and comapre it with the one your client sends.

  • If they match, your connecton is allowed, and tircd continue to verify the OAuth tokens with twitter.

  • If they don't match, the client is disconnected with an error message.

  • If you want to change your password, or did not set one on your first connection, you can do so after you have connected to tircd with a simple /STATS password <password>

  • Be aware that if you do this, you will also have to make sure your client uses the same password next time you connect to tircd.

  • If you want to remove the password, simply issue a /STATS password without any password set.

There is currently no way of regaining access to your account if you forget it. To reset your tircd password, you will have to remove your Username.config and authorize with twitter using OAuth and a PIN again.

After connecting

Once connected /JOIN #twitter to get started. The channel #twitter is where you will perform most opertions

Updating your status

To update your status on twitter, simply send a message starting with "!t " to the #twitter channel. The server will keep your most recent update in the topic at all times. If you want to auto send everything you type in the #twitter channel, you can set the config option "auto_post" to 1. Either in tircd.conf or via the /STATS command

Getting your friend's status

When users you follow update their status, it will be sent to the channel as a message from them.

@replies are also sent to the channel as messages.

Listing the users you follow

Each user you follow will be in the #twitter channel. If you follow a new user outside of tircd, that user will join the channel the first time they update their status. People who follow you back are given voice (+v) to indicate that fact.

Direct Messages

Direct messages to you will show up as a private message from the user.

To send a direct message, simply send a private message to the user you want to dm.

Getting additional information on users

You can /WHO or /WHOIS a user to view their Location / Bio / Website. Their last status update (and time sent) will also be returned.

Issuing a /WHOIS on your own user name will also provide the number of API calls that have been used in the last hour.

Following new users

To begin following a new user, simply /INVITE them to #twitter. The user will join the channel if the request to follow was successful. If you attempt to invite a user who protects their updates, you will receive a notice that you have requested to follow them. The user will join the channel if they accept your request and update their status.

Unfollowing / removing users

To stop following a user, /KICK them from #twitter.

Blocking users

To block a user /BAN them. There is currently no way to get a list of users you've currently blocked via the API, so listing the bans in #twitter will only return users you've blocked in the current session.

Unblocking users

To unblock a user /UNBAN them.

Multiple Channels / Groups

If you want to create a channel with just a subset of the people you follow, you can /JOIN <any channel> and then /INVITE them to the channel. tircd will send a user's updates to #twitter and any other channels you have invited a user to.

If you want to have updated search results for a specific term delivered, you can /JOIN <any channel> then set the /topic for the channnel to your search query. Results that match that query will be sent to that channel. The /TOPIC can be almost anything supported by the twitter search (see http://support.twitter.com/articles/71577-how-to-use-advanced-twitter-search for exmaples). Using the 'near' option is not currently supported.

User config

Certain options are changeable at runtime and set per user. To see a list of options and their current values simply send an /STATS m command to the server.

These options are saved in a file with the name Username.config (where Username is your twitter username) located in a directory set in the global config file (default: /tmp/tricd)

Other commands

tircd supports a few additional "bot-like" commands:

!t[weet] - Post a tweet

![rt|retweet] <id> - Retweet the post with ID <id> (displayed first in your timeline)

![conv|conversation] <id> - Fetch related posts and conversations related to <id>

!u[pdate] - Fetch new messages from twitter (do not wait for next auto update)

!save - Save User.config

AUTHOR

Chris Nelson <cnelson@crazybrain.org> Tim Sogard <tircd@timsogard.com> Ola Thoresen <olen@inni.no>

LICENSE

This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details.

SEE ALSO

POE

POE::Filter::IRCD

Net::Twitter::Lite

JSON::Any

Time::Local

File::Glob

IO::File

LWP::UserAgent

Storable

URI

List::Util

HTML::Entities

Digest::SHA1