4/3/09

Modified pidgin SMS for added functionality


This is by no means very well written. But its a short easy hack to get IM's sent to you via SMS, that is somewhat dynamic so you can receive them from anyone you have it setup for.

1.) Select buddy to add pounce
2.) Select your bounce options
3.) Select it to execute your script, and after the script path, add the full buddy name (this will be the path to the log that is the variable part)


The only part I don't have very dynamic is this will only work the way its intended if your buddy's are all under the same account, you need to have a different script for each account you use.

pidgin.sms.sh
------------------------------------------------------------------------------------------------------
#/bin/bash
#Written by kylepike
#This script will send you an sms txt alert if you have a buddy pounce setup in pidgn
#The argument you need to pass in is the full "buddy name" in the "New buddy pounce" window


buddyfolder="/home/kyle/.purple/logs/jabber/kyle@k0rupted.domain.net/$1"

cd $buddyfolder

file=`ls -lrt | tail -n 1 | awk '{ print $8}'`
lynx --dump $file | tail -n 1 > ~/scripts/emailmessage.txt
scp ~/scripts/emailmessage.txt kyle@k0rupted.domain.net:~/scripts/emailmessage.txt

ssh kyle@k0rupted.domain.net /home/kyle/scripts/smsme.sh
-------------------------------------------------------------------------------------------------------


smsme.sh on the remote sendmail server, you could incorporate this into one if you have a working sendmail server on your computer/laptop. But like I said in the earlier post, I'm always roaming, and paranoid and I would't want to send my sms out from an unsecure network clear txt.

#!/bin/bash
# script to send simple email
# email subject
sn="SenderName"
SUBJECT="IM FROM $sn"
# Email To ?
EMAIL="123456789@messaging.sprintpcs.com"
# Email text/message
EMAILMESSAGE="/home/kyle/scripts/emailmessage.txt"
#echo "IM Reminder"> $EMAILMESSAGE
#echo "From Blah" >>$EMAILMESSAGE
# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

4/1/09

Pidgin SMS via buddy pounce over ssh

K, so you want to receive an alert that you got an important IM that you were waiting for. Or Dreading ... Also if you wanted to know if someone signed online and where waiting to talk to them, basically any of the buddy pounce rules can trigger the SMS.

Either way, you need to know that you got it and don't want to wait by your computer. Here is a quick and dirty way to get the job done.

For my setup I have a laptop that is often roaming, so using a local sendmail server wasn't really an option. And I have my own server running at home, with a reliable sendmail server, so my best bet was to send the alerts from there. But I also don't want to open the port for the whole world (also my ISP won't allow SMTP port), so I will do this all over ssh. Also because im a paranoid nut job.

What you Need
----------------------
1.) pidgin
2.) linux or have ssh installed via cmd line in windows (ur on your own there)
3.) private key auth to your server
4.) an external server (you could just run this all locally if you can send mail from your desktop/laptop)


On the server create: smsme.sh ... of course you can change these contents to send whatever you would like.

vi smsme.sh
chmod +x smsme.sh
-----------------------------

#!/bin/bash
# script to send simple email
# email subject
SUBJECT="While you were away"
# Email To ?
EMAIL="123456789@messaging.sprintpcs.com" #use your cell email address
# Email text/message
EMAILMESSAGE="/home/scripts/emailmessage.txt"
echo "IM Reminder"> $EMAILMESSAGE
echo "From Person's Name" >>$EMAILMESSAGE
# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE


-----------------------

On your client/laptop/desktop create pidgin.sh

echo "ssh username@hostname /home/username/smsme.sh" > pidgin.sh
chmod +x pidgin.sh

Then in pidgin select your important contact that you don't want to miss their IM, and select your desired options, and then selected "execute a command" and point it to your pidgin.sh


All set, based on your buddy pounce rules, you will receive an SMS alert that you got the IM. I want to figure out a way now to include the contents of that IM.