diff --git a/src/client/puppet-service.ts b/src/client/puppet-service.ts index 8d2bcce9..54caa7e6 100644 --- a/src/client/puppet-service.ts +++ b/src/client/puppet-service.ts @@ -1333,13 +1333,20 @@ class PuppetService extends PUPPET.Puppet { override async roomDel ( roomId : string, - contactId : string, + contactIds : string | string[], ): Promise { - log.verbose('PuppetService', 'roomDel(%s, %s)', roomId, contactId) + log.verbose('PuppetService', 'roomDel(%s, %s)', roomId, contactIds) const request = new grpcPuppet.RoomDelRequest() request.setId(roomId) - request.setContactId(contactId) + if (Array.isArray(contactIds)) { + request.setContactIdsList(contactIds) + if (contactIds.length === 1) { + request.setContactId(contactIds[0] as string) + } + } else { + request.setId(contactIds) + } await util.promisify( this.grpcManager.client.roomDel @@ -1364,14 +1371,21 @@ class PuppetService extends PUPPET.Puppet { override async roomAdd ( roomId : string, - contactId : string, + contactIds : string | string[], inviteOnly : boolean, ): Promise { - log.verbose('PuppetService', 'roomAdd(%s, %s)', roomId, contactId) + log.verbose('PuppetService', 'roomAdd(%s, %s)', roomId, contactIds) const request = new grpcPuppet.RoomAddRequest() request.setId(roomId) - request.setContactId(contactId) + if (Array.isArray(contactIds)) { + request.setContactIds(contactIds) + if (contactIds.length === 1) { + request.setContactId(contactIds[0] as string) + } + } else { + request.setContactId(contactId) + } request.setInviteOnly(inviteOnly) await util.promisify( diff --git a/src/server/puppet-implementation.ts b/src/server/puppet-implementation.ts index 02f7312a..4fb58bad 100644 --- a/src/server/puppet-implementation.ts +++ b/src/server/puppet-implementation.ts @@ -1024,9 +1024,14 @@ function puppetImplementation ( try { const roomId = call.request.getId() const contactId = call.request.getContactId() + const contactIds = call.request.getContactIdsList() const inviteOnly = call.request.getInviteOnly() - await puppet.roomAdd(roomId, contactId, inviteOnly) + if (contactIds && contactIds.length > 1) { + await puppet.roomAdd(roomId, contactId, inviteOnly) + } else { + await puppet.roomAdd(roomId, contactId || (contactIds && contactIds[0]) || '', inviteOnly) + } return callback(null, new grpcPuppet.RoomAddResponse()) @@ -1108,8 +1113,13 @@ function puppetImplementation ( try { const roomId = call.request.getId() const contactId = call.request.getContactId() + const contactIds = call.request.getContactIdsList() - await puppet.roomDel(roomId, contactId) + if (contactIds && contactIds.length > 1) { + await puppet.roomDel(roomId, contactId) + } else { + await puppet.roomDel(roomId, contactId || (contactIds && contactIds[0]) || '') + } return callback(null, new grpcPuppet.RoomDelResponse())