diff --git a/packages/moxxmpp/lib/src/xeps/xep_0045/errors.dart b/packages/moxxmpp/lib/src/xeps/xep_0045/errors.dart index f1771ac..7cc2b8f 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0045/errors.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0045/errors.dart @@ -12,3 +12,8 @@ class InvalidDiscoInfoResponse extends MUCError {} /// Returned when no nickname was specified from the client side while trying to /// perform some actions on the MUC, such as joining the room. class NoNicknameSpecified extends MUCError {} + +/// This error occurs when a user attempts to perform an action that requires +/// them to be a member of a room, but they are not currently joined to +/// that room. +class RoomNotJoinedError extends MUCError {} diff --git a/packages/moxxmpp/lib/src/xeps/xep_0045/xep_0045.dart b/packages/moxxmpp/lib/src/xeps/xep_0045/xep_0045.dart index b6a7859..80c50a4 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0045/xep_0045.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0045/xep_0045.dart @@ -97,6 +97,9 @@ class MUCManager extends XmppManagerBase { _mucRoomCache.remove(roomJid); return nick; }); + if (nick == null) { + return Result(RoomNotJoinedError); + } await getAttributes().sendStanza( StanzaDetails( Stanza.presence(