summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/winpopup/winpopup-send.sh
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/protocols/winpopup/winpopup-send.sh
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/winpopup/winpopup-send.sh')
-rwxr-xr-xkopete/protocols/winpopup/winpopup-send.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/kopete/protocols/winpopup/winpopup-send.sh b/kopete/protocols/winpopup/winpopup-send.sh
new file mode 100755
index 00000000..9a80b20b
--- /dev/null
+++ b/kopete/protocols/winpopup/winpopup-send.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+PATH=/bin:/usr/bin/:/usr/local/bin
+
+# Check input
+[ -z "$1" -o -z "$2" ] && exit 1
+
+# Check if file is indeed a file and readable
+[ ! -f "$1" -o ! -r "$1" ] && exit 1
+
+KOPETE_RUNNING=x`ps -A|grep -e "kopete$"`
+
+if [ "$KOPETE_RUNNING" = "x" ]; then
+
+ if [ -z "$3" ]; then
+ THIS_SERVER=`uname -n`
+ else
+ THIS_SERVER="$3"
+ fi
+
+ if [ "$2" != "$THIS_SERVER" ]; then
+ echo -e "Kopete is currently not running.\nYour message was not delivered!" \
+ | smbclient -N -M $2
+ fi
+
+else
+
+ # Create a unique filename
+ filename="/var/lib/winpopup/`date +%s_%N`"
+
+ # the time...
+ TIME=`date --iso-8601=seconds`
+
+ # the message
+ MESSAGE=`cat "$1"`
+
+ # Put it into the file
+ echo -e "$2\n$TIME\n$MESSAGE" > $filename
+
+
+fi
+
+# Remove the message from samba
+rm -f "$1"
+