I using smack XMPP for create a chat app
when I receive new message, I dont know how to get user name from this thing below
#Override
public void processPacket(Packet packet) {
Message message = (Message) packet;
I used message.getFrom() but it return me like a email address
I like it return kind of name in facebook
Log in to Facebook and see address bar - you will see your unique id in Facebook, like "user213435445", it works the same way: when you receive facebook message from user545435345, application (Facebook site in that case) checks what "friendly name" associated with that id and show you received message from that name.
Back to XMPP - it works the same way, "email address", correctly named as JID - is a unique user identifier, when you receive xmpp message from user#example.com you should check what friendly name associated with it. You have the list of your contacts and their names in a XMPP Roster.
So, the right session flow is:
Log in to XMPP
Retrieve your roster
When you receive message, take the from and check that address present in your roster. If yes, take the friendly name of this buddy and display to user.
For outgoing message - when user click name of his buddy to chat, take that name and find associated JID in the user roster, send message to that JID.
Related
Platforms like upwork have a feature where when you get a message through those platforms, you also get an email.
Instead of logging Upwork to reply, the user can simply reply to the incoming email, and the message is then automatically sent by upworks backend to the original person who sent the message.
How exactly is this done in a way that Upwork knows the inbox to send the message to, and is able to receive a message via email.
It seems Upwork handles incoming emails by detecting any project ID in the email message - it can be an ID in the subject or in the email body and etc. So, the email can be recognized easily and processed. Also additional information can be checked on the incoming email - the sender (whom the original emails was sent out), the recipient and etc. Actually, it is up to your needs how algorithm should be working.
There is a group mailbox which is used by few users via delegated access. The emails that are sent from this group mailbox displays that email is from the group mailbox and sent by property shows the email address of the individual who has sent this email via delegated access.
In Google Apps Script how to get the value of the "Sent By" from the emails sent from this gmail account?
App Script has a class for Gmail API called GmailMessage. GmailMessage class has the getFrom() method which gets the sender of the message.
snippet:
var thread = GmailApp.getInboxThreads(0,1)[0]; // get first thread in inbox
var message = thread.getMessages()[0]; // get first message
Logger.log(message.getFrom()); // log from address of the message
Dose anyone know, how to retrieve kind of Google-talk user's id bellow of contact list?
xxxxx#public.talk.google.com
Talk between two users via hangouts (hangouts.google.com). This will "create" id#public.talk.google.com in roster's list of each user.
Then use Adium as Gtalk client, setup credentials for user which will be "sender" of your message.
Sign in via Adium and you will see in contact list id#public.talk.google.com of receiver.
Shortcut answer:
1) sender talks to receiver via hangouts
2) Use Adium for sender
3) read receiver id#public.talk.google.com in sender's contact list in Adium
I have set up a basic install of XMPPHP and to test it I tried sending a message from one of my gtalk (GoogleTalk) accounts to another gTalk account. The receiving account did not show the message, or the normal "user * has sent you a message: accept/block"
I then sent my receiving account a chat message from within the Google interface, and it prompted me (as expected) to add my account to the list of approved chat people.
Once my sending account was on the "approved" list, i was able successfully to send messages with xmpphp with no problem.
My question: Using xmpphp, how do i send an INVITATION to chat? I can send messages fine once the recipient accepts my incoming chats, but the first message sent does not trigger the chat program to prompt me to accept the messages.
As a follow-up...is there a way to find out if the recipient has accepted the request? ANy way to know that the messages are being delivered (or not)?
I had the same problem and the solution is to send a "subscribe" request before the message.
So just call
$conn->subscribe('someguy#someserver.net');
before
$conn->message('someguy#someserver.net', 'This is a test message!');
In Google Talk, how to send a message to person that is not in my friend list?
I work on an application that notify customers of a bank about change of their accounts. When I send a message to a person not in my list, no error is created, but the message isn't delivered to the recipient.
Because of design issues it is not suitable to send an invitation to customers and store information about their responses to it.
You can message a user directly using XMPP without an active presence subscription (the requirement for an item to appear in your roster), but most clients (Google Talk clients included AFAIK) will discard the message upon reception, if the from header does not match a bare JID in their roster.