XTB
XTB stands for XMPP-Twitter-Bridge and connects Jabber and Twitter. It’s written in Java.
Contents
Install
If you want to install XTB you need to do the following steps:
- Create a directory, or choose an existing one, lets call it
$DIR
- Download the latest version of XTB from github
- Create another directory
$DIR/lib
and download the following libraries and extract them to$DIR/lib
: $DIR/lib
should now contain the following files:- smack.jar
- smackx-debug.jar
- smackx.jar
- smackx-jingle.jar
- twitter4j-2.2.5.zip
- twitter4j-core-2.2.5.jar
- jsoup-1.6.1.jar
You also have to setup an additional Jabber account, let’s call it $jabberbot
. You might want to add this new account to the roaster of your Jabber account.
And of course you need to have a twitter account ;-)
That is it. You are now able to run XTB:
cd $DIR
java -jar xtb-*.jar
At the first launch you are asked some questions about your accounts.
which jabber server should i connect to?
>> JABBER SERVER YOUR $jabberbot SHOULD CONNECT TO
jabber login?
>> LOGIN OF YOUR $jabberbot
jabber password?
>> PASSWORD OF YOUR $jabberbot
jabber contact to speak to?
>> YOUR JABBER ACCOUNT, ONLY THIS ACCOUNT WILL BE ABLE TO UPDATE TWITTER
please authorize the app:
http://api.twitter.com/oauth/authorize?oauth_token=SOMETOKEN
paste the verification code:
>> OPEN THE URL AND COPY THE NUMBERS
This information will be stored in $DIR/conf
, so you don’t need to provide it at every restart.
You can change the location of the config file with
java -jar xtb-*.jar -c CONFIGFILE
If you want to change your credentials just delete this file and restart XTB, you are free to pass --clearconf
as argument and XTB will delete this file for you.
To enable debugging mode call XTB with the -v
option.
An overview about available arguments is presented with -h
:
usr@srv % java -jar xtb-*.jar -h
XTB Usage:
-l, --log FILE log messages to FILE
-c, --config FILE read config from FILE, defaults to ./conf
--clearconf delete config and create a new one
-h, --help print this help
-v enable debugging
For more information visit /software/xtb/
How it works
Twitter -> Jabber
At each start the Jabber bot will send its Jabber contact the message "back!"
and some recent updates from your Twitter stream. If this is done, XTB checks every 60s for news from Twitter and will send them immediately, so you’ll stay informed ;-)
Twitter updates will be sent in the following format:
TWEETID via /SOURCE/ at TIME
*USER*: MESSAGE
The TWEETID
can be used to retweed this entry. SOURCE
is something like web
or TweetDeck
or binfalse-tools
. If you don’t like the format, feel free to contact me, maybe I’ll install different formats.
I think it’s a bad behavior, that Twitter shortens URL’s to t.co/SMTH
. You have no chance to know where you’ll end up, so XTB tries to unshort these URL’s and to give you a taste of what to expect. You’ll hopefully see no t.co
links ;-)
Jabber -> Twitter
You are also able to interact with Twitter through XTB. You can send several commands via Jabber to the bot and it will process it. All available commands start with an exclamation mark ( !
) and will be listed if you send !help
:
following commands are available:
!help -> show this message
!follow [USER] -> follow USER
!unfollow [USER] -> unfollow USER
!profile [USER] -> display profile information of USER
!latest [USER] -> display latest statuses of USER
!following -> display list of people you are following
!followers -> display list of your followers
!rt [ID] -> retweet message with id ID
!location [LAT,LONG] -> set location for next tweet(s), without data geolocation will be disabled
So if you send !follow binfalse
you’ll follow me on twitter. The latest tweets from my time line are shown with !latest binfalse
.
If you want twitter to believe you’re playing golf in in Kuala Lumpur send !location 3.036383,101.717248
to the bot. To delete the location just send !location
without an argument.
Every message not starting with an exclamation mark is supposed to be an update and will be posted to Twitter and hopefully appear in your stream ;-)
Development
This is an open source project, licensed under GPL. The sources of XTB are available at github. The API is documented with JavaDoc.
Leave a comment
There are multiple options to leave a comment:
- send me an email
- submit a comment through the feedback page (anonymously via TOR)
- Fork this repo at GitHub, add your comment to the _data/comments directory and send me a pull request
- Fill the following form and Staticman will automagically create a pull request for you:
1 comment
[…] can find the new XMPP to Twitter bridge with the name XTB in my sidebar. It’s now written in nice Java code, easy to understand and much easier to work […]