emmucsetting.js

  1. 'use strict';
  2. const easemobNode = require('./../load');
  3. /**
  4. * Easemob EMMucSetting implementation.
  5. * {
  6. * PRIVATE_OWNER_INVITE = 0(defaule), //Private group, only group owner can invite user to the group
  7. * PRIVATE_MEMBER_INVITE = 1, //Private group, both group owner and members can invite user to the group
  8. * PUBLIC_JOIN_APPROVAL = 2, //Public group, user can apply to join the group, but need group owner's approval, and owner can invite user to the group
  9. * PUBLIC_JOIN_OPEN = 3 //Public group, any user can freely join the group, and owner can invite user to the group
  10. * }
  11. */
  12. /**
  13. * EMMucSetting constructor.
  14. * @constructor
  15. * @param {Number} style 群组类型
  16. * @param {Number} maxUserCount 最大人数
  17. * @param {Bool} inviteNeedConfirm 邀请进群是否需要确认
  18. * @param {String} extension 扩展信息
  19. */
  20. function EMMucSetting(style, maxUserCount, inviteNeedConfirm, extension) {
  21. if (typeof(style) == "object") {
  22. this._setting = style;
  23. } else {
  24. this._setting = new easemobNode.EMMucSetting(style, maxUserCount, inviteNeedConfirm, extension);
  25. }
  26. }
  27. /**
  28. * Set muc setting style.
  29. * @param {Number} style 群组类型
  30. * @return {void}
  31. */
  32. EMMucSetting.prototype.setStyle = function (style) {
  33. this._setting.setStyle(style);
  34. };
  35. /**
  36. * Get muc setting style.
  37. * @return {Number} 返回群组类型
  38. */
  39. EMMucSetting.prototype.style = function () {
  40. return this._setting.style();
  41. };
  42. /**
  43. * Set muc max user count.
  44. * @param {Number} maxUserCount 群组最大人数
  45. * @return {void}
  46. */
  47. EMMucSetting.prototype.setMaxUserCount = function (maxUserCount) {
  48. this._setting.setMaxUserCount(maxUserCount);
  49. };
  50. /**
  51. * Get muc max user count.
  52. * @return {Number} 返回群组最大人数
  53. */
  54. EMMucSetting.prototype.maxUserCount = function () {
  55. return this._setting.maxUserCount();
  56. };
  57. /**
  58. * Set muc max user count.
  59. * @param {Bool} inviteNeedConfirm 邀请成员是否需要确认
  60. * @return {void}
  61. */
  62. EMMucSetting.prototype.setInviteNeedConfirm = function (inviteNeedConfirm) {
  63. this._setting.setInviteNeedConfirm(inviteNeedConfirm);
  64. };
  65. /**
  66. * Get muc max user count.
  67. * @return {Bool} 返回邀请成员是否需要确认
  68. */
  69. EMMucSetting.prototype.inviteNeedConfirm = function () {
  70. return this._setting.inviteNeedConfirm();
  71. };
  72. /**
  73. * Set muc max user count.
  74. * @param {String} extension 扩展信息
  75. * @return {void}
  76. */
  77. EMMucSetting.prototype.setExtension = function (extension) {
  78. this._setting.setExtension(extension)
  79. };
  80. /**
  81. * Get muc max user count.
  82. * @return {String} 返回扩展信息
  83. */
  84. EMMucSetting.prototype.extension = function () {
  85. return this._setting.extension();
  86. };
  87. module.exports = EMMucSetting;