shell写成的jabber客户端-shell-xmpp-client
2014-07-28 11:37:27 阿炯

本站赞助商链接,请多关照。 这是一个在shell环境运行的脚本,采用shell语言开发,并在GPLv3下授权使用。需要bash和netcat指令。

#!/bin/sh
XMPP_SIMPLE="$(dirname $0)/xmpp_simple.sh"
JID=xmpp@delta64.com
PASS_FILE="$(dirname $0)/pass"

nl=$'\n'

IFS="$nl"

message_received() {
local from=$1
local message=$2

if [ "$message" = "disconnect" ]
then
    disconnect
else
    send_msg $1 "I can say that too:$nl$message"
fi
}

xmpp_control_mode() {
set_status "My systems time: $(date)"
}

jid="$JID"
login_pass="$(cat $PASS_FILE)"

# only announce our system time every 60 seconds
control_mode_every=60

### INSERT XMPP_SIMPLE HERE ###
. "$XMPP_SIMPLE"

管道调用的示例:

eval `xmpp --connect --jid "$JID" --pass-file "$PASS_FILE"`

传参方式的调用示例:

xmpp --msg "dest@freeoa.net" "message"

最新版本:2.0


项目主页:https://github.com/close2/shell-xmpp-client