notify.h

Go to the documentation of this file.
00001 
00007 /* purple
00008  *
00009  * Purple is the legal property of its developers, whose names are too numerous
00010  * to list here.  Please refer to the COPYRIGHT file distributed with this
00011  * source distribution.
00012  *
00013  * This program is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation; either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00026  */
00027 #ifndef _PURPLE_NOTIFY_H_
00028 #define _PURPLE_NOTIFY_H_
00029 
00030 #include <stdlib.h>
00031 #include <glib-object.h>
00032 #include <glib.h>
00033 
00034 typedef struct _PurpleNotifyUserInfoEntry   PurpleNotifyUserInfoEntry;
00035 typedef struct _PurpleNotifyUserInfo    PurpleNotifyUserInfo;
00036 
00037 #include "connection.h"
00038 
00042 typedef void  (*PurpleNotifyCloseCallback) (gpointer user_data);
00043 
00044 
00048 typedef enum
00049 {
00050     PURPLE_NOTIFY_MESSAGE = 0,   
00051     PURPLE_NOTIFY_EMAIL,         
00052     PURPLE_NOTIFY_EMAILS,        
00053     PURPLE_NOTIFY_FORMATTED,     
00054     PURPLE_NOTIFY_SEARCHRESULTS, 
00055     PURPLE_NOTIFY_USERINFO,      
00056     PURPLE_NOTIFY_URI            
00058 } PurpleNotifyType;
00059 
00060 
00064 typedef enum
00065 {
00066     PURPLE_NOTIFY_MSG_ERROR   = 0, 
00067     PURPLE_NOTIFY_MSG_WARNING,     
00068     PURPLE_NOTIFY_MSG_INFO         
00070 } PurpleNotifyMsgType;
00071 
00072 
00076 typedef enum
00077 {
00078     PURPLE_NOTIFY_BUTTON_LABELED = 0,  
00079     PURPLE_NOTIFY_BUTTON_CONTINUE = 1,
00080     PURPLE_NOTIFY_BUTTON_ADD,
00081     PURPLE_NOTIFY_BUTTON_INFO,
00082     PURPLE_NOTIFY_BUTTON_IM,
00083     PURPLE_NOTIFY_BUTTON_JOIN,
00084     PURPLE_NOTIFY_BUTTON_INVITE
00085 } PurpleNotifySearchButtonType;
00086 
00087 
00091 typedef struct
00092 {
00093     GList *columns;        
00094     GList *rows;           
00095     GList *buttons;        
00097 } PurpleNotifySearchResults;
00098 
00102 typedef enum
00103 {
00104     PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR = 0,
00105     PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK,
00106     PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER
00107 } PurpleNotifyUserInfoEntryType;
00108 
00112 typedef struct
00113 {
00114     char *title; 
00116 } PurpleNotifySearchColumn;
00117 
00118 
00126 typedef void (*PurpleNotifySearchResultsCallback)(PurpleConnection *c, GList *row,
00127                                                 gpointer user_data);
00128 
00129 
00133 typedef struct
00134 {
00135     PurpleNotifySearchButtonType type;
00136     PurpleNotifySearchResultsCallback callback; 
00137     char *label;                              
00138 } PurpleNotifySearchButton;
00139 
00140 
00144 typedef struct
00145 {
00146     void *(*notify_message)(PurpleNotifyMsgType type, const char *title,
00147                             const char *primary, const char *secondary);
00148 
00149     void *(*notify_email)(PurpleConnection *gc,
00150                           const char *subject, const char *from,
00151                           const char *to, const char *url);
00152 
00153     void *(*notify_emails)(PurpleConnection *gc,
00154                            size_t count, gboolean detailed,
00155                            const char **subjects, const char **froms,
00156                            const char **tos, const char **urls);
00157 
00158     void *(*notify_formatted)(const char *title, const char *primary,
00159                               const char *secondary, const char *text);
00160 
00161     void *(*notify_searchresults)(PurpleConnection *gc, const char *title,
00162                                   const char *primary, const char *secondary,
00163                                   PurpleNotifySearchResults *results, gpointer user_data);
00164 
00165     void (*notify_searchresults_new_rows)(PurpleConnection *gc,
00166                                           PurpleNotifySearchResults *results,
00167                                           void *data);
00168 
00169     void *(*notify_userinfo)(PurpleConnection *gc, const char *who,
00170                              PurpleNotifyUserInfo *user_info);
00171 
00172     void *(*notify_uri)(const char *uri);
00173 
00174     void (*close_notify)(PurpleNotifyType type, void *ui_handle);
00175 
00176     void (*_purple_reserved1)(void);
00177     void (*_purple_reserved2)(void);
00178     void (*_purple_reserved3)(void);
00179     void (*_purple_reserved4)(void);
00180 } PurpleNotifyUiOps;
00181 
00182 
00183 #ifdef __cplusplus
00184 extern "C" {
00185 #endif
00186 
00187 
00188 /**************************************************************************/
00190 /**************************************************************************/
00211 void *purple_notify_searchresults(PurpleConnection *gc, const char *title,
00212                                 const char *primary, const char *secondary,
00213                                 PurpleNotifySearchResults *results, PurpleNotifyCloseCallback cb,
00214                                 gpointer user_data);
00215 
00221 void purple_notify_searchresults_free(PurpleNotifySearchResults *results);
00222 
00230 void purple_notify_searchresults_new_rows(PurpleConnection *gc,
00231                                         PurpleNotifySearchResults *results,
00232                                         void *data);
00233 
00234 
00243 void purple_notify_searchresults_button_add(PurpleNotifySearchResults *results,
00244                                           PurpleNotifySearchButtonType type,
00245                                           PurpleNotifySearchResultsCallback cb);
00246 
00247 
00256 void purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults *results,
00257                                                   const char *label,
00258                                                   PurpleNotifySearchResultsCallback cb);
00259 
00260 
00266 PurpleNotifySearchResults *purple_notify_searchresults_new(void);
00267 
00275 PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title);
00276 
00283 void purple_notify_searchresults_column_add(PurpleNotifySearchResults *results,
00284                                           PurpleNotifySearchColumn *column);
00285 
00292 void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results,
00293                                        GList *row);
00294 
00295 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
00296 
00313 guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results);
00314 #endif
00315 
00316 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
00317 
00334 guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results);
00335 #endif
00336 
00337 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
00338 
00356 GList *purple_notify_searchresults_row_get(PurpleNotifySearchResults *results,
00357                                          unsigned int row_id);
00358 #endif
00359 
00360 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
00361 
00377 char *purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results,
00378                                                  unsigned int column_id);
00379 #endif
00380 
00383 /**************************************************************************/
00385 /**************************************************************************/
00402 void *purple_notify_message(void *handle, PurpleNotifyMsgType type,
00403                           const char *title, const char *primary,
00404                           const char *secondary, PurpleNotifyCloseCallback cb,
00405                           gpointer user_data);
00406 
00421 void *purple_notify_email(void *handle, const char *subject,
00422                         const char *from, const char *to,
00423                         const char *url, PurpleNotifyCloseCallback cb,
00424                         gpointer user_data);
00425 
00445 void *purple_notify_emails(void *handle, size_t count, gboolean detailed,
00446                          const char **subjects, const char **froms,
00447                          const char **tos, const char **urls,
00448                          PurpleNotifyCloseCallback cb, gpointer user_data);
00449 
00467 void *purple_notify_formatted(void *handle, const char *title,
00468                             const char *primary, const char *secondary,
00469                             const char *text, PurpleNotifyCloseCallback cb, gpointer user_data);
00470 
00486 void *purple_notify_userinfo(PurpleConnection *gc, const char *who,
00487                            PurpleNotifyUserInfo *user_info, PurpleNotifyCloseCallback cb,
00488                            gpointer user_data);
00489 
00496 PurpleNotifyUserInfo *purple_notify_user_info_new(void);
00497 
00503 void purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info);
00504 
00522 GList *purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info);
00523 
00531 char *purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline);
00532 
00547 void purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
00548 
00562 void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
00563 
00564 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
00565 
00577 void purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *user_info_entry);
00578 #endif
00579 
00599 PurpleNotifyUserInfoEntry *purple_notify_user_info_entry_new(const char *label, const char *value);
00600 
00606 void purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info);
00607 
00614 void purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info);
00615 
00623 void purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label);
00624 
00633 void purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label);
00634 
00639 void purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info);
00640 
00648 const gchar *purple_notify_user_info_entry_get_label(PurpleNotifyUserInfoEntry *user_info_entry);
00649 
00656 void purple_notify_user_info_entry_set_label(PurpleNotifyUserInfoEntry *user_info_entry, const char *label);
00657 
00665 const gchar *purple_notify_user_info_entry_get_value(PurpleNotifyUserInfoEntry *user_info_entry);
00666 
00673 void purple_notify_user_info_entry_set_value(PurpleNotifyUserInfoEntry *user_info_entry, const char *value);
00674 
00675 
00683 PurpleNotifyUserInfoEntryType purple_notify_user_info_entry_get_type(PurpleNotifyUserInfoEntry *user_info_entry);
00684 
00691 void purple_notify_user_info_entry_set_type(PurpleNotifyUserInfoEntry *user_info_entry,
00692                                           PurpleNotifyUserInfoEntryType type);
00693 
00704 void *purple_notify_uri(void *handle, const char *uri);
00705 
00715 void purple_notify_close(PurpleNotifyType type, void *ui_handle);
00716 
00722 void purple_notify_close_with_handle(void *handle);
00723 
00727 #define purple_notify_info(handle, title, primary, secondary) \
00728     purple_notify_message((handle), PURPLE_NOTIFY_MSG_INFO, (title), \
00729                         (primary), (secondary), NULL, NULL)
00730 
00734 #define purple_notify_warning(handle, title, primary, secondary) \
00735     purple_notify_message((handle), PURPLE_NOTIFY_MSG_WARNING, (title), \
00736                         (primary), (secondary), NULL, NULL)
00737 
00741 #define purple_notify_error(handle, title, primary, secondary) \
00742     purple_notify_message((handle), PURPLE_NOTIFY_MSG_ERROR, (title), \
00743                         (primary), (secondary), NULL, NULL)
00744 
00747 /**************************************************************************/
00749 /**************************************************************************/
00758 void purple_notify_set_ui_ops(PurpleNotifyUiOps *ops);
00759 
00766 PurpleNotifyUiOps *purple_notify_get_ui_ops(void);
00767 
00770 /**************************************************************************/
00772 /**************************************************************************/
00780 void *purple_notify_get_handle(void);
00781 
00785 void purple_notify_init(void);
00786 
00790 void purple_notify_uninit(void);
00791 
00795 #ifdef __cplusplus
00796 }
00797 #endif
00798 
00799 #endif /* _PURPLE_NOTIFY_H_ */