I'd like to create a simple chat application where the user can send message to a specific user. Based on this answer, I can send a message to a specific target using the target's address. The problem is, I can't get a specific user address without tracking his id on the channel's view. Is there anyway to set a user address so I can generate a unique address for each registered user and then use it as their address each time they try to login? With that, I can get their address based their username from data storage.
Related
Their is a requirement in a project to send emails from java application through lotus notes.
Note: the domino server is installed on client server.
Currently i am able to send email using notesFactory on my local machine.using notes.jar file
Which accesses the user by .nsf by its password.
I.e creating secure connection by password.
And gtting database object by calling
Session.getdatabase(null,"user.nsf")
Its perfectly working.
But for some types of emails the client have shared a generic id...(link) over an email... By clicking on that link the generic mail box opens under active user. In separate tab... Through which we can send emails.
But have not shared their .nsf path or id or password.
It directly opens by clicking on that link.
Now i want to access that generic id in notesfactory session
I tried to keep open that id and then running my code...but still it sends email through active user itself.
And client is not ready to share the id and password details of that user. Not the id file is getting generated in our local machine.
Is their any way to send emails through that id?
If anyone want code i am using..ill share.
But for some types of emails the client have shared a generic
id...(link) over an email... By clicking on that link the generic mail
box opens under active user. In separate tab... Through which we can
send emails.
That does not sound like a "shared id", it sounds more like a mail database with the ACL set to give a group of users access.
When you send an email from within Notes (no matter if it is through the UI or through code), the actual logged in user is used as the sender. It is intentionally by design, to prevent users from spoofing the sender.
There is an unsupported way to fake the sender address, by dropping the email directly into mail.box, but that should only be done by someone know what they are doing.
I wrote a script library several years ago, intended to help sending emails. It includes the ability to set the sender address. You can find it on my blog, it's free to use. But I would not recommend you using it without first understanding what the code is doing.
Here is the relevant part of the code:
Set mailbox = New NotesDatabase(mailservername,"mail.box")
If mailbox.Isopen = False Then
Print "mail.box on " & mailservername & " could not be opened"
Exit Sub
End If
Set me.maildoc = New NotesDocument(mailbox)
Call me.maildoc.ReplaceItemValue("Form","Memo")
Set me.body = New NotesRichTextItem(maildoc,"Body")
Call maildoc.ReplaceItemValue("Principal", me.p_principal)
' If principal is set, we want to fix so mail looks like
' it is coming from that address, need to set these fields
Call maildoc.ReplaceItemValue("From", me.p_principal)
Call maildoc.ReplaceItemValue("Sender", me.p_principal)
Call maildoc.ReplaceItemValue("ReplyTo", me.p_principal)
Call maildoc.ReplaceItemValue("SMTPOriginator", me.p_principal)
Call maildoc.ReplaceItemValue("PostedDate",Now())
If me.p_principal<>"" Then
Call maildoc.Save(True,False) ' Save in mail.box
Else
Call maildoc.Send(True) ' Send mail normally
End If
You use the Principal field to set the sender address.
Is it possible in AllJoyn to get the well-known name of a remote device from its announced About message? I would like to use the well-known name to connect to the device later on without a new discovery process.
I know I can get the device ID from the About message, but the well-known name seems to be different:
DeviceID: 558591fa-97db-464f-a8fa-efa30ecacc17
Actual Well-known name: net.allplay.MediaPlayer.i558591fa-97db-464f-a8fa-efa30ecacc17.r3X5_6mxu
While I could hard-code the beginning, I cannot find the last part (r3X5_6mxu) in the About message. Am I looking in the wrong place or is this information just not available?
Not from the announced About message.
When your app receives an announcement, your registered AboutListener's announced() method is called:
announced(String busName, int version, short port,
AboutObjectDescription[] objectDescriptions, Map<String, Variant> aboutData)
The busName parameter is mentioned in the javadoc as being the well-known name of the remote attachment, but in my experience the busName value has been the remote attachment's unique name. And the aboutData Map parameter does not contain the well-know name nor the unique name of the remote attachment (as far as standard fields in the aboutData map are concerned).
However, if you wish to correlate the remote attachment's well-known to its unique name (assuming a well-known name is published), then perhaps you could implement the BusListener interface and register it on your local bus. Each time the remote attachment has a name change, the following BusListener method is called in your app:
nameOwnerChanged(String busName, String previousOwner, String newOwner)
The busName parameter can be the remote attachment's well-known name (if it has one, otherwise it will be its unique name). For example, when the remote attachment is first established and assigned a name, a nameOwnerChanged message is sent (received by your app) with previousOwner=NULL and newOwner=[UniqueName]. Or when the remote attachment is terminated, for example, a nameOwnerChanged message is sent with previousOwner=[UniqueName] and newOwner=NULL. In this way you can see the remote attachment's busName and associated newOwner value.
Register interest in listening for remote well-known name prefix by calling findAdvertisedName(String namePrefix) on your local BusAttachment.
I want to know the logic and how i can implement it in netbeans. I want to create a login option in simple java application in netbeans via connectivity of mysql.
What I used to do is Preferences for checking whether user status is logged in or not
if user is already logged in then I don't lunch the login interface
else lunch login interface
in log in interface simply take input from user along with primary key (may be email address). and query to database whether it is available in database or not.
If user is available the data of particular user is displayed and preference for user logged in status should changed to logged in.
If user is not available then show some error message.
you can add sign up features where you can simply do simple input validation such as age range, email etc and finally insert the data input by the user.
I am following the Client side GCM code on the Android dev site; I came across this:
private void sendRegistrationIdToBackend() {
// Your implementation here.
}
Now this questions is not WHAT to implement there, I know how to do httpost's and send param's to the server.
My questions is WHERE do I send this in my Database?
I am implementing GCM in an app that already has registered users, so I have a users MySQL table. Now here are my questions: From what I have read, do RegistrationId's have a unique relationship with a user? If so, can I just put the RegistrationId for the user into a new column in my users table? The only issue I see: What if the user uses the app on multiple devices. So that makes me think my logic is wrong. And if it is wrong...
..should I just do what I have seen in demos and put registration ID's in their own table -- and if so, should they be put there with the user Id in the same row so that a reg Id can be identified to a particular user (not just device)?
The relation between a user and a Registration ID is many-to-many :
As you realized, if a user has multiple devices, that user would be associated with multiple Registration IDs.
If on a single device one user logs out and another user logs in, both would be associated with the same Registration ID. In that case, however, you can cancel the association of the Registration ID to the old user before associating it with the new user. This would simplify the relation between a user and a Registration ID to one-to-many.
Given those two points, having a table that contains for each Registration ID a user ID would work. Just don't forget to remove entries from this table when users log out, since when a user logs out in a specific device, the Registration ID that what given to that instance of the app is no longer associated with that user.
It depends on what your app wants to do:
If the user will use only one device you can put it in the user table.
If the user can have many devices and the same notifications should be sent to all of them you can have a list of registration ids for each user (a one to many table).
If each device will have different notifications you should add a table for the devices, and add the registration id there.
You could also group the registration IDs related to a single user using the notification key.
http://developer.android.com/google/gcm/notifications.html
That way you have one entry per user and you only need to send one message per user, GCM takes care of the rest.
I am using Google App Engine in Java to send XMPP messages.
I would like to know if there is a way to check if a user is logged in to the system or logged out. So, when the user signs in, I would like to send him a welcome chat message and when he signs out I would like to notify my server code of the same.
I have tried the presence API but no luck so far.
Assuming you're referring to querying a user's presence via XMPP, keep in mind that this will only work if your App Engine account is authorized by that user. If you have already got that far, querying for presence (user logged in/logged out) is quite simple (source).
If a Google talk user has subscribed to an app (has accepted an invitation or has invited the app to chat), the app can discover the user's availability by looking for a POST to /_ah/xmpp/presence/available. If the user is subscribed and available, you can send them your application's presence and status:
// In the handler for _ah/xmpp/presence/available
XMPPService xmppService = XMPPServiceFactory.getXMPPService();
Presence presence = xmppService.parsePresence(req);
// Split the XMPP address (e.g., user#gmail.com)
// from the resource (e.g., gmail.CD6EBC4A)
String from = presence.getFromJid().getId().split("/")[0];
// Mirror the contact's presence back to them
xmppService.sendPresence(from, PresenceType.AVAILABLE, presence.getPresenceShow(), presence.getStatus());
To further clarify, your app receives automatic presence notifications via the following POST URL paths:
POSTs to /_ah/xmpp/presence/available/ signal that the user is available and provide the user's chat status.
POSTs to /_ah/xmpp/presence/unavailable/ signal that the user is unavailable.
POSTs to /_ah/xmpp/presence/probe/ request a user's current presence.
As an example, when user sally logs in, you'll get a POST request to /_ah/xmpp/presence/available/ which your server will then have to process. Then when sally logs out, you'll get a separate POST request to /_ah/xmpp/presence/unavailable/.