Android にグループ チャット メカニズムを実装し、グループを作成し、Openfire の REST API プラグインを介してメンバーを追加しました。同じグループにメッセージを送信しても、同じグループのすべてのメンバーにメッセージが配信されない。同じエラーログを参照して、同じことに関する解決策を提案してください。
ログ:
11-26 17:51:42.364 10035-10035/com.myoneapp.chat V/Cursor data==>>﹕ To User ID==> onCreateLoader=>terehokerahenge
11-26 17:51:47.018 10035-10654/com.myoneapp.chat I/System.out﹕ 05:51:47 PM SENT (0): <message to='terehokerahenge@conference.chat.spectratech.in' id='362-05' type='groupchat'><body>hi</body><SenderName></SenderName><mediaType>0</mediaType><request xmlns='urn:xmpp:receipts'/></message>
11-26 17:51:47.066 10035-10035/com.myoneapp.chat V/ChatWindow﹕ MESSAGE TYPE==>0
11-26 17:51:47.070 10035-10035/com.myoneapp.chat V/ChatWindow﹕ MESSAGE TYPE==>0
11-26 17:51:47.072 10035-10035/com.myoneapp.chat V/ChatWindow﹕ MESSAGE TYPE==>0
11-26 17:51:48.097 10035-10655/com.myoneapp.chat I/System.out﹕ 05:51:48 PM RECV (0): <message to="sanat@chat.spectratech.in/chat.spectratech.in" id="362-05" type="error" from="terehokerahenge@conference.chat.spectratech.in"><body>hi</body><SenderName/><mediaType>0</mediaType><request xmlns="urn:xmpp:receipts"/><error code="406" type="modify"><not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></message>
11-26 17:51:48.102 10035-10654/com.myoneapp.chat I/System.out﹕ 05:51:48 PM SENT (0): <message to='terehokerahenge@conference.chat.spectratech.in' id='CGIln-9' type='error'><received xmlns='urn:xmpp:receipts' id='362-05'/></message>
コード:
new Thread(new Runnable() {
@Override
public void run() {
activity.getmService().xmpp.createMUCGroup(etGroupSubject.getText().toString(), mAppPreferences.getUserName());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
activity.getmService().xmpp.inViteUserstoGroup(jabberids);
}
});
}
}).start();
public void createMUCGroup(String gJID, String owner){
mMultiUserChat = getMUChatManager().getMultiUserChat(gJID + "@conference.chat.spectratech.in");
try {
mMultiUserChat.create(mAppPreferences.getUserName());
// Get the the room's configuration form
// org.jivesoftware.smackx.xdata.Form form = mMultiUserChat.getConfigurationForm();
// Create a new form to submit based on the original form
org.jivesoftware.smackx.xdata.Form form = mMultiUserChat.getConfigurationForm().createAnswerForm();
form.setAnswer("muc#roomconfig_publicroom", true);
form.setAnswer("muc#roomconfig_roomname", gJID);
form.setAnswer("muc#roomconfig_roomowners",gJID);
form.setAnswer("muc#roomconfig_persistentroom", true);
mMultiUserChat.sendConfigurationForm(form);
/*org.jivesoftware.smackx.xdata.Form submitForm = form.createAnswerForm();
// Add default answers to the form to submit
for (java.util.Iterator fields = (java.util.Iterator) form.getFields(); fields.hasNext(); ) {
org.jivesoftware.smackx.xdata.FormField field = (org.jivesoftware.smackx.xdata.FormField) fields.next();
if (!org.jivesoftware.smackx.xdata.FormField.Type.hidden.equals(field.getType()) && field.getVariable() != null) {
// Sets the default value as the answer
submitForm.setDefaultAnswer(field.getVariable());
}
}*/
// Sets the new owner of the room
/*java.util.List owners = new java.util.ArrayList();
owners.add(mAppPreferences.getUserName()+"@chat.spectratech.in");
submitForm.setAnswer("muc#roomconfig_roomowners", owners);
// Send the completed form (with default values) to the server to configure the room
mMultiUserChat.sendConfigurationForm(submitForm);*/
}catch (Exception e){
e.printStackTrace();
}
}
public void inViteUserstoGroup(java.util.ArrayList<String> users){
getMUChatManager().addInvitationListener(MyXMPP.this);
for (int i = 0; i < users.size(); i++) {
try {
mMultiUserChat.invite(users.get(i)+"@chat.spectratech.in", "Meet me in this group.");
} catch (org.jivesoftware.smack.SmackException.NotConnectedException e) {
e.printStackTrace();
}
}
}
@Override
public void invitationReceived(org.jivesoftware.smack.XMPPConnection xmppConnection, org.jivesoftware.smackx.muc.MultiUserChat multiUserChat, String s, String s1, String s2, org.jivesoftware.smack.packet.Message message) {
try {
System.out.println("Invitation Received==========================>");
mMultiUserChat.join(s1);
} catch (org.jivesoftware.smack.SmackException.NoResponseException e) {
e.printStackTrace();
} catch (org.jivesoftware.smack.XMPPException.XMPPErrorException e) {
e.printStackTrace();
} catch (org.jivesoftware.smack.SmackException.NotConnectedException e) {
e.printStackTrace();
}
}
エラー406を返す、受け入れられない