Smack MultiUserChatManager creates not joinable room - xmpp

I am using Smack 4.1.1 as Gradle dependency in mine Android project.
I have successfully established connection with mine local OpenFire server.
But I have an issue while creating temporary room from Android client.
final MultiUserChat multiUserChat = userChatManager.getMultiUserChat(roomId);  
try {  
multiUserChat.create(connection.getUser());  
LOG.debug("room created");  
} catch (XMPPException.XMPPErrorException | SmackException e) {  
LOG.error("create room error:{}", e);  
}  
try{  
multiUserChat.sendConfigurationForm(new Form(DataForm.Type.submit));   
} catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | SmackException.NotConnectedException e) {  
LOG.error("sending room configurations error:{}", e);  
}   
The most great thing is that I can see that room was created in OpenFire admin panel and get room information from another client.
try {  
MultiUserChatManager userChatManager = MultiUserChatManager.getInstanceFor(connection);  
RoomInfo info = userChatManager.getRoomInfo(roomId);  
LOG.debug("room has {} occupants", info.getOccupantsCount());  
joinToExistingRoom(roomId);  
} catch (XMPPException.XMPPErrorException e) {  
LOG.error("join room error:{}", e);  
final XMPPError.Condition condition = e.getXMPPError().getCondition();  
if (condition == XMPPError.Condition.item_not_found) {  
LOG.error("room does not exist error:{}", e);  
createRoom(roomId);  
}  
}  
But while trying to join room from second client I receive XMPPError: recipient-unavailable - wait.
Snippet of mine joinRoom method:
final MultiUserChat multiUserChat = userChatManager.getMultiUserChat(roomId);  
try {  
multiUserChat.join(connection.getUser());  
LOG.debug("joined to room:{}", roomId);  
} catch (SmackException.NoResponseException  
| XMPPException.XMPPErrorException  
| SmackException.NotConnectedException e) {  
LOG.error("error joining room {}", e);  
}  
So I am catching error joining room org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError:recipient-unavailable - wait
So the question is what can be wrong?
I also tried creating submitForm from createAnswerForm() method. But the result is the same.
One solution I have found to make it work is to send persistantroom as true in Answer of configuration form. But this method creates persistent room, though I need this room to be destroyed after all attendees leave room.
Maybe it is a simple problem, but now I do not know how to solve this issue.
Help will be appreciated a lot.
Thanks in advance.

The create() method documentation states that:
Creates the room according to some default configuration, assign the requesting user as the room owner, and add the owner to the room but not allow anyone else to enter the room (effectively "locking" the room). The requesting user will join the room under the specified nickname as soon as the room has been created.
To create an "Instant Room", that means a room with some default configuration that is available for immediate access, the room's owner should send an empty form after creating the room.
Try to send configuration form this way:
multiUserChat.create(connection.getUser())
Form form = new Form(DataForm.Type.submit);
multiUserChat.sendConfigurationForm(form);
See also muc extension documentation

Related

Braze canvas - unable to receive emails

I am trying to send more than 3 requests to my braze canvas from postman, immediately one ofter other. But I am not able to receive emails for all of the requests sent. I haven't setup frequency capping and customer re-entry time is 0sec. Can anyone help?
Edit: I found the Answer for this. Looks like Braze canvas cannot be used to send email to same person in succession. Braze Campaign is appropriate in this case.
Are you able to submit your code? It should look something similar to:
{"api_key":"<api_key>",
"canvas_id":"<canvas ID>",
"recipients":[
{"external_user_id": "{{User}}",
"canvas_entry_properties":{
"<any additional entry criteria>": "<values>"}}]}
That would allow you to push a single user. If the external_user_id does not appear in your instance when searched, it may not send.
https://www.braze.com/docs/api/endpoints/messaging/send_messages/post_send_triggered_canvases/#request-body
The information passed for the Canvas via the API must match up to the filters in Braze, otherwise it won't send. Make sure your API key can deploy Canvases as well.
I found the solution.Apparently, Braze campaign cannot be used to send email in succession to a single user. Switching it to Braze canvas solved the issue.

Smack Error not-authorized(401)

I'm working with smack to create a chat room for my web site but as I want to change a rooms configuration or its members, when I want to get i'ts current members or just doing any other modification, I get Error not-authorized(401)!I'm connected with an administrator account which is the owner of the room too! by the way I can do all these jobs through a client with out any problem!
any body has any Idea How can I fix it?
Regards.
I just found the problem :) it was because I should have joined the room first and then I could manage it!
like this :
MultiUserChat room = new MultiUserChat(connection, roomId);
room.join("admin"); // missing line :)
Collection<Affiliate> currentMembers=room.getMembers();

Error creating room using Smack: "Feature not implemented"

I'm following the documentation and trying to create a room:
//Create a MultiUserChat using a Connection for a room
MultiUserChat muc = new MultiUserChat(conn1, "myroom#mycompany.com");
// Create the room
muc.create("testroom");
// Send an empty room configuration form which indicates that we want
// an instant room
muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
When I go into PSI, click service discovery, click multiuserchat, right click browse, click myroom. It pops an error message, that says "There was an error getting agents for myroom#mycompany.com, Reason: Feature not implemented. The feature requested is not implemented by the recipient server and cannot be processed".
Any suggestions, anyone?
Now I can create a new room using PSI. I also tried muc.join instead of muc.create. Same error message.
Without knowing your exact setup, I would guess that your room name (myroom#mycompany.com) is incorrect. You get a Feature not implemented because the XMPP entity mycompany.com does likely not act as MUC service. Those are implemented as separate XMPP component, usually named conference or muc, e.g. conference.mycompany.com.

Need help with Zend Framework dynamic Namespaces

I want to make my system redirect unknown requests such as
www.address.com/a_company
to the adress
www.address.com/companies/company/ and display the company a_company if it exists in the database, otherwise throw the user to a 404 not found page.
So in detail, I want to make namespace that is as the first example dynamically, if the company exist in the database, I have no problem connecting to the database and retrieving information or finding a way to parse a company name, I just need help how to make my system check and run a function every time the address doesn't exist and show the second page (/companies/company/)..
I am using an Acl as well, but I think it should be fine if the page is /companies/company and then possibly add /?c=a_company or similar.
Thank you.
/Marcus
simply create a front controller plugin which checks the request params agains the database before the request is dispatched.

Drupal email users

I'm using Drupal 6.16: When a user creates an account on my site I have them select a category (ie children, youth, adult, etc). This is done with the select list box using the content_profile module. I have a content type that posts an announcement. In this content type is a check box that says 'email group'. Right now it does nothing, but what I would like for it to do is e-mail all the users that are associated with the group they chose when signing up for their account. If this will require extra code please be specific as I am not a strong php programmer.
Thanks for the help!!
msindle
There might be some module that do it exactly, but I don't think so.
I would have done it using few building blocks:
Retrieve the list of emails using Views - define a view that gives you the addresses according to a given group argument.
Use Rules module that will send an email notification after node is created.
Combine the two (this is the hard part) - insert the values from the view as the recipients for the email. You might be able to do it using PHP inside the Rule definition, plus view execution.
Try to accomplish it, and if you get into troubles, you are welcome to contact me via shushu.i#gmail.com
I would try http://drupal.org/project/subscriptions module + http://drupal.org/project/messaging module. You can set preferences for automatic subscribing to content type. Maybe Rules module can subscribe users automatically after creating or updating content_profile. Or maybe Rules can flag users after creating or updating content_profile and Subscription module could autosubscribe flagged users.