agsxmpp 和 openfire 服务器 通信

如题, 一直做c#, 最近做openfire 开发,所以我选择 agsxmpp 做测试的客户端,以下是遇到的问题及解决方法
1. openfire  发送数据流  是通过 PLAIN 的 , 而 agsxmpp 是默认是 通过DIGEST-MD5 发送
2. openfire 发送iq节  不接收 to属性

集体解决方案

1. 修改 agsxmpp 里的Mechanism.cs 里  
                     //case "DIGEST-MD5": //我加的 注释掉  case "DIGEST-MD5": 使plain 变为   默认设置
                    //return MechanismType.DIGEST_MD5;

  注释 case “Digest-md5” ,从而把agsxmpp的 默认发式 改为 PLAIN

2.修改 agsxmpp IqGrabber.cs  里的 public void SendIq(IQ iq, IqCB cb, object cbArg) 函数
       修改后如:  public void SendIq(IQ iq, IqCB cb, object cbArg)
                {
            // check if the callback is null, in case of wrong usage of this class
            if (cb != null)
            {
                TrackerData td = new TrackerData();
                td.cb = cb;
                td.data = cbArg;

                m_grabbing[iq.Id] = td;


                //我加的代码  iq在agsxmpp中发送Iq节的时候先iq.RemoveAttribute("to")
                iq.RemoveAttribute("to");
            }
         m_connection.Send(iq);
     }

 

posted @ 2012-09-11 14:20  但用此心  阅读(8142)  评论(3编辑  收藏  举报