나는 뭔가 잘못하고 있다고 생각합니다. GTalk ID에 XMPP 메시지를 보내고 싶지만 GTalk 앱이 메시지를 수신하지 못하게하여받는 사람 JID의 리소스를 변경하려고합니다.Google 토크에서 다른 jid 리소스가있는 메시지를 수신했습니다.
내 문제는 thay가 다른 리소스를 가지고 있지만 GTalk에서 모든 메시지를 수신하고 있다는 것입니다.
내 코드 :
public void doPost(HttpServletRequest req,
HttpServletResponse resp) throws IOException {
// Parse incoming message
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
Message msg = xmpp.parseMessage(req);
JID jid = msg.getFromJid();
String body = msg.getBody();
String jidID = jid.getId().split("/")[0];
JID jid2 = new JID(jidID+"/myownresource453242352");
String response = jid2.getId() + " " + body;
// Send out response
msg = new MessageBuilder().withRecipientJids(jid2).withBody(response).build();
xmpp.sendMessage(msg);
}
가 출력 :
라파 Espillaque, 18시 33분 - 당신은 응답하지한다!
[email protected], 18:33 - [email protected]/myownresource453242352 응답하지 않아야합니다!
무엇이 잘못 되었습니까?
UPDATE :
지금 내가 aSmack 클라이언트에서 [email protected]/bot하는 메시지를 전송하고있어 내 클라이언트에서 나에게 메시지를 재전송한다.
문제는 GTalk for Gmail이며 Android 용 GTalk는 보낸 모든 메시지를 등록하지만 앱 응답을받지 못합니다. 다른 클라이언트는 내가 보내지 않은 메시지를 표시하지 않습니다.
내 메시지를 Gmail 및 Android로 숨길 수 있습니까?
내 코드 :
서버에
public void doPost(HttpServletRequest req,
HttpServletResponse resp) throws IOException {
LOG.setLevel(Level.INFO);
// Parse incoming message
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
Message msg = xmpp.parseMessage(req);
LOG.info(msg.getStanza());
JID jid = msg.getFromJid();
String body = msg.getBody();
String response = "FullID: "+jid.getId()+" El mensaje recibido es: "+body;
// Send out response
msg = new MessageBuilder().
withRecipientJids(jid)
.withMessageType(MessageType.NORMAL)
.withBody(response)
.build();
xmpp.sendMessage(msg);
}
CLIENT :
ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
XMPPConnection connection = new XMPPConnection(connectionConfiguration);
try {
Log.i("TAG","Trying to connect");
connection.connect();
Log.i("TAG","Connected");
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
Log.i("TAG","Trying to Log In");
connection.login("[email protected]",mypass, mires");
Log.i("TAG","Logged In");
} catch (XMPPException e) {
e.printStackTrace();
Log.i("TAG","Problem connecting or logging in");
}
//Creating chat object for processing friend chat
Chat chat = connection.getChatManager().createChat(Server, new MessageListener() {
//Overriding process message function of MessageListener Interface which will be
//called whenever a message is received
@Override
public void processMessage(Chat c, Message m) {
//Displaying message sent by friend
//System.out.println(friendId+ " : " + m.getBody());
Log.i("TAG", m.getBody());
message = m.getBody();
}
});
try {
Message out = new Message();
out.setBody("Definitivo22222222");
out.setType(Type.normal);
chat.sendMessage(out);
Log.i("TAG", "Mensaje enviado");
} catch (XMPPException e) {
Log.i("TAG", "No se envió el mensaje");
e.printStackTrace();
}
마지막 일 : 나는 스탠자 aSmack의 ISN에서 수신하는 App Engine 로그 검색된 일반 유형이지만 채팅 유형입니다.
도움 주셔서 감사합니다.
마지막 항목 : 클라이언트와 Gmail에서 동시에 연결하고 클라이언트와 통화하여 Gmail의 기능을 테스트 할 수 있습니다. Gmail에서 메시지를 수신하고 있습니다.
다시 한번 감사드립니다.
또 다른 것 : 나의 goalis는 XMPP를 사용하여 게임의 2 클라이언트를 Gmail 계정과 통신합니다. 대안을 알고 있습니까?
어떤 Google 토크 클라이언트를 사용하고 있습니까? Gmail, 다운로드 클라이언트 (googletalk.exe), Google+, 피진, 다른 것? –
필자는 Empathy, GTalk for Windows 및 Gmail – Rafaesp