#!/bin/sh

# Prints the contents of the clipbaord into Konversation with flood protection.
# Klipper must be running.
# Usage: /exec sayclip [pause-time]
# Pause time defaults to 1 second.
# By Gary Cramblitt (garycramblitt@comcast.net)
# Use however you wish.

SERVER=$1;
TARGET=$2;
PAUSETIME="1s";
if [ -n "$3" ]
then
  PAUSETIME="$3"
fi

qdbus org.kde.klipper /klipper getClipboardContents | while read line; do qdbus org.kde.konversation /irc say $SERVER "$TARGET" " $line"; sleep $PAUSETIME; done
