How to cancel MUC invitation with Smack 4.2? - xmpp

Let assume that room owner invite to other smack user when this user is offline. After room owner decided to kick smack user. By the way smack user is still offline. I think, I must cancel invitation. when the above scenario is realized, smack throw exception "not allowed user". Exactly at this point (actually i catch this exception), I want to cancel invitation and update room info node. How can I this?

You can't revoke directly the invitation.
However, "kick" is like a temporary ban (an Admin can force an user to leave the MUC) that is not what are you looking for.
You are looking for a permanent BAN, that's the equivalent to set the "privileges" of ROOM OUTCAST to an user.
So you can try to put the user in the Outcast list: when he will accept the invitation, he will not found the grants to join.

Related

Start conversation without user interaction in Facebook Messenger

Is it possible to send a message to a user without the user interacting with the bot first?
I'm using the following guide to retrieve psids from users that have already connected their profile to an app that I own.
https://developers.facebook.com/docs/messenger-platform/connecting-accounts.
For users that have at least one interaction with a page that I also own, I'm able to get their id. For all other users the endpoint returns an empty array.
Im aware of customer matching but is that the only way to achieve this?
You can't send a message by bot before the user initializes the conversation.
Facebook Messanger Bot permits a standard messages, with a 24-hour interval
to reply to a message initiated by a user. In Some specific cases, Facebook permits to send a message after this time.
A message are triggerd when the user either sends a message to a company or clicks a call button for action in Messenger, or when the user requests a message from a company through a plugin, such as send to Messenger.
Check out the policies here : https://developers.facebook.com/docs/messenger-platform/policy-overview
You are correct, customer matching is your only option for this.
Just learned this today, if you have a user's phone number, you can message them unprompted. You also need the pages_messaging_phone_number permission, which you can only get by paying the $99 customer matching fee.
Check the docs on sending to phone numbers here. Customer matching docs here

Leave group chat, and get removed from member list

I am working on the chat application.
I want to implement the group user chat and I have successfully done that.
Now I want toad the functionality by which user can leave the group. I found leave the group but it seems like it's just making user unavailable but not removing user from the member list.
Is there any way by which user remove himself from the member list?
I have read the xep 0045 for it, in that there is a topic for existing the room which seems make user unavailable but not removing from member list.
http://xmpp.org/extensions/xep-0045.html#exit
If anyone has any idea how to do this please share it.
Leaving a room in XMPP (0045) is accomplished by sending an unavailable presence to that room (see XMPPRoom.leaveRoom() in the XMPPFramework) - that should remove them from the occupants of that room (we do this with our app regularly).
"Members list" - is a MUC feature for moderator use cases, it is not related to user. Just leave room as described in XEP, you no need to modify members list. In fact, you no need to add user in this list too, simple chat application should only tracks <presence> stanzas from and to room JID.

Problems of inviting friends through Facebook email

I want my users to invite their friends by sending them Facebook private massage. I am thinking of using send button, but the problem is that each invitation url is different and unique, so if I use send button to do it, I might need to create many send buttons each of which carries an unique href. I think this should work? But ideally, I want users to just select their friends in a multi friend selector and everything's done by just clicking the sending button. Any ideas?
Thanks for any help!
You can generate a unique URL for the message that includes the IDs for all the users the user wants to send the message to. Then, when the recipient accesses the URL and authenticates themselves, you can cross reference the URL and their User ID to what you have in your database.
Without knowing what the message contains, its purpose and what you want to achieve, this is the best approach I can think of.
You won't be able to tell who the message is actually sent to, as Facebook doesn't return the User IDs in the callback, but if you have read_inbox permissions, you should be able to look the User IDs up that way.
i think an better way to approach this is set up an invite system, have an invitation code field in your register.php that you sign into, store that info in user account database and set an number of times it can be used

How can I track accepted invitation sender on facebook app?

Situation: user A send invitation to my fb app to his friends X, Y and Z. Users X and Y has accepted invitations, but user Z not.
How can I track haw many users accepted invitations? I want to take some privileges for user A based on accepted invitations count.
Is there any method to track sender_id when invitation accepted?
Don't bother, it's not allowed by the policy.
Per section V.1.
You must not incentivize users to
grant additional permissions or use
Application Integration Points.
And per the documentation about Application Integration Points
By "Application Integration Point" we
mean Application Info Section,
Application tab, Feed, requests
(including invites), Publisher,
inbox attachments, Chat, Bookmarks, or
any other feature of a user profile or
Facebook communication channel in
which or through which an application
can provide, display, or deliver
content directed at, on behalf of, or
by permission of a user.
Actually, there is no need to additional permissions.
Using the next value, you can store the referring user id and referred user.
It's simply explained here: http://fbcookbook.ofhas.in/tag/tracking-invitation/
You actually can do this. I'm doing it for other reasons (tracking how people get to the app and other analytics type stuff). In the , you can set the url attribute of the button. For instance, mine is . That url does some processing that will be saved in my database saying that user with userId 9999 invited the current user. This is being used to tell us the successfulness of invitations (our original idea was incentivization like you, but they pointed that out in the policy too).
This is how I do it:
track the invites by looping over $_GET['to'] on your 'thank you page' and store these IDs (= to_id) against the current user ID (= from_id) in your DB.
When a new users signs up, compare the new ID with the to_ids the table. If it's a match, honor the corresponding from_id
Drawback: if somebody was invited by 2 or more ppl you don't know which invitation to honor. I just honor all invitations which makes everybody happy.

How can anonymous users exchange presence information with valid users on Jabber (Ejabberd)

I am working on a social network that should allow members to chat with visitors on the site. The concept is simple.
Users who have registered signup get their own account with rosters
When a visitor comes to the home page of the social network, he can see some of the online members of the community
Now he should be able to initiate a chat with them, by clicking on their name.
I have already got members to chat with their roster mates. My question is, how can I get an anonymous user to chat with a member and exchange presence info with him?
I have successfully managed to create anonymous accounts, members accounts and even send messages from an anonymous user to other members. But I cant get presence information from anonymous-user to member or vice versa?
BTW, the chat is JS based.
You're trying to break the XMPP model. Presence is an opt-in permission based system. You ask me if you can see my presence, I say yes. Generally my client will then automatically ask you if I can see your presence, and your client says yes. That's what the roster is -- yes's and no's to presence subscription requests.
You can make chat rooms (MUC, multi user chat) that are anonymous, as well as do presence in them. It's not a roster, though. It's the closest to what you're describing without going into crazy-land with pubsub, and I don't know if you could even bend that tool far enough to have anonymous roster entries.