As I can see in xep-0045 there is option to limit max users in room:
<field
var='muc#roomconfig_maxusers'
type='list-single'
label='Maximum Number of Room Occupants'/>
I'm using Smack lib for Java to create rooms. And I send form during creation process like this:
[...]
List<String> list = new ArrayList<String>();
list.add("3");
submitForm.setAnswer("muc#roomconfig_maxusers", list);
[...]
muc.sendConfigurationForm(submitForm);
And it doesn't work. In one room I can see 4 ppl, for exmple, but server shouldn't accepted 4th invite, right?
Other options (muc#roomconfig_persistentroom, muc#roomconfig_membersonly, etc.) work fine. There is the problem only with muc#roomconfig_maxusers.
I'm using last version of ejabberd.
How can I limit max users in MUC?
1) It isn't possible to set custom value for this option. You can check sources. Possible values are: [5, 10, 20, 30, 50, 100, 200, 500, 1000, 2000, 5000].
2) Admins doesn't count. So, if you have 5 ppl in room (1 of them admin), 1 man still can join this room.
Related
I have a dashboard to do for my organization about the use of smartsheet licenses by employees.
Normally, the request to obtain such information is as follows (according to the documentation):
https://api.smartsheet.com/2.0/users?include=lastLogin
However, this request displays exactly 100 results per page. All I want is to have all the results.
The documentation indicates that another parameter must be added to the request to obtain the full list of results. The request becomes:
https://api.smartsheet.com/2.0/users?include=lastLogin&includeAll=true
It works, however I only get the entire list of users without their last login, which brings me back to my question: How to get the list of all users including their last login ?
So, according to the docs for the List Users operation, specifying the include=lastLogin query string parameter will only include the lastLogin attribute for each User object in the response when the number of results returned in the response is 100 or fewer. (FWIW, I'd suspect that Smartsheet implemented this behavior because it'd be detrimental to API performance if a single API request tried to fetch the lastLogin value for hundreds or thousands of users.)
Good news though -- you can still get the info you want -- it's just going to take a little extra effort (and code) on your part. You'll need to submit a separate API request for each page of results (i.e., include both the include=lastLogin query string paramater and also the page query string parameter to specify the page number of results you want to retrieve with each request), and then join the results from all responses into a single list that you write to your dashboard. The value of the totalPages attribute in the initial List Users response will tell you how many total pages (of 100 users each by default, which is the maximum number of users you can request at a time if you want the lastLogin attribute included for each User object) are available -- i.e., how many requests you will need to issue in order to get all users and the lastLogin attribute for each.
For example, your first request would be:
GET https://api.smartsheet.com/2.0/users?include=lastLogin
...and let's assume that the response looks like this:
{
"pageNumber": 1,
"pageSize": 100,
"totalPages": 3,
"totalCount": 100,
"data": [
...
]
}
This response will contain the first 100 users -- but the response tells you it's only the first page of three available pages of results (i.e., the value of the totalPages attribute in the response is 3) -- so you'll need to issue two more requests in order to have retrieved the full set of users.
So, next you issue a second request, this time including the page parameter to specify that you want page 2:
GET https://api.smartsheet.com/2.0/users?include=lastLogin&page=2
...and the response returns the second page of results that looks like this:
{
"pageNumber": 2,
"pageSize": 100,
"totalPages": 3,
"totalCount": 100,
"data": [
...
]
}
This response will contain the next 100 users -- i.e., the second page of three available pages -- you'll need to issue one more request in order to have retrieved the full set of users.
So finally, you issue a third request, this time including the page parameter to specify that you want page 3:
GET https://api.smartsheet.com/2.0/users?include=lastLogin&page=3
...and the response contains the third (and in this example, final) page of results that looks something like this (where the value of the totalCount property is a numeric value >= 1 and <= 100 that indicates the number of users in the response):
{
"pageNumber": 3,
"pageSize": 100,
"totalPages": 3,
"totalCount": 52,
"data": [
...
]
}
Now, because the value of the pageNumber property in the response is equal to the value of the totalPages property in the response, you know this is the final set of users and you don't need to issue any more requests.
Between the 3 requests, you've now retrieved the full set of users (and the lastLogin attribute value for each).
I have 2 stores and create CF products using import. How do I control the super attribute values for the second store as they are different to the values used for the default store?
You just need to add the proper values to the attributes needed.
Let's say an attribute shoe_size.
For EU store will have values: 40, 41, 42, 43, 44 and 45
For USA store will have values: 8, 9, 9.5, 10, 10.5 and 11.
So attribute shoe_size must have all those values included.
If you don't want to show all those values in product page or filters you can modify this in frontend displaying what you want or create two attributes: shoe_size_eu and shoe_size_usa.
Regards.
I have a simple chat table. The chat table has a user_id column and a recipient_id column and a boolean agrees_to_chat column.
What I'd like to do, is display the users for which user 1 wants to chat with and whom all other users also want to chat with user 1.
(Note that there will be cases where 1 agrees to chat with 2, but 2 has not gone online to signal a preference yet. Obviously in those cases I don't want a chat to show up.)
Here's what I've come up with so far.
SELECT c1.user_id, c1.recipient_id, c2.user_id, c2.recipient_id FROM chats c1, chats c2
WHERE c1.recipient_id = c2.user_id
AND c1.user_id = c2.recipient_id
AND c2.user_id=1
AND c2.agrees_to_chat=true
AND c1.agrees_to_chat=true
For some reason setting c2.user_id = 1 results in what I want: records where user_id = 1, along with people who have agreed to chat listed in the recipient_id column.
However if I set it to c1.user_id=1 I get the same results flipped over. Namely, now my results are still people who have agreed to chat, but now the recipient_id = 1 for all results, and the user_id is the different users.
This matters to me because if I want to serve data that shows everyone whose agreed to chat with user 1. But if I decide to reference recipient_id in my code, I need to know that won't change...For example, on my computer I noticed that c2.user_id =1 results in what I want, but in this sql fiddle it seems to be that c1.user_id=1 gets what I need... http://sqlfiddle.com/#!15/799a9/2
So what's going on here? Is there something I'm not understanding about my query? Alternatively is there a better query for what I'm trying to achieve?
You don't need all 4 columns, since you already know 1st and 4th (and 2nd and 3rd) will be equal. Use SELECT c2.user_id, c2.recipient_id FROM ... or SELECT c1.user_id, c1.recipient_id FROM .... In case you actually need several copies of the same column from the self-joined tables, you can give names to them: SELECT c1.user_id AS user_id1, c1.recipient_id AS recipient_id1, c2.user_id AS user_id2, c2.recipient_id AS recipient_id2 FROM ...
#graph = Koala::Facebook::API.new($access_token)
The query below just return latest 100 statuses of certain user instead of all statuses
#graph.fql_query("SELECT status_id, message FROM status WHERE uid='user_id'")
What is happening? Anyone can guide me if I'm doing something wrong.
Awaiting
Facebook is pretty stingy with the data it returns, unless you ask for more.
Try adding LIMIT 200 to the end of your query and see if that gives you more. I don't think any table will ever return more than 5000 rows, some tables return far fewer.
If that doesn't work, you may need to make multiple queries, with LIMIT 100 OFFSET _n_, where _n_ would be 101, 201, 301, etc. for a LIMIT of 100.
Registered users were created first, then Simplenews was added.
How to set up mailing to all already registered users?
I get that you can send emails only to those who joined after you install the module. But I need the existing users' addresses included also.
I found a solution only cure addresses from the database, then export, and put them in a mass subscription.
I just did the following successfully on an up-to-date Simplenews module, with a 3000+ user base. The answer comes from http://cc.com.au/2010/02/03/drupal-simplenews-mass-subscribe
So what I do first is select the uid and email address for all authenticated users (the anonymous user has uid 0, so I select only users with a higher uid) and insert those into the simplenews_subscriptions table.
INSERT INTO simplenews_subscriptions(activated,mail,uid) SELECT 1,mail,uid FROM users WHERE uid > 0 ORDER BY uid ASC;
This automatically assigns a snid (subscription id) to each entry. You'll notice that rather than selecting a column value into the activated field, I just set it to 1.
Next, I need to find the taxonomy term ID (tid) for the particular newsletter to which I want to subscribe all users. You can find this either by listing the terms in the Newsletter vocabulary or by listing all newsletters. In both cases the term id will be shown in your web browser's status bar if you hover the mouse over the edit link: http://example.com/admin/content/simplenews/types/edit/42
On my Drupal site the tid is 42, so that is the newsletter number I want to subscribe my users to. I need to refer to them via the automatically assigned snid from the simplenews_subscriptions table, so I select that and insert it directory into the simplenews_snid_tid table, together with the correct tid.
INSERT INTO simplenews_snid_tid(snid,tid) SELECT snid,42 FROM simplenews_subscriptions;
D7 Solution
To add all users that are not already subscribers run this query
insert into simplenews_subscriber(activated, mail, uid) select 1, mail, uid from users where uid not in (select uid from simplenews_subscriber) and uid > 0;
And to subscribe them to a newsletter run this query
insert into simplenews_subscription(snid, tid, status, timestamp, source) select snid, 31, 1, unix_timestamp(), 'manual' from simplenews_subscriber where snid not in (select snid from simplenews_subscription);
Remmember to replace the number 31 by the number of your newsletter.
You should be able to implement this using Views, VBO and Rules.
Create a view that lists your users (with filters, if you want), create a rules component that receives a user as argument and then subscribe the mail address of that user using the provided action (make sure you've enabled the simplenews rules module).
Then enable bulk operations on the view with that rules component.
Credit #Berdir https://www.drupal.org/project/simplenews/issues/1564988