eventloop.h File Reference

Purple Event Loop API. More...

#include <glib.h>

Include dependency graph for eventloop.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _PurpleEventLoopUiOps

Typedefs

typedef _PurpleEventLoopUiOps PurpleEventLoopUiOps
typedef void(*) PurpleInputFunction (gpointer, gint, PurpleInputCondition)

Enumerations

enum  PurpleInputCondition { PURPLE_INPUT_READ = 1 << 0, PURPLE_INPUT_WRITE = 1 << 1 }
 An input condition. More...

Functions

UI Registration Functions
PurpleEventLoopUiOpspurple_eventloop_get_ui_ops (void)
 Returns the UI operations structure used for accounts.
void purple_eventloop_set_ui_ops (PurpleEventLoopUiOps *ops)
 Sets the UI operations structure to be used for accounts.
Event Loop API
guint purple_input_add (int fd, PurpleInputCondition cond, PurpleInputFunction func, gpointer user_data)
 Adds an input handler.
int purple_input_get_error (int fd, int *error)
 Get the current error status for an input.
gboolean purple_input_remove (guint handle)
 Removes an input handler.
guint purple_timeout_add (guint interval, GSourceFunc function, gpointer data)
 Creates a callback timer.
gboolean purple_timeout_remove (guint handle)
 Removes a timeout handler.


Detailed Description

Purple Event Loop API.

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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Definition in file eventloop.h.


Enumeration Type Documentation

enum PurpleInputCondition

An input condition.

Enumerator:
PURPLE_INPUT_READ  A read condition.

PURPLE_INPUT_WRITE  A write condition.

Definition at line 37 of file eventloop.h.


Function Documentation

PurpleEventLoopUiOps* purple_eventloop_get_ui_ops ( void   ) 

Returns the UI operations structure used for accounts.

Returns:
The UI operations structure in use.

void purple_eventloop_set_ui_ops ( PurpleEventLoopUiOps ops  ) 

Sets the UI operations structure to be used for accounts.

Parameters:
ops The UI operations structure.

guint purple_input_add ( int  fd,
PurpleInputCondition  cond,
PurpleInputFunction  func,
gpointer  user_data 
)

Adds an input handler.

Parameters:
fd The input file descriptor.
cond The condition type.
func The callback function for data.
user_data User-specified data.
Returns:
The resulting handle (will be greater than 0).
See also:
g_io_add_watch_full

int purple_input_get_error ( int  fd,
int *  error 
)

Get the current error status for an input.

The return value and error follow getsockopt() with a level of SOL_SOCKET and an option name of SO_ERROR, and this is how the error is determined if the UI does not implement the input_get_error UI op.

Parameters:
fd The input file descriptor.
error A pointer to an int which on return will have the error, or 0 if no error.
Returns:
0 if there is no error; -1 if there is an error, in which case errno will be set.

gboolean purple_input_remove ( guint  handle  ) 

Removes an input handler.

Parameters:
handle The handle of the input handler. Note that this is the return value from purple_input_add, not the file descriptor.

guint purple_timeout_add ( guint  interval,
GSourceFunc  function,
gpointer  data 
)

Creates a callback timer.

The timer will repeat until the function returns FALSE. The first call will be at the end of the first interval.

Parameters:
interval The time between calls of the function, in milliseconds.
function The function to call.
data data to pass to function.
Returns:
A handle to the timer which can be passed to purple_timeout_remove to remove the timer.

gboolean purple_timeout_remove ( guint  handle  ) 

Removes a timeout handler.

Parameters:
handle The handle, as returned by purple_timeout_add.
Returns:
Something.