Disable installing plugins that aren't built.
[pidgin-git.git] / libpurple / message.h
blob8327150829e117f173733c1faaee66fe64b21ed2
1 /* purple
3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef PURPLE_MESSAGE_H
23 #define PURPLE_MESSAGE_H
24 /**
25 * SECTION:message
26 * @include:message.h
27 * @section_id: libpurple-message
28 * @short_description: serializable messages
29 * @title: Message model
31 * #PurpleMessage object collects data about a certain (incoming or outgoing) message.
32 * It (TODO: will be) serializable, so it can be stored in log and retrieved
33 * with any metadata.
36 #include <glib-object.h>
38 G_BEGIN_DECLS
40 #define PURPLE_TYPE_MESSAGE purple_message_get_type()
42 /**
43 * purple_message_get_type:
45 * Returns: the #GType for a message.
47 G_DECLARE_FINAL_TYPE(PurpleMessage, purple_message, PURPLE, MESSAGE, GObject)
49 /**
50 * purple_message_new_outgoing:
51 * @who: Message's recipient.
52 * @contents: The contents of a message.
53 * @flags: The message flags.
55 * Creates new outgoing message (the user is the author).
57 * You don't need to set the #PURPLE_MESSAGE_SEND flag.
59 * Returns: the new #PurpleMessage.
61 PurpleMessage *
62 purple_message_new_outgoing(const gchar *who, const gchar *contents,
63 PurpleMessageFlags flags);
65 /**
66 * purple_message_new_incoming:
67 * @who: Message's author.
68 * @contents: The contents of a message.
69 * @flags: The message flags.
70 * @timestamp: The time of transmitting a message. May be 0 for a current time.
72 * Creates new incoming message (the user is the recipient).
74 * You don't need to set the #PURPLE_MESSAGE_RECV flag.
76 * Returns: the new #PurpleMessage.
78 PurpleMessage *
79 purple_message_new_incoming(const gchar *who, const gchar *contents,
80 PurpleMessageFlags flags, guint64 timestamp);
82 /**
83 * purple_message_new_system:
84 * @contents: The contents of a message.
85 * @flags: The message flags.
87 * Creates new system message.
89 * You don't need to set the #PURPLE_MESSAGE_SYSTEM flag.
91 * Returns: the new #PurpleMessage.
93 PurpleMessage *
94 purple_message_new_system(const gchar *contents, PurpleMessageFlags flags);
96 /**
97 * purple_message_get_id:
98 * @msg: The message.
100 * Returns the unique identifier of the message. These identifiers are not
101 * serialized - it's a per-session id.
103 * Returns: the global identifier of @msg.
105 guint
106 purple_message_get_id(PurpleMessage *msg);
109 * purple_message_find_by_id:
110 * @id: The message identifier.
112 * Finds the message with a given @id.
114 * Returns: (transfer none): The #PurpleMessage, or %NULL if not found.
116 PurpleMessage *
117 purple_message_find_by_id(guint id);
120 * purple_message_get_author:
121 * @msg: The message.
123 * Returns the author of the message - his screen name (not a local alias).
125 * Returns: the author of @msg.
127 const gchar *
128 purple_message_get_author(PurpleMessage *msg);
131 * purple_message_get_recipient:
132 * @msg: The message.
134 * Returns the recipient of the message - his screen name (not a local alias).
136 * Returns: the recipient of @msg.
138 const gchar *
139 purple_message_get_recipient(PurpleMessage *msg);
142 * purple_message_set_author_alias:
143 * @msg: The message.
144 * @alias: The alias.
146 * Sets the alias of @msg's author. You don't normally need to call this.
148 void
149 purple_message_set_author_alias(PurpleMessage *msg, const gchar *alias);
152 * purple_message_get_author_alias:
153 * @msg: The message.
155 * Returns the alias of @msg author.
157 * Returns: the @msg author's alias.
159 const gchar *
160 purple_message_get_author_alias(PurpleMessage *msg);
163 * purple_message_set_contents:
164 * @msg: The message.
165 * @cont: The contents.
167 * Sets the contents of the @msg. It might be HTML.
169 void
170 purple_message_set_contents(PurpleMessage *msg, const gchar *cont);
173 * purple_message_get_contents:
174 * @msg: The message.
176 * Returns the contents of the message.
178 * Returns: the contents of @msg.
180 const gchar *
181 purple_message_get_contents(PurpleMessage *msg);
184 * purple_message_is_empty:
185 * @msg: The message.
187 * Checks, if the message's body is empty.
189 * Returns: %TRUE, if @msg is empty.
191 gboolean
192 purple_message_is_empty(PurpleMessage *msg);
195 * purple_message_set_time:
196 * @msg: The message.
197 * @msgtime: The timestamp of a message.
199 * Sets the @msg's timestamp. It should be a date of posting, but it can be
200 * a date of receiving (if the former is not available).
202 void
203 purple_message_set_time(PurpleMessage *msg, guint64 msgtime);
206 * purple_message_get_time:
207 * @msg: The message.
209 * Returns a @msg's timestamp.
211 * Returns: @msg's timestamp.
213 guint64
214 purple_message_get_time(PurpleMessage *msg);
217 * purple_message_set_flags:
218 * @msg: The message.
219 * @flags: The message flags.
221 * Sets flags for @msg. It shouldn't be in a conflict with a message type,
222 * so use it carefully.
224 void
225 purple_message_set_flags(PurpleMessage *msg, PurpleMessageFlags flags);
228 * purple_message_get_flags:
229 * @msg: The message.
231 * Returns the flags of a @msg.
233 * Returns: the flags of a @msg.
235 PurpleMessageFlags
236 purple_message_get_flags(PurpleMessage *msg);
238 G_END_DECLS
240 #endif /* PURPLE_MESSAGE_H */