package com.mfnd;
import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
//import org.jxmpp.stringprep.XmppStringprepException;
import java.io.IOException;
public class Main {
//
// public static void main(String[] args) throws IOException, SmackException, XMPPException, InterruptedException {
// AbstractXMPPConnection connection = new XMPPTCPConnection("zabbix", "pass", "mfnd.ru");
// connection.connect().login();
// String allertmessage = args[1];
// String sendto = args[0];
// Message message = new Message(sendto, allertmessage);
// connection.sendStanza(message);
// connection.disconnect();
// }
//}
public static void main(String[] args) throws IOException, SmackException, XMPPException, InterruptedException {
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword("zabbix", "pass")
.setXmppDomain("mfnd.ru")
.setHost("xmpp.mfnd.ru")
.setPort(5222)
.setResource("MFND Zabbix Alert")
.build();
AbstractXMPPConnection connection = new XMPPTCPConnection(config);
connection.setReplyTimeout(30000);
connection.connect().login();
String allertmessage = args[1];
String sendto = args[0];
Message message = new Message(sendto, allertmessage);
connection.sendStanza(message);
connection.disconnect();
}
}