开源一个C# Class实现Openfire登陆、推出、消息发送,方便其他系统集成IM功能了
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ImApi
{
class Program
{
static ImLib.ImApi imapi = null;
static void Main(string[] args)
{
imapi = new ImLib.ImApi("192.168.1.163");
//注册新帐号
System.Console.WriteLine(imapi.CreateUser("vvvvvvvv","sdcdscdcvvv","12345"));
//imapi.OnConnected += new ImLib.ImApi.Connected(imapi_OnConnected);
//imapi.Login("ceshi2", "ceshi2");
System.Console.ReadLine();
}
//连接成功后再发消息
static void imapi_OnConnected(object sender, EventArgs e)
{
System.Console.WriteLine("登陆成功");
imapi.SendMessage("ceshi1", "测试");
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ImApi
{
class Program
{
static ImLib.ImApi imapi = null;
static void Main(string[] args)
{
imapi = new ImLib.ImApi("192.168.1.163");
//注册新帐号
System.Console.WriteLine(imapi.CreateUser("vvvvvvvv","sdcdscdcvvv","12345"));
//imapi.OnConnected += new ImLib.ImApi.Connected(imapi_OnConnected);
//imapi.Login("ceshi2", "ceshi2");
System.Console.ReadLine();
}
//连接成功后再发消息
static void imapi_OnConnected(object sender, EventArgs e)
{
System.Console.WriteLine("登陆成功");
imapi.SendMessage("ceshi1", "测试");
}
}
}
完整项目代码及编译后的类库下载地址:
小白救星 QQ 99923309