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