how to get openfire Subscription "to" roster status? - xmpp

folks
There is one question.
For example, A and B user in openfire server. A user have B user(Subscription "from") on his roster and B user have A user(Subscription "to") on his roster.
B user could know the current status of A user, but A user could not know the B user current state.
How can know A user the status of B users?

When you get roster list, the list will come with its subscription.
<iq xmlns="jabber:client" type="result" id="5234:sendIQ" to="pqr#xyz.com">
<query xmlns="jabber:iq:roster">
<item jid="abc#xyx.com" name="abc" subscription="from">
<item jid="efg#xyx.com" name="abc" subscription="to">
<item jid="def#xyx.com" name="abc" subscription="both">
</query>
so by programing you can differentiate and get subscription what you want.

Related

MUC Invite message is not sent to all user resources on Openfire

I am having problems getting Openfire to send an invite message to all user resources associated with a user jid. I am using Openfire(3.9.3) and Strophe(1.1.3).
The users jid has 2 resources logged in on openfire (e.g. userA#chat.mychatserver.com/e1ef0b84, userA#chat.mychatserver.com/fa51aad7).
I have sent a MUC invite message to a user(i.e. userA) in order to join a room.
<?xml version="1.0"?>
<message xmlns:stream="http://etherx.jabber.org/streams"
xmlns="jabber:client" from="chatRoom#se.dev.openfire" to="userA#dev.openfire"
version="1.0">
<x xmlns="http://jabber.org/protocol/muc#user">
<invite from="userB#dev.openfire"/>
</x>
<x xmlns="jabber:x:conference" jid="chatRoom#dev.openfire"/>
</message>
I expected the invited to be sent to both resources (e.g. userA#chat.mychatserver.com/e1ef0b84, userA#chat.mychatserver.com/fa51aad7), however it only appears to be sent to the last logged in resources. For example if I logged in my phone as userA and then logged into my laptop as userA, the invite would only be sent to the laptop user.
Openfire seems to correctly route normal xmpp message to both user resources, I had expected muc invites to be handled in the same way.
Does anyone know whether this is at all possible?
Thanks,
Steve
Group invite is also treated as a normal message and it should get routed to all connected resources.
However for routing a message to all connected resources, Openfire has following logic:
Select session with highest presence priority, if no session qualifies, message is stored in offline store, If more than 1 sessions found with same priority, then Openfire becomes more smart ;) i.e. check the value of "route.all-resources" property.
If "route.all-resources" is true then message is routed to all those selected sessions, If value is false, then it sorts the sessions on the basis of show value (chat, available, away, xa) and again sorts the result on last active time and finally picks the 1st result and routes the message to that session.
Pay attention: according to XEP-0045 the XML to invite userA from userB is in the following form:
<message
from='userB#dev.openfire'
to='chatRoom#se.dev.openfire'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<invite to='userA#dev.openfire'>
<reason>
Hey UserA, this is the place for all good witches!
</reason>
</invite>
</x>
</message>
then the XMPP server (Openfire in this case) must provide to send the XML:
<message
from='chatRoom#se.dev.openfire'
to='userA#dev.openfire'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<invite from='userB#dev.openfire'>
<reason>
Hey UserA, this is the place for all good witches!
</reason>
</invite>
<password>xyz</password>
</x>
</message>
PS: another way is the direct invitation (not mediated by the room as in the XEP-0045), see http://xmpp.org/extensions/xep-0249.html

PayPal user identifier

I'm trying to find some hard identifier that don't change during PayPal account lifetime,
It seems like the REST API has its own user identifier (that can be returned from the openidconnect/userinfo resource when scope has openid)
Unfortunately, This ID is not what the Adaptive API expect when issuing a PayRequest:
sender.accountId: Account ID value (which is the same as the Payer ID value used in the Express Checkout API). The account ID value is an encrypted PayPal account ID.
This is confusing, I understand the REST API is different than the Adaptive API and using email is not sufficient because we need to store the identifier on our database for long term and user may change his email address through PayPal,
Thanks,
Asaf.
You don't need the sender ID when working with preapproved payments. The preapproval key itself relates to the sender who approved it.
Here's a sample request and response for Pay using a preapproval key that works just fine without any sender ID.
Request
<?xml version="1.0" encoding="utf-8"?>
<PayRequest xmlns="http://svcs.paypal.com/types/ap">
<requestEnvelope xmlns="">
<detailLevel>ReturnAll</detailLevel>
<errorLanguage>en_US</errorLanguage>
</requestEnvelope>
<actionType xmlns="">PAY</actionType>
<cancelUrl xmlns="">http://paypal.angelleye.com/paypal/class/1.2/Pay_Cancel.php</cancelUrl>
<clientDetails xmlns="">
<applicationId xmlns="">APP-80W284485P519543T</applicationId>
<ipAddress xmlns="">192.168.1.1</ipAddress>
</clientDetails>
<currencyCode xmlns="">USD</currencyCode>
<preapprovalKey xmlns="">PA-2AY45015CC5060422</preapprovalKey>
<receiverList xmlns="">
<receiver xmlns="">
<amount xmlns="">5.00</amount>
<email xmlns="">usb_1329725429_biz#angelleye.com</email>
</receiver>
</receiverList>
<sender>
<useCredentials xmlns=""></useCredentials>
</sender>
<account xmlns="">
<phone xmlns=""></phone>
</account>
<returnUrl xmlns="">http://paypal.angelleye.com/paypal/class/1.2/Pay_Return.php</returnUrl>
</PayRequest>
Response
<?xml version='1.0' encoding='UTF-8'?>
<ns2:PayResponse xmlns:ns2="http://svcs.paypal.com/types/ap">
<responseEnvelope>
<timestamp>2013-09-24T13:57:52.350-07:00</timestamp>
<ack>Success</ack>
<correlationId>2fa4316b879b9</correlationId>
<build>7767516</build>
</responseEnvelope>
<payKey>AP-5632737798659023M</payKey>
<paymentExecStatus>COMPLETED</paymentExecStatus>
<paymentInfoList>
<paymentInfo>
<transactionId>53664474R26308454</transactionId>
<transactionStatus>COMPLETED</transactionStatus>
<receiver>
<amount>5.00</amount>
<email>usb_1329725429_biz#angelleye.com</email>
<primary>false</primary>
<accountId>C9TAVNJFATXCS</accountId>
</receiver>
<pendingRefund>false</pendingRefund>
<senderTransactionId>3CV49919EJ546411E</senderTransactionId>
<senderTransactionStatus>COMPLETED</senderTransactionStatus>
</paymentInfo>
</paymentInfoList>
<sender>
<accountId>E7BTGVXBFSUAU</accountId>
</sender>
</ns2:PayResponse>
You can see above the response actually includes the sender ID which it knows based on the preapproval key provided in the request.

Xmpp chat invisible presence

I'm building a bot that monitor friends presences but doesn't need to be visible.
I have tried to set presence using priority, show, type with all knowns values but without success.
Is possibile to be invisibile and just receive presence notifications?
Thanks!
See XEP-0126: Invisibility, section 3.1:
<iq from='bilbo#tolkien.lit/shire' type='set' id='inv1'>
<query xmlns='jabber:iq:privacy'>
<list name='invisible'>
<item action='deny' order='1'>
<presence-out/>
</item>
</list>
</query>
</iq>
Have a look at the rfc. Presence has a subscription status. If your bot is subscribed to receive presence from your users but your users are not, they are not going to be notified of the bot's presence.
In other words, your bot should send:
<presence to="user#example.com" type="subscribe" />
followed by the user's authorization,
<presence to="bot#example.com" type="subscribed" />
Now the bot will receive presence from the user, but not the opposite.
To set status for become invisible, you must send a presence with type "invisible".
<presence type="invisible"/>
And here is the code (in ios):
XMPPPresence *presence = [XMPPPresence presenceWithType:#"invisible"];
[[self xmppStream] sendElement:presence];
I use this code to set my status as "invisible".
For more details, please read the documentation on http://xmpp.org/extensions/xep-0018.html#sect-id86210
Last I knew from Facebook, it's not possible to implement invisibility via XMPP commands: https://developers.facebook.com/bugs/315067461919373. See also https://developers.facebook.com/docs/chat/ under Limitations.

PEP handling with tigase server

Originally I was using an openfire backend for my web-based chat client. But since its pep did not work with clustering, I had to migrate to tigase.
Chat works fine with tigase, I haven't gotten to the clustering part but am still stuck with getting my old services up.
Note: I'm using strophe in my web app.
I am now trying to figure out how to get pep working with tigase. for pep with openfire, I just use the pep plugin with strophe and subscribe to another user's pep stream like such
myObj.connection.pep.subscribe(jid, node ,
function( iq ){ console.log(' > on_pep_subscription to '+jid+' node '+node+' SUCCESS');console.log(iq)},
function( iq ){ console.log(' > on_pep_subscription to '+jid+' node '+node+' FAIL');console.log(iq)},
function (msg){/*handle callback here*/}
to publish i use these:
myObj.connection.pep.publish('http://jabber.org/protocol/mood', newMood,
function( iq ){
console.log('- on_pep_publish to node "http://jabber.org/protocol/mood" SUCCESS'); console.log(iq);},
function( iq ){
console.log('- on_pep_publish to node "http://jabber.org/protocol/mood" FAIL');
console.log(iq); alert('failed to publish mood pls try again');});
This used to work fine with openfire but one big difference is that with tigase I don't get a callback success subscription. when I publish users on my roster automatically get my stream (which is good). But the problem is that I can't specify a handler for this event using strophe.
If i have 2 users cef and miko and my domain is mydomain. when i publish a mood with miko I get the following on cef:
<body xmpp:version="1.0" xmlns:xmpp="urn:xmpp:xbosh" secure="true" xmlns:stream="http://etherx.jabber.org/streams" xmlns="http://jabber.org/protocol/httpbind" ack="2545114322" from="mydomain">
<message id="2939:sendIQ" to="cef#mydomain" type="headline" from="miko#mydomain/tigase-15">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="http://jabber.org/protocol/mood">
<item>
<status>sad</status>
</item>
</items>
</event>
</message>
</body>
I've tried creating a handler on my own just like I would with the roster.
myObj.connection.addHandler(function(m){console.info('IQ WAAHAHAHAH');console.log(m);},null,"iq");
myObj.connection.addHandler(function(m){console.info('MESSAGE WAAHAHAHAH');console.log(m);},null,"message");
myObj.connection.addHandler(function(m){console.info('PRESENCE WAAHAHAHAH');console.log(m);},null,"presence");
for this particular event none of my handlers are able to handle them but with firebug and google's inspect I see an entry in the network with the said stanzas.
but It doesn't seem to work.
Does anyone have any idea?

Magento: How to change email address for sending error logs?

I receive error logs over email, but i change my email account, now i need to change the email also in magento.
Does somebody know where I can find option to change email in magento admin pages to start receive error logs on my new email.
Thanks
I guess you are talking about errors/local.xml:
<config>
<report>
<action>email</action>
<subject>Store Debug Information</subject>
<email_address>example#example.com</email_address>
<trash>leave</trash>
</report>
</config>