XMPP/Jabber的Ruby类库 XMPP4R

码农软件 · 软件分类 · 网络工具包 · 2019-03-03 06:14:44

软件介绍

XMPP4R是一个XMPP/Jabber的Ruby类库。它的目标是提供开发Jabber相关应用程序或者Ruby脚本的完整框架。

安装方法:gem install xmpp4r

示例代码:

  # Send a message to a friend, asking for authorization if necessary:
im = Jabber::Simple.new("user@example.com", "password")
im.deliver("friend@example.com", "Hey there friend!")

# Get received messages and print them out to the console:
im.received_messages { |msg| puts msg.body if msg.type == :chat }

# Send an authorization request to a user:
im.add("friend@example.com")

# Get presence updates from your friends, and print them out to the console:
# (admittedly, this one needs some work)
im.presence_updates { |update|
from = update[0].jid.strip.to_s
status = update[2].status
presence = update[2].show
puts "#{from} went #{presence}: #{status}"
end

# Remove a user from your contact list:
im.remove("unfriendly@example.com")

# See the Jabber::Simple documentation for more information.

本文地址:https://codercto.com/soft/d/505.html

从Python开始学编程

从Python开始学编程

Vamei / 电子工业出版社 / 2016-11-24 / CNY 49.00

改编自Vamei博客的《Python快速教程》。本书以Python为样本,不仅介绍了编程的基本概念,还着重讲解编程语言的主流范式:面向过程、面向对象、面向函数。读者不仅可以轻松学会Python,以后再学习其他编程语言时也会更加容易。一起来看看 《从Python开始学编程》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试