blob: e10958338baad59e95a6351e2feb8355c5af0644 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
// **********************************************************************
//
// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
//
// This copy of Chat Demo is licensed to you under the terms described
// in the CHAT_DEMO_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef CHAT_SESSION_ICE
#define CHAT_SESSION_ICE
#include <Ice/BuiltinSequences.ice>
#include <Glacier2/Session.ice>
#include <Chat.ice>
module Chat
{
/**
*
* The ChatRoomCallback interface is the interface that clients implement
* as their callback object.
*
* The server calls operations of this interface to communicate
* with connected clients.
*
**/
interface ChatRoomCallback
{
/**
*
* The server invokes this operation when the client sets the callback
* for a session. This provides the client with the initial list of users
* currently in the chat room.
*
* @param users The names of users currently in the chat room.
*
**/
void init(Ice::StringSeq users);
/**
*
* The server invokes this operation to deliver a message
* that was sent to the chat room.
*
* @param name The name of the user that send the message.
*
* @param message The contents of the message.
*
* @param timestamp The time at which the message was sent.
*
**/
void send(long timestamp, string name, string message);
/**
*
* The server invokes this operation when a user joins
* the chat room.
*
* @param name The name of the user that joined the chat room.
*
* @param timestamp The time at which the user joined the chat room.
*
**/
void join(long timestamp, string name);
/**
*
* The servers invokes this operation when a user leaves
* the chat room.
*
* @param name The name of the user that left the chat room.
*
* @param timestamp The time at which the user left the chat room.
*
**/
void leave(long timestamp, string name);
};
/**
*
* A ChatSession is a custom Glacier2::Session for clients that use
* Glacier2 and support callbacks (C++, Java, and .NET clients).
*
* @see Glacier2::Session
*
**/
interface ChatSession extends Glacier2::Session
{
/**
*
* The setCallback operation is called by clients to set the
* callback used to receive notification of activity in the
* room. Clients receive notifications as soon as they call this
* operation (before setCallback returns).
*
* The first callback made by the server is a call to
* ChatRoomCallback::init, which delivers the current list of
* users to the client.
*
* @param cb The callback the server uses to deliver notifications.
*
* @see ChatRoomCallback
*
**/
void setCallback(ChatRoomCallback* cb);
/**
*
* Send a message to the chat room.
*
* @param message The message to be sent.
*
* @return The time at which the message is sent.
*
* @throws InvalidMessageException should the message be invalid.
*
**/
long send(string message) throws InvalidMessageException;
};
};
#endif
|