notify.h
Go to the documentation of this file.
/* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#ifndef _PURPLE_NOTIFY_H_
#define _PURPLE_NOTIFY_H_
#include <stdlib.h>
#include <glib-object.h>
#include <glib.h>
typedef struct _PurpleNotifyUserInfoEntry PurpleNotifyUserInfoEntry;
typedef struct _PurpleNotifyUserInfo PurpleNotifyUserInfo;
#include "connection.h"
typedef void (*PurpleNotifyCloseCallback) (gpointer user_data);
typedef enum
{
PURPLE_NOTIFY_MESSAGE = 0,
PURPLE_NOTIFY_EMAIL,
PURPLE_NOTIFY_EMAILS,
PURPLE_NOTIFY_FORMATTED,
PURPLE_NOTIFY_SEARCHRESULTS,
PURPLE_NOTIFY_USERINFO,
PURPLE_NOTIFY_URI
} PurpleNotifyType;
typedef enum
{
PURPLE_NOTIFY_MSG_ERROR = 0,
PURPLE_NOTIFY_MSG_WARNING,
PURPLE_NOTIFY_MSG_INFO
} PurpleNotifyMsgType;
typedef enum
{
PURPLE_NOTIFY_BUTTON_LABELED = 0,
PURPLE_NOTIFY_BUTTON_CONTINUE = 1,
PURPLE_NOTIFY_BUTTON_ADD,
PURPLE_NOTIFY_BUTTON_INFO,
PURPLE_NOTIFY_BUTTON_IM,
PURPLE_NOTIFY_BUTTON_JOIN,
PURPLE_NOTIFY_BUTTON_INVITE
} PurpleNotifySearchButtonType;
typedef struct
{
GList *columns;
GList *rows;
GList *buttons;
} PurpleNotifySearchResults;
typedef enum
{
PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR = 0,
PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK,
PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER
} PurpleNotifyUserInfoEntryType;
typedef struct
{
char *title;
} PurpleNotifySearchColumn;
typedef void (*PurpleNotifySearchResultsCallback)(PurpleConnection *c, GList *row,
gpointer user_data);
typedef struct
{
PurpleNotifySearchButtonType type;
PurpleNotifySearchResultsCallback callback;
char *label;
} PurpleNotifySearchButton;
typedef struct
{
void *(*notify_message)(PurpleNotifyMsgType type, const char *title,
const char *primary, const char *secondary);
void *(*notify_email)(PurpleConnection *gc,
const char *subject, const char *from,
const char *to, const char *url);
void *(*notify_emails)(PurpleConnection *gc,
size_t count, gboolean detailed,
const char **subjects, const char **froms,
const char **tos, const char **urls);
void *(*notify_formatted)(const char *title, const char *primary,
const char *secondary, const char *text);
void *(*notify_searchresults)(PurpleConnection *gc, const char *title,
const char *primary, const char *secondary,
PurpleNotifySearchResults *results, gpointer user_data);
void (*notify_searchresults_new_rows)(PurpleConnection *gc,
PurpleNotifySearchResults *results,
void *data);
void *(*notify_userinfo)(PurpleConnection *gc, const char *who,
PurpleNotifyUserInfo *user_info);
void *(*notify_uri)(const char *uri);
void (*close_notify)(PurpleNotifyType type, void *ui_handle);
void (*_purple_reserved1)(void);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
void (*_purple_reserved4)(void);
} PurpleNotifyUiOps;
#ifdef __cplusplus
extern "C" {
#endif
/**************************************************************************/
/**************************************************************************/
void *purple_notify_searchresults(PurpleConnection *gc, const char *title,
const char *primary, const char *secondary,
PurpleNotifySearchResults *results, PurpleNotifyCloseCallback cb,
gpointer user_data);
void purple_notify_searchresults_free(PurpleNotifySearchResults *results);
void purple_notify_searchresults_new_rows(PurpleConnection *gc,
PurpleNotifySearchResults *results,
void *data);
void purple_notify_searchresults_button_add(PurpleNotifySearchResults *results,
PurpleNotifySearchButtonType type,
PurpleNotifySearchResultsCallback cb);
void purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults *results,
const char *label,
PurpleNotifySearchResultsCallback cb);
PurpleNotifySearchResults *purple_notify_searchresults_new(void);
PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title);
void purple_notify_searchresults_column_add(PurpleNotifySearchResults *results,
PurpleNotifySearchColumn *column);
void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results,
GList *row);
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results);
#endif
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results);
#endif
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
GList *purple_notify_searchresults_row_get(PurpleNotifySearchResults *results,
unsigned int row_id);
#endif
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
char *purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results,
unsigned int column_id);
#endif
/**************************************************************************/
/**************************************************************************/
void *purple_notify_message(void *handle, PurpleNotifyMsgType type,
const char *title, const char *primary,
const char *secondary, PurpleNotifyCloseCallback cb,
gpointer user_data);
void *purple_notify_email(void *handle, const char *subject,
const char *from, const char *to,
const char *url, PurpleNotifyCloseCallback cb,
gpointer user_data);
void *purple_notify_emails(void *handle, size_t count, gboolean detailed,
const char **subjects, const char **froms,
const char **tos, const char **urls,
PurpleNotifyCloseCallback cb, gpointer user_data);
void *purple_notify_formatted(void *handle, const char *title,
const char *primary, const char *secondary,
const char *text, PurpleNotifyCloseCallback cb, gpointer user_data);
void *purple_notify_userinfo(PurpleConnection *gc, const char *who,
PurpleNotifyUserInfo *user_info, PurpleNotifyCloseCallback cb,
gpointer user_data);
PurpleNotifyUserInfo *purple_notify_user_info_new(void);
void purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info);
GList *purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info);
char *purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline);
/*
* TODO: In 3.0.0 this function should be renamed to
* purple_notify_user_info_add_pair_html(). And optionally
* purple_notify_user_info_add_pair_plaintext() could be renamed to
* purple_notify_user_info_add_pair().
*/
void purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
void purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
void purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *user_info_entry);
#endif
PurpleNotifyUserInfoEntry *purple_notify_user_info_entry_new(const char *label, const char *value);
void purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info);
void purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info);
void purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label);
void purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label);
void purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info);
const gchar *purple_notify_user_info_entry_get_label(PurpleNotifyUserInfoEntry *user_info_entry);
void purple_notify_user_info_entry_set_label(PurpleNotifyUserInfoEntry *user_info_entry, const char *label);
const gchar *purple_notify_user_info_entry_get_value(PurpleNotifyUserInfoEntry *user_info_entry);
void purple_notify_user_info_entry_set_value(PurpleNotifyUserInfoEntry *user_info_entry, const char *value);
PurpleNotifyUserInfoEntryType purple_notify_user_info_entry_get_type(PurpleNotifyUserInfoEntry *user_info_entry);
void purple_notify_user_info_entry_set_type(PurpleNotifyUserInfoEntry *user_info_entry,
PurpleNotifyUserInfoEntryType type);
void *purple_notify_uri(void *handle, const char *uri);
void purple_notify_close(PurpleNotifyType type, void *ui_handle);
void purple_notify_close_with_handle(void *handle);
#define purple_notify_info(handle, title, primary, secondary) \
purple_notify_message((handle), PURPLE_NOTIFY_MSG_INFO, (title), \
(primary), (secondary), NULL, NULL)
#define purple_notify_warning(handle, title, primary, secondary) \
purple_notify_message((handle), PURPLE_NOTIFY_MSG_WARNING, (title), \
(primary), (secondary), NULL, NULL)
#define purple_notify_error(handle, title, primary, secondary) \
purple_notify_message((handle), PURPLE_NOTIFY_MSG_ERROR, (title), \
(primary), (secondary), NULL, NULL)
/**************************************************************************/
/**************************************************************************/
void purple_notify_set_ui_ops(PurpleNotifyUiOps *ops);
PurpleNotifyUiOps *purple_notify_get_ui_ops(void);
/**************************************************************************/
/**************************************************************************/
void *purple_notify_get_handle(void);
void purple_notify_init(void);
void purple_notify_uninit(void);
#ifdef __cplusplus
}
#endif
#endif /* _PURPLE_NOTIFY_H_ */
purple_notify_close_with_handle
void purple_notify_close_with_handle(void *handle)
Closes all notifications registered with the specified handle.
purple_notify_user_info_destroy
void purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info)
Destroy a PurpleNotifyUserInfo.
PurpleNotifySearchButtonType
PurpleNotifySearchButtonType
The types of buttons.
Definition: notify.h:76
purple_notify_uri
void * purple_notify_uri(void *handle, const char *uri)
Opens a URI or somehow presents it to the user.
purple_notify_close
void purple_notify_close(PurpleNotifyType type, void *ui_handle)
Closes a notification.
purple_notify_set_ui_ops
void purple_notify_set_ui_ops(PurpleNotifyUiOps *ops)
Sets the UI operations structure to be used when displaying a notification.
purple_notify_uninit
void purple_notify_uninit(void)
Uninitializes the notify subsystem.
purple_notify_searchresults_column_new
PurpleNotifySearchColumn * purple_notify_searchresults_column_new(const char *title)
Returns a newly created search result column object.
purple_notify_get_ui_ops
PurpleNotifyUiOps * purple_notify_get_ui_ops(void)
Returns the UI operations structure to be used when displaying a notification.
purple_notify_formatted
void * purple_notify_formatted(void *handle, const char *title, const char *primary, const char *secondary, const char *text, PurpleNotifyCloseCallback cb, gpointer user_data)
Displays a notification with formatted text.
purple_notify_user_info_entry_set_label
void purple_notify_user_info_entry_set_label(PurpleNotifyUserInfoEntry *user_info_entry, const char *label)
Set the label for a PurpleNotifyUserInfoEntry.
PurpleNotifySearchColumn::title
char * title
Title of the column.
Definition: notify.h:114
PurpleNotifySearchButton::callback
PurpleNotifySearchResultsCallback callback
Function to be called when clicked.
Definition: notify.h:136
PURPLE_NOTIFY_MSG_INFO
Information notification.
Definition: notify.h:68
purple_notify_message
void * purple_notify_message(void *handle, PurpleNotifyMsgType type, const char *title, const char *primary, const char *secondary, PurpleNotifyCloseCallback cb, gpointer user_data)
Displays a notification message to the user.
connection.h
Connection API.
PURPLE_NOTIFY_MSG_WARNING
Warning notification.
Definition: notify.h:67
purple_notify_user_info_new
PurpleNotifyUserInfo * purple_notify_user_info_new(void)
Create a new PurpleNotifyUserInfo which is suitable for passing to purple_notify_userinfo() ...
purple_notify_searchresults_button_add
void purple_notify_searchresults_button_add(PurpleNotifySearchResults *results, PurpleNotifySearchButtonType type, PurpleNotifySearchResultsCallback cb)
Adds a stock button that will be displayed in the search results dialog.
PURPLE_NOTIFY_FORMATTED
Formatted text.
Definition: notify.h:53
purple_notify_get_handle
void * purple_notify_get_handle(void)
Returns the notify subsystem handle.
purple_notify_searchresults_get_rows_count
guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results)
Returns a number of the rows in the search results object.
purple_notify_searchresults_button_add_labeled
void purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults *results, const char *label, PurpleNotifySearchResultsCallback cb)
Adds a plain labelled button that will be displayed in the search results dialog. ...
purple_notify_searchresults_get_columns_count
guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results)
Returns a number of the columns in the search results object.
PurpleNotifySearchColumn
Single column of a search result.
Definition: notify.h:112
purple_notify_searchresults_row_add
void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results, GList *row)
Adds a new row of the results to the search results object.
PURPLE_NOTIFY_BUTTON_LABELED
special use, see _button_add_labeled
Definition: notify.h:78
purple_notify_user_info_get_entries
GList * purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info)
Retrieve the array of PurpleNotifyUserInfoEntry objects from a PurpleNotifyUserInfo.
purple_notify_searchresults
void * purple_notify_searchresults(PurpleConnection *gc, const char *title, const char *primary, const char *secondary, PurpleNotifySearchResults *results, PurpleNotifyCloseCallback cb, gpointer user_data)
Search results notification API.
purple_notify_emails
void * purple_notify_emails(void *handle, size_t count, gboolean detailed, const char **subjects, const char **froms, const char **tos, const char **urls, PurpleNotifyCloseCallback cb, gpointer user_data)
Displays a notification for multiple emails to the user.
purple_notify_user_info_prepend_section_break
void purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info)
Prepend a section break.
PURPLE_NOTIFY_MSG_ERROR
Error notification.
Definition: notify.h:66
PurpleNotifySearchButton
Definition of a button.
Definition: notify.h:133
PURPLE_NOTIFY_SEARCHRESULTS
Buddy search results.
Definition: notify.h:54
PurpleNotifySearchResults::columns
GList * columns
List of the search column objects.
Definition: notify.h:93
PurpleNotifySearchButton::label
char * label
only for PURPLE_NOTIFY_BUTTON_LABELED
Definition: notify.h:137
purple_notify_searchresults_column_add
void purple_notify_searchresults_column_add(PurpleNotifySearchResults *results, PurpleNotifySearchColumn *column)
Adds a new column to the search result object.
purple_notify_user_info_prepend_pair
void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value)
Prepend a label/value pair to a PurpleNotifyUserInfo object.
PurpleNotifySearchResultsCallback
void(* PurpleNotifySearchResultsCallback)(PurpleConnection *c, GList *row, gpointer user_data)
Callback for a button in a search result.
Definition: notify.h:126
purple_notify_user_info_add_section_break
void purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info)
Add a section break.
purple_notify_searchresults_column_get_title
char * purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results, unsigned int column_id)
Returns a title of the search results object&#39;s column.
PurpleNotifyMsgType
PurpleNotifyMsgType
Notification message types.
Definition: notify.h:64
purple_notify_init
void purple_notify_init(void)
Initializes the notify subsystem.
purple_notify_user_info_add_pair
void purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value)
Add a label/value pair to a PurpleNotifyUserInfo object.
PURPLE_NOTIFY_MESSAGE
Message notification.
Definition: notify.h:50
PurpleNotifySearchResults::rows
GList * rows
List of rows in the result.
Definition: notify.h:94
purple_notify_userinfo
void * purple_notify_userinfo(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info, PurpleNotifyCloseCallback cb, gpointer user_data)
Displays user information with formatted text, passing information giving the connection and username...
purple_notify_user_info_get_text_with_newline
char * purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline)
Create a textual representation of a PurpleNotifyUserInfo, separating entries with newline...
PurpleNotifyUserInfoEntryType
PurpleNotifyUserInfoEntryType
Types of PurpleNotifyUserInfoEntry objects.
Definition: notify.h:102
purple_notify_user_info_entry_get_value
const gchar * purple_notify_user_info_entry_get_value(PurpleNotifyUserInfoEntry *user_info_entry)
Get the value for a PurpleNotifyUserInfoEntry.
purple_notify_email
void * purple_notify_email(void *handle, const char *subject, const char *from, const char *to, const char *url, PurpleNotifyCloseCallback cb, gpointer user_data)
Displays a single email notification to the user.
purple_notify_user_info_remove_last_item
void purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info)
Remove the last item which was added to a PurpleNotifyUserInfo.
PurpleNotifyType
PurpleNotifyType
Notification types.
Definition: notify.h:48
PURPLE_NOTIFY_USERINFO
Formatted userinfo text.
Definition: notify.h:55
purple_notify_searchresults_new
PurpleNotifySearchResults * purple_notify_searchresults_new(void)
Returns a newly created search results object.
PURPLE_NOTIFY_EMAIL
Single email notification.
Definition: notify.h:51
purple_notify_user_info_entry_new
PurpleNotifyUserInfoEntry * purple_notify_user_info_entry_new(const char *label, const char *value)
Create a new PurpleNotifyUserInfoEntry.
purple_notify_user_info_entry_get_type
PurpleNotifyUserInfoEntryType purple_notify_user_info_entry_get_type(PurpleNotifyUserInfoEntry *user_info_entry)
Get the type of a PurpleNotifyUserInfoEntry.
purple_notify_searchresults_new_rows
void purple_notify_searchresults_new_rows(PurpleConnection *gc, PurpleNotifySearchResults *results, void *data)
Replace old rows with the new.
_PurpleConnection
Definition: connection.h:245
PURPLE_NOTIFY_EMAILS
Multiple email notification.
Definition: notify.h:52
purple_notify_searchresults_free
void purple_notify_searchresults_free(PurpleNotifySearchResults *results)
Frees a PurpleNotifySearchResults object.
PurpleNotifyCloseCallback
void(* PurpleNotifyCloseCallback)(gpointer user_data)
Notification close callbacks.
Definition: notify.h:42
purple_notify_user_info_add_pair_plaintext
void purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value)
Like purple_notify_user_info_add_pair, but value should be plaintext and will be escaped using g_mark...
PurpleNotifyUiOps
Notification UI operations.
Definition: notify.h:144
purple_notify_user_info_remove_entry
void purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *user_info_entry)
Remove a PurpleNotifyUserInfoEntry from a PurpleNotifyUserInfo object without freeing the entry...
PurpleNotifySearchResults::buttons
GList * buttons
List of buttons to display.
Definition: notify.h:95
purple_notify_searchresults_row_get
GList * purple_notify_searchresults_row_get(PurpleNotifySearchResults *results, unsigned int row_id)
Returns a row of the results from the search results object.
purple_notify_user_info_entry_set_type
void purple_notify_user_info_entry_set_type(PurpleNotifyUserInfoEntry *user_info_entry, PurpleNotifyUserInfoEntryType type)
Set the type of a PurpleNotifyUserInfoEntry.
PurpleNotifySearchResults
Search results object.
Definition: notify.h:91
purple_notify_user_info_prepend_section_header
void purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label)
Prepend a section header.
PURPLE_NOTIFY_URI
URI notification or display.
Definition: notify.h:56
purple_notify_user_info_add_section_header
void purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label)
Add a section header.
purple_notify_user_info_entry_get_label
const gchar * purple_notify_user_info_entry_get_label(PurpleNotifyUserInfoEntry *user_info_entry)
Get the label for a PurpleNotifyUserInfoEntry.
purple_notify_user_info_entry_set_value
void purple_notify_user_info_entry_set_value(PurpleNotifyUserInfoEntry *user_info_entry, const char *value)
Set the value for a PurpleNotifyUserInfoEntry.