RoomInformation.fromDiscoInfo constructor

RoomInformation.fromDiscoInfo(
  1. {required DiscoInfo discoInfo}
)

Constructs a RoomInformation object from a DiscoInfo object. The DiscoInfo object contains the necessary information to populate the RoomInformation fields.

Implementation

factory RoomInformation.fromDiscoInfo({
  required DiscoInfo discoInfo,
}) =>
    RoomInformation(
      jid: discoInfo.jid!,
      features: discoInfo.features,
      name: discoInfo.identities
          .firstWhere((i) => i.category == 'conference')
          .name!,
      roomInfo: discoInfo.extendedInfo.firstWhereOrNull((form) {
        final field = form.getFieldByVar(formVarFormType);
        return field?.type == 'hidden' &&
            field?.values.first == roomInfoFormType;
      }),
    );