feat(example): Print the number of users in the MUC
This commit is contained in:
parent
9211963390
commit
aba90f2e90
@ -75,11 +75,16 @@ void main(List<String> args) async {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Join room
|
// Join room
|
||||||
await connection.getManagerById<MUCManager>(mucManager)!.joinRoom(
|
final mm = connection.getManagerById<MUCManager>(mucManager)!;
|
||||||
|
await mm.joinRoom(
|
||||||
muc,
|
muc,
|
||||||
nick,
|
nick,
|
||||||
maxHistoryStanzas: 0,
|
maxHistoryStanzas: 0,
|
||||||
);
|
);
|
||||||
|
final state = (await mm.getRoomState(muc))!;
|
||||||
|
|
||||||
|
print('=====> ${state.members.length} users in room');
|
||||||
|
print('=====> ${state.members.values.map((m) => m.nick).join(", ")}');
|
||||||
|
|
||||||
final repl = Repl(prompt: '> ');
|
final repl = Repl(prompt: '> ');
|
||||||
await for (final line in repl.runAsync()) {
|
await for (final line in repl.runAsync()) {
|
||||||
|
@ -5,6 +5,7 @@ import 'package:moxxmpp/src/xeps/xep_0004.dart';
|
|||||||
import 'package:moxxmpp/src/xeps/xep_0030/types.dart';
|
import 'package:moxxmpp/src/xeps/xep_0030/types.dart';
|
||||||
|
|
||||||
class InvalidAffiliationException implements Exception {}
|
class InvalidAffiliationException implements Exception {}
|
||||||
|
|
||||||
class InvalidRoleException implements Exception {}
|
class InvalidRoleException implements Exception {}
|
||||||
|
|
||||||
enum Affiliation {
|
enum Affiliation {
|
||||||
|
Loading…
Reference in New Issue
Block a user