Guest User

Untitled

a guest
Dec 8th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. package msgme;
  2.  
  3. import org.jivesoftware.smack.Chat;
  4. import org.jivesoftware.smack.ChatManager;
  5. import org.jivesoftware.smack.ConnectionConfiguration;
  6. import org.jivesoftware.smack.SASLAuthentication;
  7. import org.jivesoftware.smack.XMPPConnection;
  8.  
  9. /**
  10.  *
  11.  * @author quarter
  12.  */
  13. public class MsgMe {
  14.  
  15.     /**
  16.      * @param args the command line arguments
  17.      */
  18.     public static void main(String[] args) throws Exception {
  19.         // TODO code application logic here
  20.         String user = "queijof@gmail.com";
  21.         String pass = "queijinho";
  22.        
  23.         ConnectionConfiguration cc = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
  24.         XMPPConnection connection = new XMPPConnection(cc);
  25.         connection.connect();
  26.         SASLAuthentication.supportSASLMechanism("PLAIN", 0);
  27.         connection.login(user, pass);
  28.        
  29.        
  30.         ChatManager chatmanager = connection.getChatManager();
  31.        
  32.         Chat chat = chatmanager.createChat("marcoandredinis@gmail.com", null);
  33.         chat.sendMessage("Hi Tom!");
  34.     }
  35. }
Add Comment
Please, Sign In to add comment