Processing an XMPP message on the sever before it is delivered? - xmpp

I am new to XMPP and I am wondering if it is possible to intercept an XMPP message at the server to perform some processing on it before delivering it to the recipient. What I would like to do is translate the text before it reaches the recipient. Is this possible? Thank you.

Related

Using XMPP for Request Response

I would like to know if is it possible to get XMPP messages sent by mobile client applications in my PHP Back end server?
The PHP Back end server will process the messages (JSON request) and send responses back to the client mobile apps. There will be 5 million client application users sending messages to server simultaneously.
Well you can use XMPP but definitely for that, you will need alot of changes.
Your mobile clients will send data in XMPP packets (message or iq) and you will have to handle those stanzas and parse them to get the data (which can be JSON).
So, Yes you can use XMPP but you need to have such skills (both on client side and on server side).

SOA UMS Email Populating black list

I'm sending email notifications through SOA using UMS. However, email server has a limit on the amount of emails sent and some go to invalid emails.
I'm trying to find a way to retrieve notifications of message delivery failure in order to populate a black list. SOA human workflow notifications are sucessfully sent despite the email address, they only record status on gateway delivery. Email client is not registering sent notifications nor is it receiving delivery failure notifications. (Unless I send an email through the email client, not from SOA)
Basically, I would like to know if UMS stores information of delivery failure to recipient (not gateway) and if so how can I access it. In alternative, how can I setup email client to register sent notifications and receive failure reports that can somehow be passed to SOA so they can be analyzed and the email added to a black list.
Any info missing that can help solving this issue just ask and I'll append it to the post.
Best regards,
Martin
You can create an inbound UMS adapter polling the inbox to read all the incoming mails. UMS adapter has a filtering option to read only mails that matches the pattern. Set the pattern to read only delivery failure notifications. That way the polling service will get triggered only for messages with delivery failure.
Try this out and let me know if this solve your problem.
Regards,
Viv

How to send XMPP Message with a given From or ReplyTo?

I would like to initiate a Chat between two users A and B from my web application. So I create an XMPP Message using Smack Client API or directly from an OpenFire Plugin:
Send a Message by Smack from A to B
Send a Message by Smack from Server to B with replyTo A
XEP-0033 allow "replyTo address" supported by OpenFire but not suported by IM Clients.
It seems "from" can't be overrided by a client or an OpenFire plugin. I also think GTalk will not accept an xmpp message from userA#gmail.com to userB#gmail.com by ServerToServer protocol.
Is there an other way to do this ? I want my web application to forge a message from UserA to UserB. But this webapp is not A or B.
Best Regards,
Jp
Any XMPP server should ignore the from address in a stanza and stamp the one that it get's from the connection into the stanza it sends on. This is a specific feature of XMPP compliant servers and is used to stop address spoofing and spam etc. You'd probably have to edit the source of a server and change it's behaviour. This is dangerous though and I wouldn't reccomend it if you'll be federating with other servers.
J

Send XMPP message without starting a chat

I am basically writing a XMPP client to automatically reply to "specific" chat messages.
My setup is like this:
I have pidgin running on my machine configured to run with an account x#xyz.com.
I have my own jabber client configured to run with the same account x#xyz.com.
There could be other XMPP clients .
Here is my requirement:
I am trying to automate certain kind of messages that I receive on gtalk. So whenever I receive a specific message eg: "How are you" , my own XMPP client should reply automatically with say "fine". How are you". All messages sent (before and after my client replies) to x#xyz.com but should be received by all clients (my own client does not have a UI and can only respond to specific messages.).
Now I have already coded my client to reply automatically. This works fine. But the problem I am facing is that as soon as I reply (I use the smack library), all subsequent messages that are sent to x#xyz.com are received only by my XMPP client. This is obviously a problem as my own client is quite dump and does not have a UI, so I don't get to see the rest of the messages sent to me, thereby making me "lose" messages.
I have observed the same behavior with other XMPP clients as well. Now the question is, is this is a requirement of XMPP (I am sorry but I haven't read XMPP protocol too well). Is it possible to code an XMPP client to send a reply to a user and still be able to receive all subsequent messages in all clients currently listening for messages? Making my client a full fledged XMPP client is a solution, but I don't want to go that route.
I hope my question is clear.
You may have to set a negative presence priority for your bot..
First thing to know is that in XMPP protocol every client is supposed to have a full JID. This is a bare JID - in your case x#xyz.com with a resource in the end e.g. x#xyz.com/pidgin or x#xyz.com/home (where /pidgin and /home are the resource). This is a part of how routing messages to different clients is supposed to be achieved.
Then there are the presence stanzas. When going online a client usually sends a presence stanza to the server. This informs about e.g. if the client is available for chat or away for lunch. Along with this information can be sent a priority. When there are more than one clients connected the one with the highest priority will receive the messages sent to the bare JID (e.g. ClientA(prio=50) and ClientB(prio=60) -> ClientB receives the messages sent to x#xyz.com). But there are also negative priorities. A priority less than 0 states that this client should never be sent any messages. Such a stanza might look like this
<presence from="x#xyz.com/bot">
<priority>-1</priority>
</presence>
This may fit your case. Please keep in mind it also depends on the XMPP server where your account is located, which may or may have not fully implemented this part of the protocol.
So to summarize: I recommend you to look through the Smack API how to set a presence and set the priority to <0 for your bot client right after it connected.

Basic Message v/s SMTP message in cakephp

I was wondering what is the difference between sending a basic message and message using SMTP in cakephp
Regards
A basic message just uses PHP's mail function to drop off the message to whatever mail handler is configured locally. On your local computer this usually means that the machine will try to deliver the message itself, which often results in it either being rejected or going straight into the spam folder of the receiver. On a properly set up hosted server this is usually not a problem though.
Delivering via SMTP lets you specify an SMTP server that will take over the message delivery for you. A well known and established SMTP server has much better chances of delivering a message to the intended recipient.