Frameworks/libpurple.framework/Versions/0.6.2/Headers/notify.h
author Zachary West <zacw@adium.im>
Fri Aug 21 13:25:11 2009 -0700 (2009-08-21)
changeset 2592 e8d15275025e
parent 2504 Frameworks/libpurple.framework/Versions/0.6.0/Headers/notify.h@97ec2ce929ec
permissions -rw-r--r--
im.pidgin.adium.1-4 at 267c6165e02e34318a1823960bd04c0639952f73
Evan@653
     1
/**
Evan@653
     2
 * @file notify.h Notification API
Evan@653
     3
 * @ingroup core
Evan@653
     4
 * @see @ref notify-signals
Evan@653
     5
 */
Evan@653
     6
Evan@653
     7
/* purple
Evan@653
     8
 *
Evan@653
     9
 * Purple is the legal property of its developers, whose names are too numerous
Evan@653
    10
 * to list here.  Please refer to the COPYRIGHT file distributed with this
Evan@653
    11
 * source distribution.
Evan@653
    12
 *
Evan@653
    13
 * This program is free software; you can redistribute it and/or modify
Evan@653
    14
 * it under the terms of the GNU General Public License as published by
Evan@653
    15
 * the Free Software Foundation; either version 2 of the License, or
Evan@653
    16
 * (at your option) any later version.
Evan@653
    17
 *
Evan@653
    18
 * This program is distributed in the hope that it will be useful,
Evan@653
    19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Evan@653
    20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Evan@653
    21
 * GNU General Public License for more details.
Evan@653
    22
 *
Evan@653
    23
 * You should have received a copy of the GNU General Public License
Evan@653
    24
 * along with this program; if not, write to the Free Software
Evan@653
    25
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
Evan@653
    26
 */
Evan@653
    27
#ifndef _PURPLE_NOTIFY_H_
Evan@653
    28
#define _PURPLE_NOTIFY_H_
Evan@653
    29
Evan@653
    30
#include <stdlib.h>
Evan@653
    31
#include <glib-object.h>
Evan@653
    32
#include <glib.h>
Evan@653
    33
Evan@653
    34
typedef struct _PurpleNotifyUserInfoEntry	PurpleNotifyUserInfoEntry;
Evan@653
    35
typedef struct _PurpleNotifyUserInfo	PurpleNotifyUserInfo;
Evan@653
    36
Evan@653
    37
#include "connection.h"
Evan@653
    38
Evan@653
    39
/**
Evan@653
    40
 * Notification close callbacks.
Evan@653
    41
 */
Evan@653
    42
typedef void  (*PurpleNotifyCloseCallback) (gpointer user_data);
Evan@653
    43
Evan@653
    44
Evan@653
    45
/**
Evan@653
    46
 * Notification types.
Evan@653
    47
 */
Evan@653
    48
typedef enum
Evan@653
    49
{
Evan@653
    50
	PURPLE_NOTIFY_MESSAGE = 0,   /**< Message notification.         */
Evan@653
    51
	PURPLE_NOTIFY_EMAIL,         /**< Single email notification.   */
Evan@653
    52
	PURPLE_NOTIFY_EMAILS,        /**< Multiple email notification. */
Evan@653
    53
	PURPLE_NOTIFY_FORMATTED,     /**< Formatted text.               */
Evan@653
    54
	PURPLE_NOTIFY_SEARCHRESULTS, /**< Buddy search results.         */
Evan@653
    55
	PURPLE_NOTIFY_USERINFO,      /**< Formatted userinfo text.      */
Evan@653
    56
	PURPLE_NOTIFY_URI            /**< URI notification or display.  */
Evan@653
    57
Evan@653
    58
} PurpleNotifyType;
Evan@653
    59
Evan@653
    60
Evan@653
    61
/**
Evan@653
    62
 * Notification message types.
Evan@653
    63
 */
Evan@653
    64
typedef enum
Evan@653
    65
{
Evan@653
    66
	PURPLE_NOTIFY_MSG_ERROR   = 0, /**< Error notification.       */
Evan@653
    67
	PURPLE_NOTIFY_MSG_WARNING,     /**< Warning notification.     */
Evan@653
    68
	PURPLE_NOTIFY_MSG_INFO         /**< Information notification. */
Evan@653
    69
Evan@653
    70
} PurpleNotifyMsgType;
Evan@653
    71
Evan@653
    72
Evan@653
    73
/**
Evan@653
    74
 * The types of buttons
Evan@653
    75
 */
Evan@653
    76
typedef enum
Evan@653
    77
{
Evan@653
    78
	PURPLE_NOTIFY_BUTTON_LABELED = 0,  /**< special use, see _button_add_labeled */
Evan@653
    79
	PURPLE_NOTIFY_BUTTON_CONTINUE = 1,
Evan@653
    80
	PURPLE_NOTIFY_BUTTON_ADD,
Evan@653
    81
	PURPLE_NOTIFY_BUTTON_INFO,
Evan@653
    82
	PURPLE_NOTIFY_BUTTON_IM,
Evan@653
    83
	PURPLE_NOTIFY_BUTTON_JOIN,
Evan@653
    84
	PURPLE_NOTIFY_BUTTON_INVITE
Evan@653
    85
} PurpleNotifySearchButtonType;
Evan@653
    86
Evan@653
    87
Evan@653
    88
/**
Evan@653
    89
 * Search results object.
Evan@653
    90
 */
Evan@653
    91
typedef struct
Evan@653
    92
{
Evan@653
    93
	GList *columns;        /**< List of the search column objects. */
Evan@653
    94
	GList *rows;           /**< List of rows in the result. */
Evan@653
    95
	GList *buttons;        /**< List of buttons to display. */
Evan@653
    96
Evan@653
    97
} PurpleNotifySearchResults;
Evan@653
    98
Evan@653
    99
/**
Evan@653
   100
 * Types of PurpleNotifyUserInfoEntry objects
Evan@653
   101
 */
Evan@653
   102
typedef enum
Evan@653
   103
{
Evan@653
   104
	PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR = 0,
Evan@653
   105
	PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK,
Evan@653
   106
	PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER
Evan@653
   107
} PurpleNotifyUserInfoEntryType;
Evan@653
   108
Evan@653
   109
/**
Evan@653
   110
 * Single column of a search result.
Evan@653
   111
 */
Evan@653
   112
typedef struct
Evan@653
   113
{
Evan@653
   114
	char *title; /**< Title of the column. */
Evan@653
   115
Evan@653
   116
} PurpleNotifySearchColumn;
Evan@653
   117
Evan@653
   118
Evan@653
   119
/**
Evan@653
   120
 * Callback for a button in a search result.
Evan@653
   121
 *
Evan@653
   122
 * @param c         the PurpleConnection passed to purple_notify_searchresults
Evan@653
   123
 * @param row       the contents of the selected row
Evan@653
   124
 * @param user_data User defined data.
Evan@653
   125
 */
Evan@653
   126
typedef void (*PurpleNotifySearchResultsCallback)(PurpleConnection *c, GList *row,
Evan@653
   127
												gpointer user_data);
Evan@653
   128
Evan@653
   129
Evan@653
   130
/**
Evan@653
   131
 * Definition of a button.
Evan@653
   132
 */
Evan@653
   133
typedef struct
Evan@653
   134
{
Evan@653
   135
	PurpleNotifySearchButtonType type;
Evan@653
   136
	PurpleNotifySearchResultsCallback callback; /**< Function to be called when clicked. */
Evan@653
   137
	char *label;                              /**< only for PURPLE_NOTIFY_BUTTON_LABELED */
Evan@653
   138
} PurpleNotifySearchButton;
Evan@653
   139
Evan@653
   140
Evan@653
   141
/**
Evan@653
   142
 * Notification UI operations.
Evan@653
   143
 */
Evan@653
   144
typedef struct
Evan@653
   145
{
Evan@653
   146
	void *(*notify_message)(PurpleNotifyMsgType type, const char *title,
Evan@653
   147
	                        const char *primary, const char *secondary);
Evan@653
   148
Evan@653
   149
	void *(*notify_email)(PurpleConnection *gc,
Evan@653
   150
	                      const char *subject, const char *from,
Evan@653
   151
	                      const char *to, const char *url);
Evan@653
   152
Evan@653
   153
	void *(*notify_emails)(PurpleConnection *gc,
Evan@653
   154
	                       size_t count, gboolean detailed,
Evan@653
   155
	                       const char **subjects, const char **froms,
Evan@653
   156
	                       const char **tos, const char **urls);
Evan@653
   157
Evan@653
   158
	void *(*notify_formatted)(const char *title, const char *primary,
Evan@653
   159
	                          const char *secondary, const char *text);
Evan@653
   160
Evan@653
   161
	void *(*notify_searchresults)(PurpleConnection *gc, const char *title,
Evan@653
   162
	                              const char *primary, const char *secondary,
Evan@653
   163
	                              PurpleNotifySearchResults *results, gpointer user_data);
Evan@653
   164
Evan@653
   165
	void (*notify_searchresults_new_rows)(PurpleConnection *gc,
Evan@653
   166
	                                      PurpleNotifySearchResults *results,
Evan@653
   167
	                                      void *data);
Evan@653
   168
Evan@653
   169
	void *(*notify_userinfo)(PurpleConnection *gc, const char *who,
Evan@653
   170
	                         PurpleNotifyUserInfo *user_info);
Evan@653
   171
Evan@653
   172
	void *(*notify_uri)(const char *uri);
Evan@653
   173
Evan@653
   174
	void (*close_notify)(PurpleNotifyType type, void *ui_handle);
Evan@653
   175
Evan@653
   176
	void (*_purple_reserved1)(void);
Evan@653
   177
	void (*_purple_reserved2)(void);
Evan@653
   178
	void (*_purple_reserved3)(void);
Evan@653
   179
	void (*_purple_reserved4)(void);
Evan@653
   180
} PurpleNotifyUiOps;
Evan@653
   181
Evan@653
   182
Evan@653
   183
#ifdef __cplusplus
Evan@653
   184
extern "C" {
Evan@653
   185
#endif
Evan@653
   186
Evan@653
   187
Evan@653
   188
/**************************************************************************/
Evan@653
   189
/** Search results notification API                                       */
Evan@653
   190
/**************************************************************************/
Evan@653
   191
/*@{*/
Evan@653
   192
Evan@653
   193
/**
Evan@653
   194
 * Displays results from a buddy search.  This can be, for example,
Evan@653
   195
 * a window with a list of all found buddies, where you are given the
Evan@653
   196
 * option of adding buddies to your buddy list.
Evan@653
   197
 *
Evan@653
   198
 * @param gc        The PurpleConnection handle associated with the information.
Evan@653
   199
 * @param title     The title of the message.  If this is NULL, the title
Evan@653
   200
 *                  will be "Search Results."
Evan@653
   201
 * @param primary   The main point of the message.
Evan@653
   202
 * @param secondary The secondary information.
Evan@653
   203
 * @param results   The PurpleNotifySearchResults instance.
Evan@653
   204
 * @param cb        The callback to call when the user closes
Evan@653
   205
 *                  the notification.
Evan@653
   206
 * @param user_data The data to pass to the close callback and any other
Evan@653
   207
 *                  callback associated with a button.
Evan@653
   208
 *
Evan@653
   209
 * @return A UI-specific handle.
Evan@653
   210
 */
Evan@653
   211
void *purple_notify_searchresults(PurpleConnection *gc, const char *title,
Evan@653
   212
								const char *primary, const char *secondary,
Evan@653
   213
								PurpleNotifySearchResults *results, PurpleNotifyCloseCallback cb,
Evan@653
   214
								gpointer user_data);
Evan@653
   215
Evan@653
   216
/**
Evan@653
   217
 * Frees a PurpleNotifySearchResults object.
Evan@653
   218
 *
Evan@653
   219
 * @param results The PurpleNotifySearchResults to free.
Evan@653
   220
 */
Evan@653
   221
void purple_notify_searchresults_free(PurpleNotifySearchResults *results);
Evan@653
   222
Evan@653
   223
/**
Evan@653
   224
 * Replace old rows with the new. Reuse an existing window.
Evan@653
   225
 *
Evan@653
   226
 * @param gc        The PurpleConnection structure.
Evan@653
   227
 * @param results   The PurpleNotifySearchResults structure.
Evan@653
   228
 * @param data      Data returned by the purple_notify_searchresults().
Evan@653
   229
 */
Evan@653
   230
void purple_notify_searchresults_new_rows(PurpleConnection *gc,
Evan@653
   231
										PurpleNotifySearchResults *results,
Evan@653
   232
										void *data);
Evan@653
   233
Evan@653
   234
Evan@653
   235
/**
Evan@653
   236
 * Adds a stock button that will be displayed in the search results dialog.
Evan@653
   237
 *
Evan@653
   238
 * @param results The search results object.
Evan@653
   239
 * @param type    Type of the button. (TODO: Only one button of a given type
Evan@653
   240
 *                can be displayed.)
Evan@653
   241
 * @param cb      Function that will be called on the click event.
Evan@653
   242
 */
Evan@653
   243
void purple_notify_searchresults_button_add(PurpleNotifySearchResults *results,
Evan@653
   244
										  PurpleNotifySearchButtonType type,
Evan@653
   245
										  PurpleNotifySearchResultsCallback cb);
Evan@653
   246
Evan@653
   247
Evan@653
   248
/**
Evan@653
   249
 * Adds a plain labelled button that will be displayed in the search results
Evan@653
   250
 * dialog.
Evan@653
   251
 *
Evan@653
   252
 * @param results The search results object
Evan@653
   253
 * @param label   The label to display
Evan@653
   254
 * @param cb      Function that will be called on the click event
Evan@653
   255
 */
Evan@653
   256
void purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults *results,
Evan@653
   257
                                                  const char *label,
Evan@653
   258
                                                  PurpleNotifySearchResultsCallback cb);
Evan@653
   259
Evan@653
   260
Evan@653
   261
/**
Evan@653
   262
 * Returns a newly created search results object.
Evan@653
   263
 *
Evan@653
   264
 * @return The new search results object.
Evan@653
   265
 */
Evan@653
   266
PurpleNotifySearchResults *purple_notify_searchresults_new(void);
Evan@653
   267
Evan@653
   268
/**
Evan@653
   269
 * Returns a newly created search result column object.
Evan@653
   270
 *
Evan@653
   271
 * @param title Title of the column. NOTE: Title will get g_strdup()ed.
Evan@653
   272
 *
Evan@653
   273
 * @return The new search column object.
Evan@653
   274
 */
Evan@653
   275
PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title);
Evan@653
   276
Evan@653
   277
/**
Evan@653
   278
 * Adds a new column to the search result object.
Evan@653
   279
 *
Evan@653
   280
 * @param results The result object to which the column will be added.
Evan@653
   281
 * @param column The column that will be added to the result object.
Evan@653
   282
 */
Evan@653
   283
void purple_notify_searchresults_column_add(PurpleNotifySearchResults *results,
Evan@653
   284
										  PurpleNotifySearchColumn *column);
Evan@653
   285
Evan@653
   286
/**
Evan@653
   287
 * Adds a new row of the results to the search results object.
Evan@653
   288
 *
Evan@653
   289
 * @param results The search results object.
Evan@653
   290
 * @param row     The row of the results.
Evan@653
   291
 */
Evan@653
   292
void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results,
Evan@653
   293
									   GList *row);
Evan@1427
   294
Evan@653
   295
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
Evan@653
   296
/**
Evan@653
   297
 * Returns a number of the rows in the search results object.
Evan@653
   298
 *
Evan@653
   299
 * @deprecated This function will be removed in Pidgin 3.0.0 unless
Evan@653
   300
 *             there is sufficient demand to keep it.  Using this
Evan@653
   301
 *             function encourages looping through the results
Evan@653
   302
 *             inefficiently.  Instead of using this function you
Evan@653
   303
 *             should iterate through the results using a loop
Evan@653
   304
 *             similar to this:
Evan@653
   305
 *                for (l = results->rows; l != NULL; l = l->next)
Evan@653
   306
 *             If you really need to get the number of rows you
Evan@653
   307
 *             can use g_list_length(results->rows).
Evan@653
   308
 *
Evan@653
   309
 * @param results The search results object.
Evan@653
   310
 *
Evan@653
   311
 * @return Number of the result rows.
Evan@653
   312
 */
Evan@653
   313
guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results);
Evan@653
   314
#endif
Evan@653
   315
Evan@653
   316
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
Evan@653
   317
/**
Evan@653
   318
 * Returns a number of the columns in the search results object.
Evan@653
   319
 *
Evan@653
   320
 * @deprecated This function will be removed in Pidgin 3.0.0 unless
Evan@653
   321
 *             there is sufficient demand to keep it.  Using this
Evan@653
   322
 *             function encourages looping through the columns
Evan@653
   323
 *             inefficiently.  Instead of using this function you
Evan@653
   324
 *             should iterate through the columns using a loop
Evan@653
   325
 *             similar to this:
Evan@653
   326
 *                for (l = results->columns; l != NULL; l = l->next)
Evan@653
   327
 *             If you really need to get the number of columns you
Evan@653
   328
 *             can use g_list_length(results->columns).
Evan@653
   329
 *
Evan@653
   330
 * @param results The search results object.
Evan@653
   331
 *
Evan@653
   332
 * @return Number of the columns.
Evan@653
   333
 */
Evan@653
   334
guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results);
Evan@653
   335
#endif
Evan@653
   336
Evan@653
   337
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
Evan@653
   338
/**
Evan@653
   339
 * Returns a row of the results from the search results object.
Evan@653
   340
 *
Evan@653
   341
 * @deprecated This function will be removed in Pidgin 3.0.0 unless
Evan@653
   342
 *             there is sufficient demand to keep it.  Using this
Evan@653
   343
 *             function encourages looping through the results
Evan@653
   344
 *             inefficiently.  Instead of using this function you
Evan@653
   345
 *             should iterate through the results using a loop
Evan@653
   346
 *             similar to this:
Evan@653
   347
 *                for (l = results->rows; l != NULL; l = l->next)
Evan@653
   348
 *             If you really need to get the data for a particular
Evan@653
   349
 *             row you can use g_list_nth_data(results->rows, row_id).
Evan@653
   350
 *
Evan@653
   351
 * @param results The search results object.
Evan@653
   352
 * @param row_id  Index of the row to be returned.
Evan@653
   353
 *
Evan@653
   354
 * @return Row of the results.
Evan@653
   355
 */
Evan@653
   356
GList *purple_notify_searchresults_row_get(PurpleNotifySearchResults *results,
Evan@653
   357
										 unsigned int row_id);
Evan@653
   358
#endif
Evan@653
   359
Evan@653
   360
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
Evan@653
   361
/**
Evan@653
   362
 * Returns a title of the search results object's column.
Evan@653
   363
 *
Evan@653
   364
 * @deprecated This function will be removed in Pidgin 3.0.0 unless
Evan@653
   365
 *             there is sufficient demand to keep it.  Using this
Evan@653
   366
 *             function encourages looping through the columns
Evan@653
   367
 *             inefficiently.  Instead of using this function you
Evan@653
   368
 *             should iterate through the name of a particular
Evan@653
   369
 *             column you can use
Evan@653
   370
 *             g_list_nth_data(results->columns, row_id).
Evan@653
   371
 *
Evan@653
   372
 * @param results   The search results object.
Evan@653
   373
 * @param column_id Index of the column.
Evan@653
   374
 *
Evan@653
   375
 * @return Title of the column.
Evan@653
   376
 */
Evan@653
   377
char *purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results,
Evan@653
   378
												 unsigned int column_id);
Evan@653
   379
#endif
Evan@653
   380
Evan@653
   381
/*@}*/
Evan@653
   382
Evan@653
   383
/**************************************************************************/
Evan@653
   384
/** @name Notification API                                                */
Evan@653
   385
/**************************************************************************/
Evan@653
   386
/*@{*/
Evan@653
   387
Evan@653
   388
/**
Evan@653
   389
 * Displays a notification message to the user.
Evan@653
   390
 *
Evan@653
   391
 * @param handle    The plugin or connection handle.
Evan@653
   392
 * @param type      The notification type.
Evan@653
   393
 * @param title     The title of the message.
Evan@653
   394
 * @param primary   The main point of the message.
Evan@653
   395
 * @param secondary The secondary information.
Evan@653
   396
 * @param cb        The callback to call when the user closes
Evan@653
   397
 *                  the notification.
Evan@653
   398
 * @param user_data The data to pass to the callback.
Evan@653
   399
 *
Evan@653
   400
 * @return A UI-specific handle.
Evan@653
   401
 */
Evan@653
   402
void *purple_notify_message(void *handle, PurpleNotifyMsgType type,
Evan@653
   403
						  const char *title, const char *primary,
Evan@653
   404
						  const char *secondary, PurpleNotifyCloseCallback cb,
Evan@653
   405
						  gpointer user_data);
Evan@653
   406
Evan@653
   407
/**
Evan@653
   408
 * Displays a single email notification to the user.
Evan@653
   409
 *
Evan@653
   410
 * @param handle    The plugin or connection handle.
Evan@653
   411
 * @param subject   The subject of the email.
Evan@653
   412
 * @param from      The from address.
Evan@653
   413
 * @param to        The destination address.
Evan@653
   414
 * @param url       The URL where the message can be read.
Evan@653
   415
 * @param cb        The callback to call when the user closes
Evan@653
   416
 *                  the notification.
Evan@653
   417
 * @param user_data The data to pass to the callback.
Evan@653
   418
 *
Evan@653
   419
 * @return A UI-specific handle.
Evan@653
   420
 */
Evan@653
   421
void *purple_notify_email(void *handle, const char *subject,
Evan@653
   422
						const char *from, const char *to,
Evan@653
   423
						const char *url, PurpleNotifyCloseCallback cb,
Evan@653
   424
						gpointer user_data);
Evan@653
   425
Evan@653
   426
/**
Evan@653
   427
 * Displays a notification for multiple emails to the user.
Evan@653
   428
 *
Evan@653
   429
 * @param handle    The plugin or connection handle.
zacw@2504
   430
 * @param count     The number of emails.  '0' can be used to signify that
zacw@2504
   431
 *                  the user has no unread emails and the UI should remove
zacw@2504
   432
 *                  the mail notification.
Evan@653
   433
 * @param detailed  @c TRUE if there is information for each email in the
Evan@653
   434
 *                  arrays.
Evan@653
   435
 * @param subjects  The array of subjects.
Evan@653
   436
 * @param froms     The array of from addresses.
Evan@653
   437
 * @param tos       The array of destination addresses.
Evan@653
   438
 * @param urls      The URLs where the messages can be read.
Evan@653
   439
 * @param cb        The callback to call when the user closes
Evan@653
   440
 *                  the notification.
Evan@653
   441
 * @param user_data The data to pass to the callback.
Evan@653
   442
 *
Evan@653
   443
 * @return A UI-specific handle.
Evan@653
   444
 */
Evan@653
   445
void *purple_notify_emails(void *handle, size_t count, gboolean detailed,
Evan@653
   446
						 const char **subjects, const char **froms,
Evan@653
   447
						 const char **tos, const char **urls,
Evan@653
   448
						 PurpleNotifyCloseCallback cb, gpointer user_data);
Evan@653
   449
Evan@653
   450
/**
Evan@653
   451
 * Displays a notification with formatted text.
Evan@653
   452
 *
Evan@653
   453
 * The text is essentially a stripped-down format of HTML, the same that
Evan@653
   454
 * IMs may send.
Evan@653
   455
 *
Evan@653
   456
 * @param handle    The plugin or connection handle.
Evan@653
   457
 * @param title     The title of the message.
Evan@653
   458
 * @param primary   The main point of the message.
Evan@653
   459
 * @param secondary The secondary information.
Evan@653
   460
 * @param text      The formatted text.
Evan@653
   461
 * @param cb        The callback to call when the user closes
Evan@653
   462
 *                  the notification.
Evan@653
   463
 * @param user_data The data to pass to the callback.
Evan@653
   464
 *
Evan@653
   465
 * @return A UI-specific handle.
Evan@653
   466
 */
Evan@653
   467
void *purple_notify_formatted(void *handle, const char *title,
Evan@653
   468
							const char *primary, const char *secondary,
Evan@653
   469
							const char *text, PurpleNotifyCloseCallback cb, gpointer user_data);
Evan@653
   470
Evan@653
   471
/**
Evan@653
   472
 * Displays user information with formatted text, passing information giving
Evan@653
   473
 * the connection and username from which the user information came.
Evan@653
   474
 *
Evan@653
   475
 * The text is essentially a stripped-down format of HTML, the same that
Evan@653
   476
 * IMs may send.
Evan@653
   477
 *
Evan@653
   478
 * @param gc         The PurpleConnection handle associated with the information.
Evan@653
   479
 * @param who        The username associated with the information.
Evan@653
   480
 * @param user_info  The PurpleNotifyUserInfo which contains the information
Evan@653
   481
 * @param cb         The callback to call when the user closes the notification.
Evan@653
   482
 * @param user_data  The data to pass to the callback.
Evan@653
   483
 *
Evan@653
   484
 * @return  A UI-specific handle.
Evan@653
   485
 */
Evan@653
   486
void *purple_notify_userinfo(PurpleConnection *gc, const char *who,
Evan@653
   487
						   PurpleNotifyUserInfo *user_info, PurpleNotifyCloseCallback cb,
Evan@653
   488
						   gpointer user_data);
Evan@653
   489
Evan@653
   490
/**
Evan@653
   491
 * Create a new PurpleNotifyUserInfo which is suitable for passing to
Evan@653
   492
 * purple_notify_userinfo()
Evan@653
   493
 *
Evan@653
   494
 * @return  A new PurpleNotifyUserInfo, which the caller must destroy when done
Evan@653
   495
 */
Evan@653
   496
PurpleNotifyUserInfo *purple_notify_user_info_new(void);
Evan@653
   497
Evan@653
   498
/**
Evan@653
   499
 * Destroy a PurpleNotifyUserInfo
Evan@653
   500
 *
Evan@653
   501
 * @param user_info  The PurpleNotifyUserInfo
Evan@653
   502
 */
Evan@653
   503
void purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info);
Evan@653
   504
Evan@653
   505
/**
Evan@653
   506
 * Retrieve the array of PurpleNotifyUserInfoEntry objects from a
Evan@653
   507
 * PurpleNotifyUserInfo
Evan@653
   508
 *
Evan@653
   509
 * This GList may be manipulated directly with normal GList functions such
Evan@653
   510
 * as g_list_insert(). Only PurpleNotifyUserInfoEntry are allowed in the
Evan@653
   511
 * list.  If a PurpleNotifyUserInfoEntry item is added to the list, it
Evan@653
   512
 * should not be g_free()'d by the caller; PurpleNotifyUserInfo will g_free
Evan@653
   513
 * it when destroyed.
Evan@653
   514
 *
Evan@653
   515
 * To remove a PurpleNotifyUserInfoEntry, use
Evan@653
   516
 * purple_notify_user_info_remove_entry(). Do not use the GList directly.
Evan@653
   517
 *
Evan@653
   518
 * @param user_info  The PurpleNotifyUserInfo
Evan@653
   519
 *
Evan@653
   520
 * @constreturn A GList of PurpleNotifyUserInfoEntry objects
Evan@653
   521
 */
Evan@653
   522
GList *purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info);
Evan@653
   523
Evan@653
   524
/**
Evan@653
   525
 * Create a textual representation of a PurpleNotifyUserInfo, separating
Evan@653
   526
 * entries with newline
Evan@653
   527
 *
Evan@653
   528
 * @param user_info  The PurpleNotifyUserInfo
Evan@653
   529
 * @param newline    The separation character
Evan@653
   530
 */
Evan@653
   531
char *purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline);
Evan@653
   532
Evan@653
   533
/**
Evan@653
   534
 * Add a label/value pair to a PurpleNotifyUserInfo object.
Evan@653
   535
 * PurpleNotifyUserInfo keeps track of the order in which pairs are added.
Evan@653
   536
 *
Evan@653
   537
 * @param user_info  The PurpleNotifyUserInfo
Evan@653
   538
 * @param label      A label, which for example might be displayed by a
Evan@653
   539
 *                   UI with a colon after it ("Status:"). Do not include
Evan@653
   540
 *                   a colon.  If NULL, value will be displayed without a
Evan@653
   541
 *                   label.
Evan@653
   542
 * @param value      The value, which might be displayed by a UI after
Evan@653
   543
 *                   the label.  If NULL, label will still be displayed;
Evan@653
   544
 *                   the UI should then treat label as independent and not
Evan@653
   545
 *                   include a colon if it would otherwise.
Evan@653
   546
 */
Evan@653
   547
void purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
Evan@653
   548
Evan@653
   549
/**
Evan@653
   550
 * Prepend a label/value pair to a PurpleNotifyUserInfo object
Evan@653
   551
 *
Evan@653
   552
 * @param user_info  The PurpleNotifyUserInfo
Evan@653
   553
 * @param label      A label, which for example might be displayed by a
Evan@653
   554
 *                   UI with a colon after it ("Status:"). Do not include
Evan@653
   555
 *                   a colon.  If NULL, value will be displayed without a
Evan@653
   556
 *                   label.
Evan@653
   557
 * @param value      The value, which might be displayed by a UI after
Evan@653
   558
 *                   the label.  If NULL, label will still be displayed;
Evan@653
   559
 *                   the UI should then treat label as independent and not
Evan@653
   560
 *                   include a colon if it would otherwise.
Evan@653
   561
 */
Evan@653
   562
void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
Evan@653
   563
Evan@1427
   564
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
Evan@653
   565
/**
Evan@653
   566
 * Remove a PurpleNotifyUserInfoEntry from a PurpleNotifyUserInfo object
Evan@653
   567
 * without freeing the entry.
Evan@653
   568
 *
Evan@653
   569
 * @param user_info        The PurpleNotifyUserInfo
Evan@653
   570
 * @param user_info_entry  The PurpleNotifyUserInfoEntry
Evan@1427
   571
 *
Evan@1427
   572
 * @deprecated Nothing is using this function and it should be removed
Evan@1427
   573
 *             in 3.0.0.  Or, if we decide we want to keep it in 3.0.0
Evan@1427
   574
 *             then we should make purple_notify_user_info_entry_destroy
Evan@1427
   575
 *             public so that entries can be free'd after they're removed.
Evan@653
   576
 */
Evan@653
   577
void purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *user_info_entry);
Evan@1427
   578
#endif
Evan@653
   579
Evan@653
   580
/**
Evan@653
   581
 * Create a new PurpleNotifyUserInfoEntry
Evan@653
   582
 *
Evan@653
   583
 * If added to a PurpleNotifyUserInfo object, this should not be free()'d,
Evan@653
   584
 * as PurpleNotifyUserInfo will do so when destroyed.
Evan@653
   585
 * purple_notify_user_info_add_pair() and
Evan@653
   586
 * purple_notify_user_info_prepend_pair() are convenience methods for
Evan@653
   587
 * creating entries and adding them to a PurpleNotifyUserInfo.
Evan@653
   588
 *
Evan@653
   589
 * @param label  A label, which for example might be displayed by a UI
Evan@653
   590
 *               with a colon after it ("Status:"). Do not include a
Evan@653
   591
 *               colon.  If NULL, value will be displayed without a label.
Evan@653
   592
 * @param value  The value, which might be displayed by a UI after the
Evan@653
   593
 *               label.  If NULL, label will still be displayed; the UI
Evan@653
   594
 *               should then treat label as independent and not include a
Evan@653
   595
 *               colon if it would otherwise.
Evan@653
   596
 *
Evan@653
   597
 * @result A new PurpleNotifyUserInfoEntry
Evan@653
   598
 */
Evan@653
   599
PurpleNotifyUserInfoEntry *purple_notify_user_info_entry_new(const char *label, const char *value);
Evan@653
   600
Evan@653
   601
/**
Evan@653
   602
 * Add a section break.  A UI might display this as a horizontal line.
Evan@653
   603
 *
Evan@653
   604
 * @param user_info  The PurpleNotifyUserInfo
Evan@653
   605
 */
Evan@653
   606
void purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info);
Evan@653
   607
Evan@653
   608
/**
Evan@653
   609
 * Prepend a section break.  A UI might display this as a horizontal line.
Evan@653
   610
 *
Evan@653
   611
 * @param user_info  The PurpleNotifyUserInfo
Evan@653
   612
 * @since 2.5.0
Evan@653
   613
 */
Evan@653
   614
void purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info);
Evan@653
   615
Evan@653
   616
/**
Evan@653
   617
 * Add a section header.  A UI might display this in a different font
Evan@653
   618
 * from other text.
Evan@653
   619
 *
Evan@653
   620
 * @param user_info  The PurpleNotifyUserInfo
Evan@653
   621
 * @param label      The name of the section
Evan@653
   622
 */
Evan@653
   623
void purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label);
Evan@653
   624
Evan@653
   625
/**
Evan@653
   626
 * Prepend a section header.  A UI might display this in a different font
Evan@653
   627
 * from other text.
Evan@653
   628
 *
Evan@653
   629
 * @param user_info  The PurpleNotifyUserInfo
Evan@653
   630
 * @param label      The name of the section
Evan@653
   631
 * @since 2.5.0
Evan@653
   632
 */
Evan@653
   633
void purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label);
Evan@653
   634
Evan@653
   635
/**
Evan@653
   636
 * Remove the last item which was added to a PurpleNotifyUserInfo. This
Evan@653
   637
 * could be used to remove a section header which is not needed.
Evan@653
   638
 */
Evan@653
   639
void purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info);
Evan@653
   640
Evan@653
   641
/**
Evan@653
   642
 * Get the label for a PurpleNotifyUserInfoEntry
Evan@653
   643
 *
Evan@653
   644
 * @param user_info_entry  The PurpleNotifyUserInfoEntry
Evan@653
   645
 *
Evan@653
   646
 * @return  The label
Evan@653
   647
 */
Evan@653
   648
const gchar *purple_notify_user_info_entry_get_label(PurpleNotifyUserInfoEntry *user_info_entry);
Evan@653
   649
Evan@653
   650
/**
Evan@653
   651
 * Set the label for a PurpleNotifyUserInfoEntry
Evan@653
   652
 *
Evan@653
   653
 * @param user_info_entry  The PurpleNotifyUserInfoEntry
Evan@653
   654
 * @param label            The label
Evan@653
   655
 */
Evan@653
   656
void purple_notify_user_info_entry_set_label(PurpleNotifyUserInfoEntry *user_info_entry, const char *label);
Evan@653
   657
Evan@653
   658
/**
Evan@653
   659
 * Get the value for a PurpleNotifyUserInfoEntry
Evan@653
   660
 *
Evan@653
   661
 * @param user_info_entry  The PurpleNotifyUserInfoEntry
Evan@653
   662
 *
Evan@653
   663
 * @result  The value
Evan@653
   664
 */
Evan@653
   665
const gchar *purple_notify_user_info_entry_get_value(PurpleNotifyUserInfoEntry *user_info_entry);
Evan@653
   666
Evan@653
   667
/**
Evan@653
   668
 * Set the value for a PurpleNotifyUserInfoEntry
Evan@653
   669
 *
Evan@653
   670
 * @param user_info_entry  The PurpleNotifyUserInfoEntry
Evan@653
   671
 * @param value            The value
Evan@653
   672
 */
Evan@653
   673
void purple_notify_user_info_entry_set_value(PurpleNotifyUserInfoEntry *user_info_entry, const char *value);
Evan@653
   674
Evan@653
   675
Evan@653
   676
/**
Evan@653
   677
 * Get the type of a PurpleNotifyUserInfoEntry
Evan@653
   678
 *
Evan@653
   679
 * @param user_info_entry  The PurpleNotifyUserInfoEntry
Evan@653
   680
 *
Evan@653
   681
 * @return  The PurpleNotifyUserInfoEntryType
Evan@653
   682
 */
Evan@653
   683
PurpleNotifyUserInfoEntryType purple_notify_user_info_entry_get_type(PurpleNotifyUserInfoEntry *user_info_entry);
Evan@653
   684
Evan@653
   685
/**
Evan@653
   686
 * Set the type of a PurpleNotifyUserInfoEntry
Evan@653
   687
 *
Evan@653
   688
 * @param user_info_entry  The PurpleNotifyUserInfoEntry
Evan@653
   689
 * @param type             The PurpleNotifyUserInfoEntryType
Evan@653
   690
 */
Evan@653
   691
void purple_notify_user_info_entry_set_type(PurpleNotifyUserInfoEntry *user_info_entry,
Evan@653
   692
										  PurpleNotifyUserInfoEntryType type);
Evan@653
   693
Evan@653
   694
/**
Evan@653
   695
 * Opens a URI or somehow presents it to the user.
Evan@653
   696
 *
Evan@653
   697
 * @param handle The plugin or connection handle.
Evan@653
   698
 * @param uri    The URI to display or go to.
Evan@653
   699
 *
Evan@653
   700
 * @return A UI-specific handle, if any. This may only be presented if
Evan@653
   701
 *         the UI code displays a dialog instead of a webpage, or something
Evan@653
   702
 *         similar.
Evan@653
   703
 */
Evan@653
   704
void *purple_notify_uri(void *handle, const char *uri);
Evan@653
   705
Evan@653
   706
/**
Evan@653
   707
 * Closes a notification.
Evan@653
   708
 *
Evan@653
   709
 * This should be used only by the UI operation functions and part of the
Evan@653
   710
 * core.
Evan@653
   711
 *
Evan@653
   712
 * @param type      The notification type.
Evan@653
   713
 * @param ui_handle The notification UI handle.
Evan@653
   714
 */
Evan@653
   715
void purple_notify_close(PurpleNotifyType type, void *ui_handle);
Evan@653
   716
Evan@653
   717
/**
Evan@653
   718
 * Closes all notifications registered with the specified handle.
Evan@653
   719
 *
Evan@653
   720
 * @param handle The handle.
Evan@653
   721
 */
Evan@653
   722
void purple_notify_close_with_handle(void *handle);
Evan@653
   723
Evan@653
   724
/**
Evan@653
   725
 * A wrapper for purple_notify_message that displays an information message.
Evan@653
   726
 */
Evan@653
   727
#define purple_notify_info(handle, title, primary, secondary) \
Evan@653
   728
	purple_notify_message((handle), PURPLE_NOTIFY_MSG_INFO, (title), \
Evan@653
   729
						(primary), (secondary), NULL, NULL)
Evan@653
   730
Evan@653
   731
/**
Evan@653
   732
 * A wrapper for purple_notify_message that displays a warning message.
Evan@653
   733
 */
Evan@653
   734
#define purple_notify_warning(handle, title, primary, secondary) \
Evan@653
   735
	purple_notify_message((handle), PURPLE_NOTIFY_MSG_WARNING, (title), \
Evan@653
   736
						(primary), (secondary), NULL, NULL)
Evan@653
   737
Evan@653
   738
/**
Evan@653
   739
 * A wrapper for purple_notify_message that displays an error message.
Evan@653
   740
 */
Evan@653
   741
#define purple_notify_error(handle, title, primary, secondary) \
Evan@653
   742
	purple_notify_message((handle), PURPLE_NOTIFY_MSG_ERROR, (title), \
Evan@653
   743
						(primary), (secondary), NULL, NULL)
Evan@653
   744
Evan@653
   745
/*@}*/
Evan@653
   746
Evan@653
   747
/**************************************************************************/
Evan@653
   748
/** @name UI Registration Functions                                       */
Evan@653
   749
/**************************************************************************/
Evan@653
   750
/*@{*/
Evan@653
   751
Evan@653
   752
/**
Evan@653
   753
 * Sets the UI operations structure to be used when displaying a
Evan@653
   754
 * notification.
Evan@653
   755
 *
Evan@653
   756
 * @param ops The UI operations structure.
Evan@653
   757
 */
Evan@653
   758
void purple_notify_set_ui_ops(PurpleNotifyUiOps *ops);
Evan@653
   759
Evan@653
   760
/**
Evan@653
   761
 * Returns the UI operations structure to be used when displaying a
Evan@653
   762
 * notification.
Evan@653
   763
 *
Evan@653
   764
 * @return The UI operations structure.
Evan@653
   765
 */
Evan@653
   766
PurpleNotifyUiOps *purple_notify_get_ui_ops(void);
Evan@653
   767
Evan@653
   768
/*@}*/
Evan@653
   769
Evan@653
   770
/**************************************************************************/
Evan@653
   771
/** @name Notify Subsystem                                         */
Evan@653
   772
/**************************************************************************/
Evan@653
   773
/*@{*/
Evan@653
   774
Evan@653
   775
/**
Evan@653
   776
 * Returns the notify subsystem handle.
Evan@653
   777
 *
Evan@653
   778
 * @return The notify subsystem handle.
Evan@653
   779
 */
Evan@653
   780
void *purple_notify_get_handle(void);
Evan@653
   781
Evan@653
   782
/**
Evan@653
   783
 * Initializes the notify subsystem.
Evan@653
   784
 */
Evan@653
   785
void purple_notify_init(void);
Evan@653
   786
Evan@653
   787
/**
Evan@653
   788
 * Uninitializes the notify subsystem.
Evan@653
   789
 */
Evan@653
   790
void purple_notify_uninit(void);
Evan@653
   791
Evan@653
   792
/*@}*/
Evan@653
   793
Evan@653
   794
Evan@653
   795
#ifdef __cplusplus
Evan@653
   796
}
Evan@653
   797
#endif
Evan@653
   798
Evan@653
   799
#endif /* _PURPLE_NOTIFY_H_ */