use of eu.siacs.conversations.xmpp.Jid in project Conversations by siacs.
the class AbstractParser method parseItem.
public static MucOptions.User parseItem(Conversation conference, Element item, Jid fullJid) {
final String local = conference.getJid().getLocal();
final String domain = conference.getJid().getDomain().toEscapedString();
String affiliation = item.getAttribute("affiliation");
String role = item.getAttribute("role");
String nick = item.getAttribute("nick");
if (nick != null && fullJid == null) {
try {
fullJid = Jid.of(local, domain, nick);
} catch (IllegalArgumentException e) {
fullJid = null;
}
}
Jid realJid = item.getAttributeAsJid("jid");
MucOptions.User user = new MucOptions.User(conference.getMucOptions(), fullJid);
if (InvalidJid.isValid(realJid)) {
user.setRealJid(realJid);
}
user.setAffiliation(affiliation);
user.setRole(role);
return user;
}
use of eu.siacs.conversations.xmpp.Jid in project Conversations by siacs.
the class IqGenerator method generateSetPassword.
public IqPacket generateSetPassword(final Account account, final String newPassword) {
final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
packet.setTo(account.getDomain());
final Element query = packet.addChild("query", Namespace.REGISTER);
final Jid jid = account.getJid();
query.addChild("username").setContent(jid.getLocal());
query.addChild("password").setContent(newPassword);
return packet;
}
use of eu.siacs.conversations.xmpp.Jid in project Conversations by siacs.
the class MucOptions method getFallbackUsersFromCryptoTargets.
private List<User> getFallbackUsersFromCryptoTargets() {
List<User> users = new ArrayList<>();
for (Jid jid : conversation.getAcceptedCryptoTargets()) {
User user = new User(this, null);
user.setRealJid(jid);
users.add(user);
}
return users;
}
use of eu.siacs.conversations.xmpp.Jid in project Conversations by siacs.
the class IqGenerator method changeAffiliation.
public IqPacket changeAffiliation(Conversation conference, List<Jid> jids, String affiliation) {
IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
packet.setTo(conference.getJid().asBareJid());
packet.setFrom(conference.getAccount().getJid());
Element query = packet.query("http://jabber.org/protocol/muc#admin");
for (Jid jid : jids) {
Element item = query.addChild("item");
item.setAttribute("jid", jid);
item.setAttribute("affiliation", affiliation);
}
return packet;
}
use of eu.siacs.conversations.xmpp.Jid in project Conversations by siacs.
the class Contact method fromCursor.
public static Contact fromCursor(final Cursor cursor) {
final Jid jid;
try {
jid = Jid.of(cursor.getString(cursor.getColumnIndex(JID)));
} catch (final IllegalArgumentException e) {
// TODO: Borked DB... handle this somehow?
return null;
}
Uri systemAccount;
try {
systemAccount = Uri.parse(cursor.getString(cursor.getColumnIndex(SYSTEMACCOUNT)));
} catch (Exception e) {
systemAccount = null;
}
return new Contact(cursor.getString(cursor.getColumnIndex(ACCOUNT)), cursor.getString(cursor.getColumnIndex(SYSTEMNAME)), cursor.getString(cursor.getColumnIndex(SERVERNAME)), cursor.getString(cursor.getColumnIndex(PRESENCE_NAME)), jid, cursor.getInt(cursor.getColumnIndex(OPTIONS)), cursor.getString(cursor.getColumnIndex(PHOTOURI)), systemAccount, cursor.getString(cursor.getColumnIndex(KEYS)), cursor.getString(cursor.getColumnIndex(AVATAR)), cursor.getLong(cursor.getColumnIndex(LAST_TIME)), cursor.getString(cursor.getColumnIndex(LAST_PRESENCE)), cursor.getString(cursor.getColumnIndex(GROUPS)), RtpCapability.Capability.of(cursor.getString(cursor.getColumnIndex(RTP_CAPABILITY))));
}
Aggregations