如題, 一直做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);
}