agsXMPP, Create muc room "Only occupants are allowed to send messages to the conference" - ejabberd

I need help with agsXMPP
user (testz2#mx.testserverz.info) authorization is successful
the user testz2#mx.testserverz.info created muc room (group chat)
testconfa#conference.mx.testserverz.info
3.the user testz2#mx.testserverz.info send request to invite another user to this room,
but server return message
<message xmlns="jabber:client" from="testconfa#conference.mx.testserverz.info" to="testz2#mx.testserverz.info/agsXMPP" type="error" xml:lang="en">
<error type="modify" code="406">
<not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" xml:lang="en">Only occupants are allowed to send messages to the conference</text>
</error>
<body>Hi everybody...</body>
</message>
how can the creator of a room become a member of a room and invite another user to this room ?

how can the creator of a room become a member of a room and invite another user to this room ?
No, no need for the user to be a room member , that is an affiliation: https://xmpp.org/extensions/xep-0045.html#affil
What you want is the user to be a room occupant, which means that the user joins/enters the room.
If the user sends a Mediated Invitation, he must be a room occupant when sending the invitation, as mentioned in: https://xmpp.org/extensions/xep-0045.html#invite
So, the user must join/enter the room he created: https://xmpp.org/extensions/xep-0045.html#enter and then he can send the invitation.
And what's the code to implement client joining a room in the library you are using? Sorry, I don't know that library.

Related

EWS API: Anything I call update_item for a meeting, it ends up canceling the meeting for any attendees

I'm using the EWS API (targeting Exchange 2010) I cannot figure out why anything I make a request to update a calendar meeting/item. Is there something I'm missing or is this the expected behavior? I'm able to make a change from Outlook to the meeting without it sending out a cancellation email to all attendees except the organizer.
The below is a sample of the relevant portion of the SOAP request. I replaced the actual attendee's email addresses, item ID and change key.
{:send_meeting_invitations_or_cancellations=>"SendOnlyToChanged",:conflict_resolution=>"AutoResolve", :item_changes=>[{:updates=>[{:set_item_field=>{:field_uRI=>{:field_uRI=>"item:Subject"},
:calendar_item=>{:sub_elements=>[{:subject=>{:text=>"Thursday 11AM Recurring"}}]}}},
{:set_item_field=>{:field_uRI=>{:field_uRI=>"item:Body"}, :calendar_item=>{:sub_elements=>[{:body=>{"BodyType"=>"HTML", :text=>"HI"}}]}}},
{:set_item_field=>{:field_uRI=>{:field_uRI=>"calendar:Location"},:calendar_item=>{:sub_elements=>[{:location=>{:text=>"LA, CA"}}]}}},
{:set_item_field=>{:field_uRI=>{:field_uRI=>"calendar:Start"}, :calendar_item=>{:sub_elements=>[{:start=>{:text=>"2019-03-07T19:00:00.0000000"}}]}}},
{:set_item_field=>{:field_uRI=>{:field_uRI=>"calendar:StartTimeZone"}, :calendar_item=>{:sub_elements=>[{:start_time_zone=>{"Id"=>"UTC"}}]}}},
{:set_item_field=>{:field_uRI=>{:field_uRI=>"calendar:End"}, :calendar_item=>{:sub_elements=>[{:end=>{:text=>"2019-03-07T19:30:00.0000000"}}]}}},
{:set_item_field=>{:field_uRI=>{:field_uRI=>"calendar:EndTimeZone"},:calendar_item=>{:sub_elements=>[{:end_time_zone=>{"Id"=>"UTC"}}]}}},
{:set_item_field=>{:field_uRI=>{:field_uRI=>"calendar:RequiredAttendees"},:calendar_item=>{:sub_elements=>[{:required_attendees=>{:sub_elements=>[
{:mailbox=>{:name=>"Joe ABC",:email_address=>"joe#abc.com", :routing_Type=>"SMTP"}},
{:mailbox=>{:name=>"John ABC", :email_address=>"john#abc.com",:routing_Type=>"SMTP"}}]}}]}}}],
:item_id=>{:id=>"AAMkAGJjNWIzNzI2LTM1N2YtNDVkMi05NzU5LTRj",
:change_key=>"DwAAABYAAADWK9s0Y5iSSLP"}}]}
If you use Set_Item_Field to update the required attendees this will overwrite the current property so if any attendees aren't in the updated collection your effectively canceling the meeting for those attendees. If you want to use Set_Item_Field to update attendees then you need to include all the attendees for that type because your replacing the collection for the recipient type not appending to it.

How to send mail multiple selected users

I have a meetings table where I am storing meeting information and where I can select a meeting between 2 types of user visitor type user and host type user. I have a many to many relationships between users and meeting that's why I have a pivot table meeting_user. I need to send mail all of the selected users for one meeting.
I am trying to send email using this but it's storing the meeting_id into notifiable_id column of db. so how can I store users_id in the notifiable_id column of db.
$meetings->save();
$meetings->users()->attach($request->user_id);
$users = Meeting::with('users')->get();
\Mail::to($user->send(New NewMeeting($meetings('id')));
There are two scenarios in which you can send an email to users to the meeting:
When the user has been added to the meeting
When alerting all users (in bulk) of a meeting which they have been added to.
When emailing the user which has just been added
In the event where you would like to email the users once added, you can do the following:
...
$meeting = Meeting::find($meeting_id);
$user = User::find($request->user_id);
$meeting->users()->attach($user->id);
\Notification::send($user, new NewMeetingNotification($user));
This is to be added within code which only adds a user to a meeting, not multiple users.
When emailing all users within a meeting at once
In the event where you would like to email users, in bulk, once you've added all users, you can do the following.
...
$meeting = Meeting::with('users')->where('id', $meeting_id)->first();
$meeting->users()->each(function ($user, $key) {
\Notification::send($user, new NewMeetingNotification($user));
});
$meeting_id being the meeting in question.
Notify User (Optional)
If the user model has the notifiable trait, you can change the code to:
...
$meeting = Meeting::with('users')->where('id', $meeting_id)->first();
$meeting->users()->each(function ($user, $key) {
$user->notify(new NewMeetingNotification($user));
});
I hope this helps.

Accessing list of groups along with user's role

I want to get a list of groups where i have member access and also i want to know which role I have in those Google groups.
for example, assume a user is a member of 70 groups. Through admin console I can check which role is assigned to that particular user, But its a lengthy process.
Can I list Google groups,where a user has membership access(atleast) along with the role(member,manager or owner) assigned to the user in those groups.
I would like to do it using Google App Script.
Thanks in advance
You can use the Group:list API where a userKey can be specified. It returns all the groups the user is a member of. Use the following HTTP request and include the authorization described in Authorize requests .
There's a JSON request were you can get the role of the group member, a group member's role can be (OWNER, MANAGER, MEMBER).
Here's a successful response returns an HTTP 200 status code and the member's information:
{
"kind": "directory#member",
"id": "group member's unique ID",
"email": "liz#example.com",
"role": "MEMBER",
"type": "GROUP"
}
For more information regarding Group members, click here: https://developers.google.com/admin-sdk/directory/v1/guides/manage-group-members#create_member

How to get all fields from ejabberd from MUC module?

We want to get all fields from this link (http://xmpp.org/extensions/xep-0045.html#roomconfig) for this section
Example 165. Service Sends Configuration Form to Owner
In the specification it is showing all fields, but we are not getting all fields from ejabberd like:
<field label='Roles and Affiliations that May Retrieve Member List' type='list-multi' var='muc#roomconfig_getmemberlist'>
We want to get muc#roomconfig_getmemberlist, but it is not getting from ejabberd.
What config we need to change to get all field like above link?
ejabberd is return all the field it supports. At the moment ejabberd does not support changing the affiliation of users allowed to retrieve the member list. It is assumed, that MUC admin, room owner and members can retrieve the member list.
That said, even if you do not have that field in the configuration form, ejabberd supports managing member list.
You can retrieve the members list from a user with proper credentials, sending the following query:
<iq type="get" to="room#conference.example.net" id="aac1a">
<query xmlns="http://jabber.org/protocol/muc#admin">
<item affiliation="member"/>
</query>
</iq>
You will receive a reply of the form:
<iq from="room#conference.example.net" type="result" id="aae0a">
<query xmlns="http://jabber.org/protocol/muc#admin">
<item affiliation="member" jid="newmember#example.net"/>
</query>
</iq>

Invitations on Trello API

What is the JSON structure for an invitation, and under what circumstances is one returned. For example,
GET /1/boards/5144051cbd0da6681200201e/invitations?key=[myKey]
always returns an empty array, even after I invite a fake email.
That route no longer returns anything (and should probably be marked deprecated).
Instead of invitation objects, we add a member to the board representing the invited person (where member.memberType = "ghost") so that you can interact with that person (mention in comments, add to cards) before they join Trello. If you invited that person, you will be able to see the 'ghost' member's email address.