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
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
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
36 #include <glib-object.h>
40 #define PURPLE_TYPE_MESSAGE purple_message_get_type()
43 * purple_message_get_type:
45 * Returns: the #GType for a message.
47 G_DECLARE_FINAL_TYPE(PurpleMessage
, purple_message
, PURPLE
, MESSAGE
, GObject
)
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.
62 purple_message_new_outgoing(const gchar
*who
, const gchar
*contents
,
63 PurpleMessageFlags flags
);
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.
79 purple_message_new_incoming(const gchar
*who
, const gchar
*contents
,
80 PurpleMessageFlags flags
, guint64 timestamp
);
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.
94 purple_message_new_system(const gchar
*contents
, PurpleMessageFlags flags
);
97 * purple_message_get_id:
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.
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.
117 purple_message_find_by_id(guint id
);
120 * purple_message_get_author:
123 * Returns the author of the message - his screen name (not a local alias).
125 * Returns: the author of @msg.
128 purple_message_get_author(PurpleMessage
*msg
);
131 * purple_message_get_recipient:
134 * Returns the recipient of the message - his screen name (not a local alias).
136 * Returns: the recipient of @msg.
139 purple_message_get_recipient(PurpleMessage
*msg
);
142 * purple_message_set_author_alias:
146 * Sets the alias of @msg's author. You don't normally need to call this.
149 purple_message_set_author_alias(PurpleMessage
*msg
, const gchar
*alias
);
152 * purple_message_get_author_alias:
155 * Returns the alias of @msg author.
157 * Returns: the @msg author's alias.
160 purple_message_get_author_alias(PurpleMessage
*msg
);
163 * purple_message_set_contents:
165 * @cont: The contents.
167 * Sets the contents of the @msg. It might be HTML.
170 purple_message_set_contents(PurpleMessage
*msg
, const gchar
*cont
);
173 * purple_message_get_contents:
176 * Returns the contents of the message.
178 * Returns: the contents of @msg.
181 purple_message_get_contents(PurpleMessage
*msg
);
184 * purple_message_is_empty:
187 * Checks, if the message's body is empty.
189 * Returns: %TRUE, if @msg is empty.
192 purple_message_is_empty(PurpleMessage
*msg
);
195 * purple_message_set_time:
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).
203 purple_message_set_time(PurpleMessage
*msg
, guint64 msgtime
);
206 * purple_message_get_time:
209 * Returns a @msg's timestamp.
211 * Returns: @msg's timestamp.
214 purple_message_get_time(PurpleMessage
*msg
);
217 * purple_message_set_flags:
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.
225 purple_message_set_flags(PurpleMessage
*msg
, PurpleMessageFlags flags
);
228 * purple_message_get_flags:
231 * Returns the flags of a @msg.
233 * Returns: the flags of a @msg.
236 purple_message_get_flags(PurpleMessage
*msg
);
240 #endif /* PURPLE_MESSAGE_H */