4 * Copyright (c) 2004 Novell, Inc. All Rights Reserved.
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
21 #ifndef PURPLE_NOVELL_NMEVENT_H
22 #define PURPLE_NOVELL_NMEVENT_H
24 typedef struct _NMEvent NMEvent
;
27 #include <sys/types.h>
30 * Defines for the event types
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
54 * Process the event. The event will be read, an NMEvent will
55 * be created, and the event callback will be called.
57 * @param user The main user structure.
58 * @param type The type of the event to read.
60 * @return NM_OK on success
62 NMERR_T
nm_process_event(NMUser
* user
, int type
);
67 * The NMEvent should be released by calling
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.
74 * @return The new NMEvent
76 NMEvent
*nm_create_event(int type
, const char *source
, guint32 gmt
);
81 * @param event The event to release
84 void nm_release_event(NMEvent
* event
);
87 * Sets the conference object for the given event.
89 * @param event The event.
90 * @param conference The conference to associate with the event.
93 void nm_event_set_conference(NMEvent
* event
, NMConference
* conference
);
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().
99 * @param event The event.
101 * @return The conference associated with the event, or NULL
102 * if no conference has been set for the event.
104 NMConference
*nm_event_get_conference(NMEvent
* event
);
107 * Sets the NMUserRecord object for the given event.
108 * The user record represents the event source.
110 * @param event The event.
111 * @param user_record The user record to associate with the event.
114 void nm_event_set_user_record(NMEvent
* event
, NMUserRecord
* user_record
);
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().
122 * @param event The event.
124 * @return The user record associated with the event, or NULL
125 * if no user record has been set for the event.
127 NMUserRecord
*nm_event_get_user_record(NMEvent
* event
);
130 * Sets the text to associate with the given event.
132 * @param event The event.
133 * @param text The text to associate with the event.
136 void nm_event_set_text(NMEvent
* event
, const char *text
);
139 * Returns the text associated with the given event.
141 * @param event The event.
143 * @return The text associated with the event, or NULL
144 * if no text has been set for the event.
146 const char *nm_event_get_text(NMEvent
* event
);
149 * Returns the source of the event (this will be the full DN of the
152 * @param event The event.
154 * @return The full DN of the event's source.
156 const char *nm_event_get_source(NMEvent
* event
);
159 * Returns the type of the event. See the defines above for
160 * a list of possible event types.
162 * @param event The event.
164 * @return The type of the event.
167 int nm_event_get_type(NMEvent
* event
);
170 * Returns the time that the event took place.
172 * @param event The event.
174 * @return The timestamp for the event.
176 time_t nm_event_get_gmt(NMEvent
* event
);
178 #endif /* PURPLE_NOVELL_NMEVENT_H */