Yattm - unified GTK instant-messaging client logo
   [Generated for version 0.2-17 - Mon Jan 6 19:01:23 GMT+1 2003]

Home - Main Page - Data Structures - File List - Data Fields - Globals

service.h

Go to the documentation of this file.
00001 /*
00002  * Yattm 
00003  *
00004  * Copyright (C) 1999, Torrey Searle <tsearle@uci.edu>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 /*
00023  * service.h
00024  * Header file for service bits.
00025  */
00026 
00027 #ifndef __SERVICE_H__
00028 #define __SERVICE_H__
00029 
00030 #include "chat_room.h"
00031 #include "input_list.h"
00032 
00033 
00034 extern int NUM_SERVICES;
00035 #define GET_SERVICE(x) eb_services[x->service_id]
00036 #define RUN_SERVICE(x) GET_SERVICE(x).sc
00037 
00038 struct service_callbacks {
00039     /*callback to determine if remote account is online*/
00040     gboolean (*query_connected) (eb_account *account);
00041 
00042     /*callback that will establish connection to server, and set up
00043       any timers and listeners necessary */
00044     void (*login) (eb_local_account *account);
00045 
00046     /*callback to disable any timers and disconnect from server*/
00047     void (*logout) (eb_local_account *account);
00048 
00049     /* send message from one account to another */
00050     void (*send_im) (eb_local_account *account_from,
00051              eb_account *account_to,
00052              gchar *message);
00053 
00054         /* send a typing notification - the return value is the number 
00055        of seconds to wait before sending again - NULL if the service 
00056        doesn't support it
00057         */
00058         int (*send_typing) (eb_local_account *account_from,
00059                              eb_account *account_to);
00060 
00061     /* reads local account information from a file */
00062     eb_local_account * (*read_local_account_config) (GList * values);
00063 
00064     /* gets the configuration necessary to be written to a file */
00065     GList * (*write_local_config)( eb_local_account * account );
00066 
00067     /* reads contact information */
00068     eb_account * (*read_account_config) (GList * config, 
00069             struct contact *contact);
00070 
00071     /*Returns the list of all possible states that the user can be in*/
00072     GList * (*get_states)();
00073 
00074     /*Retruns the index to the current state that the service is int*/
00075     gint (*get_current_state)(eb_local_account * account);
00076 
00077     /*Sets the online status for the given account*/
00078     void (*set_current_state)(eb_local_account * account, gint state);
00079 
00080     /*Checks login validity */
00081     char * (*check_login)(char * login, char * pass);
00082 
00083     /*Informs the service of an account that it needs to manage*/
00084     void (*add_user)(eb_account * account);
00085 
00086     /*Notifies the service that it doesn't need to track an account*/
00087     void (*del_user)(eb_account * account);
00088 
00089     /*Notifies the service that the user needs to be ignored*/
00090     void (*ignore_user)(eb_account * account);
00091 
00092     /*Notifies the service that the user is no longer ignored*/
00093     void (*unignore_user)(eb_account * account, gchar *new_group);
00094 
00095     /*Notifies the service that an account's group has changed
00096       can be used to inform the server of the group change.
00097       Can be NULL if not implemented*/
00098     void (*change_group)(eb_account * account, gchar *new_group);
00099 
00100     /*Informs the service of an account that it needs to manage*/
00101     gboolean (*is_suitable)(eb_local_account *local, eb_account *remote);
00102 
00103     /*Creates a new account*/
00104     eb_account*(*new_account)( gchar * account );
00105 
00106     /*This returns the string representing the status,
00107       this will get used on the Contact List, if statuses
00108       are not available, this should return the empty string */
00109 
00110     gchar*(*get_status_string)(eb_account * account);
00111 
00112     /*This returns the string representing the status,
00113       this will get used on the Contact List, if statuses
00114       are not available, this should return the empty string */
00115 
00116     void (*get_status_pixmap)(eb_account * account, GdkPixmap **pm, GdkBitmap **bm);
00117 
00118     /*set the idle time (set this to null if N/A)*/
00119 
00120     void (*set_idle)(eb_local_account * account, gint idle );
00121 
00122     /* set an away message */
00123 
00124     void (*set_away)(eb_local_account * account, gchar * message );
00125 
00126     /*send a message to a chat room*/
00127 
00128     void (*send_chat_room_message)(eb_chat_room * room, gchar * message);
00129 
00130     /*these are used to join and leave a chat room */
00131 
00132     void (*join_chat_room)(eb_chat_room * room);
00133     void (*leave_chat_room)(eb_chat_room * room);
00134 
00135     /*this it to create a new chat room*/
00136 
00137     eb_chat_room * (*make_chat_room)(gchar * name, eb_local_account * account);
00138 
00139     /*this is to invite somebody into the chat room*/
00140 
00141     void (*send_invite)( eb_local_account * account, eb_chat_room * room,
00142                                          char * user, char * message);
00143 
00144     void (*accept_invite)( eb_local_account * account, void * invitation );
00145 
00146     void (*decline_invite)( eb_local_account * account, void * inviatation );
00147 
00148     /*this is to send a file */
00149 
00150     void (*send_file)( eb_local_account * from, eb_account * to, char * file );
00151 
00152     /* gets called for each account a contact has when a chat windows is closed
00153      * can be null if you don't need it
00154      */
00155 
00156     void (*terminate_chat)(eb_account * account );
00157 
00158         /* called to request a users information */
00159         void(*get_info)(eb_local_account * account_from, eb_account * account_to);
00160 
00161 
00162     /* this is used so that the 'plugin' can add it's own proprietary
00163      * config featurs into the prefs window
00164      */
00165 
00166         input_list * (*get_prefs)();
00167 
00168     /*
00169      * processes any service specific preferences
00170      */
00171 
00172     void (*read_prefs_config) (GList * values);
00173 
00174     /*
00175      * get the service specific preferences so they can be written
00176      * to a file
00177      */
00178 
00179     GList * (*write_prefs_config)();
00180     GList * (*add_importers)(GList *);
00181 
00182 
00183         /* This lot are used to retrieve various protocol-specific eye-candy.
00184            When these functions are called, their return values are NOT free()ed,
00185            so you can just return a static variable if you want */
00186 
00187 
00188         /* This requests a GList of protocol-specific smilies (type protocol_smiley, see
00189            smileys.h */
00190         GList * (*get_smileys)(void);
00191 
00192         /* This returns the color associated with this protocol (in HTML form,
00193            so for example AIM is "#000088" */
00194         gchar * (*get_color)(void);
00195 };
00196 
00197 /*for every server you have the following: the name of the service,
00198   the server, port, the type of protocall used by the service, and a pointer
00199   to the service specific callbacks.
00200   */
00201 struct service {
00202     gchar *name;
00203     gint protocol_id;
00204     gboolean offline_messaging;
00205     gboolean group_chat;
00206     gboolean file_transfer;
00207     gboolean can_iconvert;
00208     struct service_callbacks *sc;
00209 };
00210 
00211 
00212 #ifdef __cplusplus
00213 extern "C" {
00214 #endif
00215 
00216 gint add_service(struct service *Service_Info);
00217 gint get_service_id( gchar * servicename );
00218 gchar* get_service_name( gint serviceid );
00219 
00220 void load_modules();
00221 
00222 #if defined(__MINGW32__) && defined(__IN_PLUGIN__)
00223 __declspec(dllimport) struct service eb_services[];
00224 #else
00225 extern struct service eb_services[];
00226 #endif
00227 
00228 void add_idle_check();
00229 void serv_touch_idle();
00230     
00231 void rename_nick_log(char *oldnick, char *newnick);
00232 
00233 GList * get_service_list();
00234 
00235 #ifdef __cplusplus
00236 } /* extern "C" */
00237 #endif
00238 
00239 #endif /*__SERVICE_H__*/

Contact: Andy Maloney     [Documentation generated by doxygen]