src/protocols/novell/nmevent.h

branch
cpw.khc.msnp14
changeset 20472
6a6d2ef151e6
parent 13912
463b4fa9f067
parent 20469
b2836a24d81e
child 20473
91e1b3a49d10
equal deleted inserted replaced
13912:463b4fa9f067 20472:6a6d2ef151e6
1 /*
2 * nmevent.h
3 *
4 * Copyright (c) 2004 Novell, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21 #ifndef __NM_EVENT_H__
22 #define __NM_EVENT_H__
23
24 typedef struct _NMEvent NMEvent;
25
26 #include "nmuser.h"
27 #include <sys/types.h>
28
29 /**
30 * Defines for the event types
31 */
32 #define NMEVT_INVALID_RECIPIENT 101
33 #define NMEVT_UNDELIVERABLE_STATUS 102
34 #define NMEVT_STATUS_CHANGE 103
35 #define NMEVT_CONTACT_ADD 104
36 #define NMEVT_CONFERENCE_CLOSED 105
37 #define NMEVT_CONFERENCE_JOINED 106
38 #define NMEVT_CONFERENCE_LEFT 107
39 #define NMEVT_RECEIVE_MESSAGE 108
40 #define NMEVT_RECEIVE_FILE 109
41 #define NMEVT_USER_TYPING 112
42 #define NMEVT_USER_NOT_TYPING 113
43 #define NMEVT_USER_DISCONNECT 114
44 #define NMEVT_SERVER_DISCONNECT 115
45 #define NMEVT_CONFERENCE_RENAME 116
46 #define NMEVT_CONFERENCE_INVITE 117
47 #define NMEVT_CONFERENCE_INVITE_NOTIFY 118
48 #define NMEVT_CONFERENCE_REJECT 119
49 #define NMEVT_RECEIVE_AUTOREPLY 121
50 #define NMEVT_START NMEVT_INVALID_RECIPIENT
51 #define NMEVT_STOP NMEVT_RECEIVE_AUTOREPLY
52
53 /**
54 * Process the event. The event will be read, an NMEvent will
55 * be created, and the event callback will be called.
56 *
57 * @param user The main user structure.
58 * @param type The type of the event to read.
59 *
60 * @return NM_OK on success
61 */
62 NMERR_T nm_process_event(NMUser * user, int type);
63
64 /**
65 * Creates an NMEvent
66 *
67 * The NMEvent should be released by calling
68 * nm_release_event.
69 *
70 * @param type The event type, see defines above.
71 * @param source The DN of the event source.
72 * @param gmt The time that the event occurred.
73 *
74 * @return The new NMEvent
75 */
76 NMEvent *nm_create_event(int type, const char *source, guint32 gmt);
77
78 /**
79 * Releases an NMEvent
80 *
81 * @param event The event to release
82 *
83 */
84 void nm_release_event(NMEvent * event);
85
86 /**
87 * Sets the conference object for the given event.
88 *
89 * @param event The event.
90 * @param conference The conference to associate with the event.
91 *
92 */
93 void nm_event_set_conference(NMEvent * event, NMConference * conference);
94
95 /**
96 * Returns the conference object associated with the given event. This should not
97 * be released. If it needs to be kept around call nm_conference_addref().
98 *
99 * @param event The event.
100 *
101 * @return The conference associated with the event, or NULL
102 * if no conference has been set for the event.
103 */
104 NMConference *nm_event_get_conference(NMEvent * event);
105
106 /**
107 * Sets the NMUserRecord object for the given event.
108 * The user record represents the event source.
109 *
110 * @param event The event.
111 * @param user_record The user record to associate with the event.
112 *
113 */
114 void nm_event_set_user_record(NMEvent * event, NMUserRecord * user_record);
115
116 /**
117 * Returns the NMUserRecord object associated with the given event.
118 * The user record represents the event source. This should not
119 * be released. If it needs to be kept around call
120 * nm_user_record_add_ref().
121 *
122 * @param event The event.
123 *
124 * @return The user record associated with the event, or NULL
125 * if no user record has been set for the event.
126 */
127 NMUserRecord *nm_event_get_user_record(NMEvent * event);
128
129 /**
130 * Sets the text to associate with the given event.
131 *
132 * @param event The event.
133 * @param text The text to associate with the event.
134 *
135 */
136 void nm_event_set_text(NMEvent * event, const char *text);
137
138 /**
139 * Returns the text associated with the given event.
140 *
141 * @param event The event.
142 *
143 * @return The text associated with the event, or NULL
144 * if no text has been set for the event.
145 */
146 const char *nm_event_get_text(NMEvent * event);
147
148 /**
149 * Returns the source of the event (this will be the full DN of the
150 * event source).
151 *
152 * @param event The event.
153 *
154 * @return The full DN of the event's source.
155 */
156 const char *nm_event_get_source(NMEvent * event);
157
158 /**
159 * Returns the type of the event. See the defines above for
160 * a list of possible event types.
161 *
162 * @param event The event.
163 *
164 * @return The type of the event.
165 *
166 */
167 int nm_event_get_type(NMEvent * event);
168
169 /**
170 * Returns the time that the event took place.
171 *
172 * @param event The event.
173 *
174 * @return The timestamp for the event.
175 */
176 time_t nm_event_get_gmt(NMEvent * event);
177
178 #endif

mercurial