smack api know from who the message comes
in
Contributed Library Questions
•
2 years ago
Hi,
I have a small problem. I want to know from which person the message comes from googleTalk.
- void sendMessage() {
- if(firstUse) {
- // Eventhandler, to catch incoming chat events
- println("availableUsers " + onlineUsers.length);
- newChat = new Chat[onlineUsers.length];
- FromGoogleTalk = new String[onlineUsers.length];
- // hier worden gekeken welke personen online zijn en chatsessies aangemaakt
- for( select=0; select < onlineUsers.length ; select++) {
- newChat[select] = chatmanager.createChat(onlineUsers[select], new MessageListener() {
- public void processMessage(Chat chat, Message message) {
- // Here you do what you do with the message
- println("chat-----");
- println(chat);
- println(select);
- for (int i=0; i<newChat.length ; i++) {
- if (newChat[i].equals(chat)) {
- FromGoogleTalk[i] = message.getBody();
- println("---krijgt waarde");
- println("positie "+i);
- println(FromGoogleTalk[i]);
- }
- // Process commands
- // println(FromGoogleTalk);
- }
- // Process commands
- // println(FromGoogleTalk);
- }
- }
- );
- }
- }
- }
[update]
i've fixed it, but is this the best way?
1