use of de.pixart.messenger.xmpp.stanzas.MessagePacket in project Pix-Art-Messenger by kriztan.
the class MessageGenerator method conferenceSubject.
public MessagePacket conferenceSubject(Conversation conversation, String subject) {
MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_GROUPCHAT);
packet.setTo(conversation.getJid().toBareJid());
Element subjectChild = new Element("subject");
subjectChild.setContent(subject);
packet.addChild(subjectChild);
packet.setFrom(conversation.getAccount().getJid().toBareJid());
return packet;
}
use of de.pixart.messenger.xmpp.stanzas.MessagePacket in project Pix-Art-Messenger by kriztan.
the class MessageGenerator method directInvite.
public MessagePacket directInvite(final Conversation conversation, final Jid contact) {
MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_NORMAL);
packet.setTo(contact);
packet.setFrom(conversation.getAccount().getJid());
Element x = packet.addChild("x", "jabber:x:conference");
x.setAttribute("jid", conversation.getJid().toBareJid().toString());
String password = conversation.getMucOptions().getPassword();
if (password != null) {
x.setAttribute("password", password);
}
return packet;
}
use of de.pixart.messenger.xmpp.stanzas.MessagePacket in project Pix-Art-Messenger by kriztan.
the class MessageGenerator method invite.
public MessagePacket invite(Conversation conversation, Jid contact) {
MessagePacket packet = new MessagePacket();
packet.setTo(conversation.getJid().toBareJid());
packet.setFrom(conversation.getAccount().getJid());
Element x = new Element("x");
x.setAttribute("xmlns", "http://jabber.org/protocol/muc#user");
Element invite = new Element("invite");
invite.setAttribute("to", contact.toBareJid().toString());
x.addChild(invite);
packet.addChild(x);
return packet;
}
use of de.pixart.messenger.xmpp.stanzas.MessagePacket in project Pix-Art-Messenger by kriztan.
the class MessageGenerator method generateOtrError.
public MessagePacket generateOtrError(Jid to, String id, String errorText) {
MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_ERROR);
packet.setAttribute("id", id);
packet.setTo(to);
Element error = packet.addChild("error");
error.setAttribute("code", "406");
error.setAttribute("type", "modify");
error.addChild("not-acceptable", "urn:ietf:params:xml:ns:xmpp-stanzas");
error.addChild("text").setContent("?OTR Error:" + errorText);
return packet;
}
use of de.pixart.messenger.xmpp.stanzas.MessagePacket in project Pix-Art-Messenger by kriztan.
the class XmppConnection method sendPacket.
private synchronized void sendPacket(final AbstractStanza packet, final boolean force) {
if (stanzasSent == Integer.MAX_VALUE) {
resetStreamId();
disconnect(true);
return;
}
synchronized (this.mStanzaQueue) {
if (force || isBound) {
tagWriter.writeStanzaAsync(packet);
} else {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + " do not write stanza to unbound stream " + packet.toString());
}
if (packet instanceof AbstractAcknowledgeableStanza) {
AbstractAcknowledgeableStanza stanza = (AbstractAcknowledgeableStanza) packet;
if (this.mStanzaQueue.size() != 0) {
int currentHighestKey = this.mStanzaQueue.keyAt(this.mStanzaQueue.size() - 1);
if (currentHighestKey != stanzasSent) {
throw new AssertionError("Stanza count messed up");
}
}
++stanzasSent;
this.mStanzaQueue.append(stanzasSent, stanza);
if (stanza instanceof MessagePacket && stanza.getId() != null && inSmacksSession) {
if (Config.EXTENDED_SM_LOGGING) {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": requesting ack for message stanza #" + stanzasSent);
}
tagWriter.writeStanzaAsync(new RequestPacket(this.smVersion));
}
}
}
}
Aggregations