Ejabberd: Get myself message on one - one chat - xmpp

I have a web chat application, when user 1 login by one account in many browsers with difference resource and send a message to user 2.
Ex:
user 1 login in chrome with jid: user1#localhost/chrome
user 1 login in chrome whit jid: user1#localhost/firefox
User 1 in chrome send chat message for user2 with content "hello".
I got a problem here, ejabberd server just send "hello" to user2, but I want server also send a copy of "hello" for all user 1 in chrome and firefox.
How can I do it?

Yes, ejabberd support carbon message. My solution is: after sending a message, I send a copy of message for my self by setting "to" is my barejid and replace "type" is "copy" (my custom type):
<message to='me#192.168.2.90' type='copy' id='5ea1f7d8-1961-c9dc-b599-55a89438491b' xmlns='jabber:client'>
<body>hello</body>
<x >
<to>other#192.168.2.90</to>
</x>

Related

Openfire ConversationID has changed after logout

I'm developing a chat app that use XMPPFramework and Openfire Server. When I (usn2) send message to usn1, a message has been created in ofMessageArchieve with conversationID. But after logout and login again, when chat, the new conversation has created (see image below), but I want to add this message to exist conversation. How can I do this?
Code to send message:
let msg = XMPPMessage(type: "chat", to: XMPPJID.jidWithString(getJIDFromName(stateID)))
msg.addBody(message)
msg.addAttributeWithName("id", stringValue: stream.generateUUID())
stream.sendElement(msg)
Although I changed Openfire as #Shoaib Ahmad Gondal suggested. It still happens
MessageId and ConversationId is not same. MessageId generates for each message you send but ConversationId generates based on users & session(maybe). To keep them same you have to modify message archive plugin or develop new one.

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

SMTP MAIL FROM: being received as DATA: From?

I'm writing a recreational email spoofing app with several safeguards to make the app useless to spammers and other malicious people. One of these safeguards is that the app requires the user to send emails from the user's own SMTP account. The app is supposed to use this "login#smtp.example.com" for the MAIL FROM command. The From: field visible to the user is supposed to be spoofedAddress#example.com. I'm using Apache Commons Net SMTP. Here are relevant code fragments.
AuthenticatingSMTPClient client = new AuthenticatingSMTPClient();
....
client.auth(AuthenticatingSMTPClient.AUTH_METHOD.LOGIN, "login#smtp.example.com", "password");
....
client.setSender("login#smtp.example.com");
....
SimpleSMTPHeader header = new SimpleSMTPHeader("spoofedAddress#example.com", "Addressee#example.com", "Subject");
....
When the email arrives in my inbox, it displays "login#smtp.example.com" in the both the From: field and the envelope. "spoofedAddress#example.com" is nowhere to be seen. I used Log.e("SendMail", header.toString()); to show me the header produced by my app and it was correct. It appears that my email client is ignoring my header in favour of the envelope.
Solution
My SMTP server was intrusively editing the From: field. When I told my app to connect to a different SMTP server, "spoofedAddress#example.com" appeared in the received email's From: field.

Typo3 (sr_feuser_register): Send email to user on admin approval

I'm using the Typo3 extension sr_feuser_register. There are several email options available depending on the configuration of the user registration process.
In my case I set:
plugin.tx_srfeuserregister_pi1 {
enableAdminReview = 1
enableEmailConfirmation = 0
# ...
}
I miss an option to send an email to the user on admin approval (with having users confirmation disabled).
Have I overlooked something?
[Update]
It looks as if the problem doesn't directly result from an incorrect plugin configuration because the email is sent in some cases.
Have you tried to set the constant enableEmailOnApprove to 1 ?
This send an email to the frontend user after aproval by the admin.

TYPO3 + dmailsubscription: Get a confirmation message after email for editing profile

Im using dmailsubscription to register users to a newsletter. Theres an option where, once already registered and confirmed, you can get an email with the link to edit your profile.
The problem is, once you enter the email address, the page is reloaded and the plugin shows no message at all. Id like to get some sort of confirmation text, like:
"The email with the link to edit your profile was sent to xxx#xxx.com"
or at least:
"The email with the link to edit your profile was sent to your email address"
, but I dont know how.
Here's my template: http://pastebin.com/K5WVSgrY
Above
<!-- ###TEMPLATE_DELETE_SAVED### begin
But AFTER
###TEMPLATE_INFOMAIL### end-->
Try to add this:
<BR><BR><BR><BR>
<HR>
<BR><BR><BR><EM>This template is the response page when a users has requested
his password send to his email.</EM> <BR><BR><!-- ###TEMPLATE_INFOMAIL_SENT### begin
This template is the response page when a users has requested his password send to his email.
-->###GW1B###We have emailed your your details. Edit your message here.###GW1E###<BR><BR>###GW2B### <STRONG>Go back</STRONG><BR>###GW2E###
<!-- ###TEMPLATE_INFOMAIL_SENT### end--><BR><BR><BR><BR>
<HR>
I cannot find this part in your template-file.