1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 22:32:06 +01:00

Use from(Packet) instead of getFrom(Packet) in MultiUserChat

This commit is contained in:
Florian Schmaus 2014-10-05 07:45:23 +02:00
parent 0fea113c8f
commit 8529d1463f

View file

@ -415,7 +415,7 @@ public class MultiUserChat {
Presence presence = enter(nickname, null, null, connection.getPacketReplyTimeout()); Presence presence = enter(nickname, null, null, connection.getPacketReplyTimeout());
// Look for confirmation of room creation from the server // Look for confirmation of room creation from the server
MUCUser mucUser = MUCUser.getFrom(presence); MUCUser mucUser = MUCUser.from(presence);
if (mucUser != null && mucUser.getStatus().contains(Status.ROOM_CREATED_201)) { if (mucUser != null && mucUser.getStatus().contains(Status.ROOM_CREATED_201)) {
// Room was created and the user has joined the room // Room was created and the user has joined the room
return true; return true;
@ -1938,11 +1938,11 @@ public class MultiUserChat {
Presence oldPresence = occupantsMap.put(from, presence); Presence oldPresence = occupantsMap.put(from, presence);
if (oldPresence != null) { if (oldPresence != null) {
// Get the previous occupant's affiliation & role // Get the previous occupant's affiliation & role
MUCUser mucExtension = MUCUser.getFrom(packet); MUCUser mucExtension = MUCUser.from(packet);
MUCAffiliation oldAffiliation = mucExtension.getItem().getAffiliation(); MUCAffiliation oldAffiliation = mucExtension.getItem().getAffiliation();
MUCRole oldRole = mucExtension.getItem().getRole(); MUCRole oldRole = mucExtension.getItem().getRole();
// Get the new occupant's affiliation & role // Get the new occupant's affiliation & role
mucExtension = MUCUser.getFrom(packet); mucExtension = MUCUser.from(packet);
MUCAffiliation newAffiliation = mucExtension.getItem().getAffiliation(); MUCAffiliation newAffiliation = mucExtension.getItem().getAffiliation();
MUCRole newRole = mucExtension.getItem().getRole(); MUCRole newRole = mucExtension.getItem().getRole();
// Fire role modification events // Fire role modification events
@ -1965,7 +1965,7 @@ public class MultiUserChat {
} }
else if (presence.getType() == Presence.Type.unavailable) { else if (presence.getType() == Presence.Type.unavailable) {
occupantsMap.remove(from); occupantsMap.remove(from);
MUCUser mucUser = MUCUser.getFrom(packet); MUCUser mucUser = MUCUser.from(packet);
if (mucUser != null && mucUser.getStatus() != null) { if (mucUser != null && mucUser.getStatus() != null) {
// Fire events according to the received presence code // Fire events according to the received presence code
checkPresenceCode( checkPresenceCode(
@ -1990,7 +1990,7 @@ public class MultiUserChat {
PacketListener declinesListener = new PacketListener() { PacketListener declinesListener = new PacketListener() {
public void processPacket(Packet packet) { public void processPacket(Packet packet) {
// Get the MUC User extension // Get the MUC User extension
MUCUser mucUser = MUCUser.getFrom(packet); MUCUser mucUser = MUCUser.from(packet);
// Check if the MUCUser informs that the invitee has declined the invitation // Check if the MUCUser informs that the invitee has declined the invitation
if (mucUser.getDecline() != null && if (mucUser.getDecline() != null &&
((Message) packet).getType() != Message.Type.error) { ((Message) packet).getType() != Message.Type.error) {
@ -2473,7 +2473,7 @@ public class MultiUserChat {
invitationPacketListener = new PacketListener() { invitationPacketListener = new PacketListener() {
public void processPacket(Packet packet) { public void processPacket(Packet packet) {
// Get the MUCUser extension // Get the MUCUser extension
MUCUser mucUser = MUCUser.getFrom(packet); MUCUser mucUser = MUCUser.from(packet);
// Check if the MUCUser extension includes an invitation // Check if the MUCUser extension includes an invitation
if (mucUser.getInvite() != null && if (mucUser.getInvite() != null &&
((Message) packet).getType() != Message.Type.error) { ((Message) packet).getType() != Message.Type.error) {