I have a problem with…
I created a group chat with reference to the instance of tigase-tts-ng,and send messages to groups through users1,all group members can receive messages,But I don't know how to send a message to group members after processing the message in the plugin,please give me some examples,thank you
@Test(groups = {"Multi User Chat"}, description = "#8660: Delivery presence from offline user")
public void testOfflineUserSendsMessage() throws JaxmppException, InterruptedException {
user1Jaxmpp.getEventBus()
.addHandler(MucModule.MucMessageReceivedHandler.MucMessageReceivedEvent.class,
(sessionObject, message, room, nickname, timestamp) -> {
try {
mutex.notify("recv1:" + message.getBody());
} catch (XMLException e) {
Assert.fail(e.getMessage());
}
});
final String mid = nextRnd();
Element msg = ElementBuilder.create("message")
.setAttribute("type", "groupchat")
.setAttribute("to", roomJID.toString())
.child("body")
.setValue("test-" + mid)
.getElement();
user2Jaxmpp.send(Stanza.create(msg));
mutex.waitFor(20_000, "recv1:test-" + mid);
assertTrue(mutex.isItemNotified("recv1:test-" + mid),
"User1 did not received message from offline user");
}
//Here is the code snippet to simulate a group chat
user1Jaxmpp.getEventBus()
.addHandler(MucModule.MucMessageReceivedHandler.MucMessageReceivedEvent.class, new MucModule.MucMessageReceivedHandler() {
@Override
public void onMucMessageReceived(SessionObject sessionObject, Message message, Room room, String s, Date date) {
try {
System.out.println("user1:"+message.getBody());
} catch (Exception e) {
e.printStackTrace();
}
}
});
user2Jaxmpp.getEventBus()
.addHandler(MucModule.MucMessageReceivedHandler.MucMessageReceivedEvent.class, new MucModule.MucMessageReceivedHandler() {
@Override
public void onMucMessageReceived(SessionObject sessionObject, Message message, Room room, String s, Date date) {
try {
System.out.println("user2:"+message.getBody());
} catch (Exception e) {
e.printStackTrace();
}
}
});
user3Jaxmpp.getEventBus()
.addHandler(MucModule.MucMessageReceivedHandler.MucMessageReceivedEvent.class, new MucModule.MucMessageReceivedHandler() {
@Override
public void onMucMessageReceived(SessionObject sessionObject, Message message, Room room, String s, Date date) {
try {
System.out.println("user3:"+message.getBody());
} catch (Exception e) {
e.printStackTrace();
}
}
});
Details (please complete the following information):
Tigase version: [e.g. 8.1.0]
JVM flavour and version [e.g. AdoptOpenJDK11]
Operating system/distribution/version [e.g. Linux Ubuntu 20.04]
Unknown commented 2 years ago
Could you clarify what you are trying to achieve? What is "plugin" In your case?
You posted your question in tigase-server project yet you use jaxmpp code.
Unknown commented 2 years ago
ok,I customized a tigase plugin to process messages sent by group chat member,But I don't know how to notify all group members after processing the message,Below is a custom plugin
@Id(Solitaire.XMLNS_SOLITAIRE_DATA)
@Handles({@Handle(path = {"iq", "query"}, xmlns = Solitaire.XMLNS_SOLITAIRE_DATA)})
@Bean(name = Solitaire.XMLNS_SOLITAIRE_DATA, parent = SessionManager.class, active = true)
public class Solitaire extends AnnotatedXMPPProcessor implements XMPPProcessorIfc {
public static final String XMLNS_SOLITAIRE_DATA = "test:group-chat";
private static final Logger log = Logger.getLogger(Solitaire.class.getName());
@Override
public void process(Packet packet, XMPPResourceConnection session, NonAuthUserRepository repo, Queue<Packet> results,
Map<String, Object> settings) throws XMPPException {
if (session == null || !session.isAuthorized()) {
return;
}
if (StanzaType.get != packet.getType()) {
return;
}
try {
Element query = packet.getElemChild("query");
//Referring to the tigase example I know how to return the result to a single person,but I do not know how to notify
//group members after processing messages here
} catch (Exception e) {
LogUtils.logExeption(log, e);
}
}
}
Unknown commented 2 years ago
Once again: Could you clarify what you are trying to achieve?
In general if you are in groupchat (MUC or MIX) then sending message to such groupchat channel broadcast the message to all members.
# By Wojciech Kapcia (4) and others
* master:
Fixes #1542, #1475 by forcing delivery of resent unacked packets on stream resumption and by correcting settings resumption-timeout property key
Bug #1538: Exception in Sasl Authentication when do Load Test Tigase Server with TSung
add support for MS SQL Server to Tigase XMPP Server; #1461: SQL Server Support - code development
Revert "move dependencies to master project"
fix distribution building on windows
move dependencies to master project
I have a problem with… I created a group chat with reference to the instance of tigase-tts-ng,and send messages to groups through users1,all group members can receive messages,But I don't know how to send a message to group members after processing the message in the plugin,please give me some examples,thank you
Details (please complete the following information):