Magic World game server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
2.7 KiB

5 years ago
  1. #pragma once
  2. #include <Ice/BuiltinSequences.ice>
  3. #include <Glacier2/Session.ice>
  4. #include <MW.ice>
  5. module MW
  6. {
  7. /**
  8. *
  9. * The MWRoomCallback interface is the interface that clients implement
  10. * as their callback object.
  11. *
  12. * The server calls operations of this interface to communicate
  13. * with connected clients.
  14. *
  15. **/
  16. interface MWMapCallback
  17. {
  18. /**
  19. *
  20. * The server invokes this operation when the client sets the callback
  21. * for a session. This provides the client with the initial list of users
  22. * currently in the MW room.
  23. *
  24. * @param users The names of users currently in the MW room.
  25. *
  26. **/
  27. void init(Ice::StringSeq users);
  28. /**
  29. *
  30. * The server invokes this operation to deliver a message
  31. * that was sent to the MW room.
  32. *
  33. * @param name The name of the user that send the message.
  34. *
  35. * @param message The contents of the message.
  36. *
  37. * @param timestamp The time at which the message was sent.
  38. *
  39. **/
  40. void send(long timestamp, string name, string message);
  41. /**
  42. *
  43. * The server invokes this operation when a user joins
  44. * the MW room.
  45. *
  46. * @param name The name of the user that joined the MW room.
  47. *
  48. * @param timestamp The time at which the user joined the MW room.
  49. *
  50. **/
  51. void join(long timestamp, string name);
  52. /**
  53. *
  54. * The servers invokes this operation when a user leaves
  55. * the MW room.
  56. *
  57. * @param name The name of the user that left the MW room.
  58. *
  59. * @param timestamp The time at which the user left the MW room.
  60. *
  61. **/
  62. void leave(long timestamp, string name);
  63. }
  64. /**
  65. *
  66. * A MWSession is a custom Glacier2::Session for clients that use
  67. * Glacier2 and support callbacks (such as C++, C# and clients).
  68. *
  69. * @see Glacier2::Session
  70. *
  71. **/
  72. interface MWSession extends Glacier2::Session
  73. {
  74. /**
  75. *
  76. * The setCallback operation is called by clients to set the
  77. * callback used to receive notification of activity in the
  78. * room. Clients receive notifications as soon as they call this
  79. * operation (before setCallback returns).
  80. *
  81. * The first callback made by the server is a call to
  82. * MWRoomCallback::init, which delivers the current list of
  83. * users to the client.
  84. *
  85. * @param cb The callback the server uses to deliver notifications.
  86. *
  87. * @see MWRoomCallback
  88. *
  89. **/
  90. void setCallback(MWMapCallback* cb);
  91. /**
  92. *
  93. * Send a message to the MW room.
  94. *
  95. * @param message The message to be sent.
  96. *
  97. * @return The time at which the message is sent.
  98. *
  99. * @throws InvalidMessageException should the message be invalid.
  100. *
  101. **/
  102. long send(string message) throws InvalidMessageException;
  103. }
  104. }