5

First from this question : Asmack/openfire How do I keep a user permanently in groupchat room

I read that I cannot use MUC to keep the user persistent in the group, they'll automatically leave the group and can rejoin after they come online again, that concept is like IRC like what've been asked in here -> http://community.igniterealtime.org/thread/48020.

Then from the stackoverflow question I read about using pubsub, then I've done some research about pubsub and what I've got is pubsub can persist the user to be in the group even the user is offline but the message flow is more like one directional from the publisher to the subscriber (read-only).

So if I want to create a group chat application can I use pubsub and set all the member to become both publisher and subscriber? or is there any alternative solution?or my understanding of the pubsub and MUC is incorrect? my goal is to create some group chat like in the whatsapp or blackberry messenger group.

Thanks.

Community
  • 1
  • 1
Niko Adrianus Yuwono
  • 11,012
  • 8
  • 42
  • 64
  • Not 100% sure of what you're trying to do. Are you trying to accomplish keeping a list of users and showing their online status? – Mark S Nov 05 '13 at 16:16
  • @MarkStraley no, it's no need like that, so I want to create a messenger app where the user can create a group, and the group member will always be in the group and the message will be always delivered in the group, so when the user want to read the group message he/she must open the group chat, do you understand what I mean? – Niko Adrianus Yuwono Nov 06 '13 at 01:00
  • If I understand you right, Take a look a rosters. You can create groups with rosters. I think some combination of roster groups and pubsub might be what you're after. My first thought would not be MUC. Once you subscribe/authorize in a roster, it stays until removed. – Mark S Nov 06 '13 at 14:26
  • @MarkStraley Ah I never heard of rosters, I'll research about it first, thanks for your suggestion mark! – Niko Adrianus Yuwono Nov 07 '13 at 04:11
  • @nayoso how did you do it in the end? I've been stuck in the exact same issue as your's for some weeks now. kindly share your findings. – Talha Mir Dec 01 '13 at 17:21
  • @TalhaMir the project is on hold now because another reason, my client want to add requirement for feature phone, I'll let you know if is there any update :) – Niko Adrianus Yuwono Dec 02 '13 at 02:06

1 Answers1

3

You can make users permanent in Group chat in MUC by changing the following code of openfire.

File : src/java/org/jivesoftware/openfire/muc/spi/LocalMUCUser.java

change line 547-550:

// TODO Consider that different nodes can be creating and processing this presence at the same time (when 

remote node went down)

removeRole(group);

role.getChatRoom().leaveRoom(role);

TO:

// TODO Consider that different nodes can be creating and processing this presence at the same time (when 

remote node went down)

// TODO Dont remove user from group when they go offline.

//removeRole(group);

//role.getChatRoom().leaveRoom(role);
Jaspreet Chhabra
  • 1,431
  • 15
  • 23
  • Have you tested this. If I remove the user from muc then even will work? Please reply. Thanks in advance. – Jagdish Sep 18 '15 at 07:16
  • when user connection is lost then user will not leave group. If you are doing it explicitly then it will not work – Jaspreet Chhabra Sep 18 '15 at 10:32
  • Thanks for quick response. I want to same as whats app. I have tried with your code but it not working as expected. Is it possible any other alternate way? – Jagdish Sep 18 '15 at 11:21
  • If it dosn't work for you then you have done a mistake. As it works good for me – Jaspreet Chhabra Dec 12 '15 at 14:30
  • Worked as expected. Thanks!! – Anuj Sharma Jul 07 '16 at 07:45
  • can you please help, where that file exist?? – Learn Pain Less Dec 12 '16 at 05:16
  • 1
    @JaspreetChhabra: I have openfire configured in my server. but i have configured through setup file. I also wanted to make presence base group chat. i downloaded openfire server code and also changed in file as you mentioned above. i am unable to run openfire server from code using my tomcat server. Can you please help me about how can i deploy my customized openfire server code on my local tomcat server? – Dhaiyur May 19 '17 at 10:04
  • you need to build it from openfire code not setup. or you can also use MongooseIM server, which have muclight. see this https://xmpp.org/extensions/inbox/muc-light.html – Jaspreet Chhabra May 23 '17 at 15:39
  • @JaspreetChhabra is it also possible to tweak the code to skip joining the chat room and send messages to all members, irrespective of whether they have joined the room or not? – Sarthak Mittal Jun 02 '17 at 08:14
  • No, Muc is presence based, you can't. But its default feature of muclight if you want to use – Jaspreet Chhabra Jun 02 '17 at 15:00