| Yattm - unified GTK instant-messaging client | ![]() |
| [Generated for version 0.2-17 - Mon Jan 6 19:01:23 GMT+1 2003] |
#include "chat_room.h"#include "input_list.h"Include dependency graph for service.h:

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

Go to the source code of this file.
Data Structures | |
| struct | service |
| struct | service_callbacks |
Defines | |
| #define | GET_SERVICE(x) eb_services[x->service_id] |
| #define | RUN_SERVICE(x) GET_SERVICE(x).sc |
Functions | |
| gint | add_service (struct service *Service_Info) |
| gint | get_service_id (gchar *servicename) |
| gchar * | get_service_name (gint serviceid) |
| void | load_modules () |
| void | add_idle_check () |
| void | serv_touch_idle () |
| void | rename_nick_log (char *oldnick, char *newnick) |
| GList * | get_service_list () |
Variables | |
| int | NUM_SERVICES |
| service | eb_services [] |
|
|
Definition at line 35 of file service.h. Referenced by eb_update_window_title(), and eb_update_window_title_to_tab(). |
|
|
|
Definition at line 240 of file service.c. References check_idle(), idle_timer, scrnsaver_ext, and serv_touch_idle().
00241 {
00242 int eventnum, errornum;
00243 idle_timer = gtk_timeout_add(5000, (GtkFunction)check_idle, NULL);
00244 serv_touch_idle();
00245 #ifdef HAVE_MIT_SAVER_EXTENSION
00246 if (XScreenSaverQueryExtension(gdk_display, &eventnum, &errornum)) {
00247 scrnsaver_ext = 1;
00248 }
00249 #endif
00250 }
|
|
|
Definition at line 64 of file service.c. References DBG_CORE, eb_debug, GetPref(), service::name, NUM_SERVICES, service::protocol_id, service_callbacks::read_prefs_config, refresh_service_contacts(), reload_service_accounts(), and service::sc. Referenced by load_service_plugin(), and unload_module().
00065 {
00066 int i;
00067 GList *session_prefs=NULL;
00068
00069 assert(Service_Info);
00070
00071 eb_debug(DBG_CORE, ">Entering\n");
00072 if(Service_Info->sc->read_prefs_config) {
00073 session_prefs=GetPref(Service_Info->name);
00074 Service_Info->sc->read_prefs_config(session_prefs);
00075 }
00076
00077 for (i=0; i < NUM_SERVICES; i++ )
00078 {
00079 /* Check to see if another service exists for the same protocol, if so, replace it */
00080 if(!strcasecmp(eb_services[i].name,Service_Info->name))
00081 {
00082 eb_debug(DBG_CORE, "Replacing %s service\n", Service_Info->name);
00083 // free(eb_services[i].name);
00084 free(eb_services[i].sc);
00085 Service_Info->protocol_id=i;
00086 memcpy(&eb_services[i], Service_Info, sizeof(struct service));
00087 refresh_service_contacts(i);
00088 reload_service_accounts(i);
00089 eb_debug(DBG_CORE, "<Replaced existing service\n");
00090 return(i);
00091 }
00092
00093 }
00094 Service_Info->protocol_id=NUM_SERVICES++;
00095 memcpy(&eb_services[Service_Info->protocol_id], Service_Info, sizeof(struct service));
00096 refresh_service_contacts(i);
00097 reload_service_accounts(Service_Info->protocol_id);
00098 eb_debug(DBG_CORE, "<Added new service \n");
00099 return(Service_Info->protocol_id);
00100 }
|
|
|
Definition at line 103 of file service.c. References cSetLocalPref(), DBG_CORE, eb_debug, eb_nomodule_query_callbacks(), nomodule_SERVICE_INFO, and NUM_SERVICES. Referenced by add_button_callback(), check_login_validity(), eb_read_prefs(), join_chat_callback(), ok_callback(), reload_service_accounts(), and yyparse().
00104 {
00105 int i;
00106 char buf[1024];
00107
00108 for (i=0; i < NUM_SERVICES; i++ )
00109 {
00110 if(strcasecmp(eb_services[i].name,servicename)==0)
00111 {
00112 return i;
00113 }
00114 }
00115 eb_debug(DBG_CORE, "Creating empty service for %s\n", servicename);
00116 memcpy(&eb_services[NUM_SERVICES], &nomodule_SERVICE_INFO, sizeof(struct service));
00117 eb_services[NUM_SERVICES].sc=eb_nomodule_query_callbacks();
00118 eb_services[NUM_SERVICES].name = strdup(servicename);
00119 eb_services[NUM_SERVICES].protocol_id=NUM_SERVICES;
00120 NUM_SERVICES++;
00121 sprintf(buf, "%s::path", servicename);
00122 cSetLocalPref(buf, "Empty Module");
00123 return(NUM_SERVICES-1);
00124 }
|
|
|
Definition at line 137 of file service.c. References NUM_SERVICES. Referenced by check_login_validity(), eb_new_user(), edit_contact_window_new(), and show_add_defined_contact_window().
00138 {
00139 GList * newlist = NULL;
00140 int i;
00141 for( i = 0; i < NUM_SERVICES; i++ )
00142 {
00143 newlist = g_list_append( newlist, eb_services[i].name );
00144 }
00145 return newlist;
00146 }
|
|
|
Definition at line 126 of file service.c. References service::name, and NUM_SERVICES. Referenced by eb_read_prefs(), get_local_accounts(), and reload_service_accounts().
00127 {
00128 if ((service_id >= 0) && (service_id < NUM_SERVICES))
00129 {
00130 return (eb_services[service_id].name);
00131 }
00132
00133 fprintf(stderr, "warning: unknown service id: %d\n", service_id);
00134 return "unknown";
00135 }
|
|
|
Definition at line 254 of file plugin.c. References _, cGetLocalPref(), DBG_CORE, do_error_dialog(), eb_debug, load_module(), MODULE_DIR, and select_module_entry(). Referenced by main(), and reload_modules().
00255 {
00256 /* UNUSED struct dirent **namelist=NULL; */
00257 char buf[1024], *modules_path=NULL, *cur_path=NULL;
00258 char *tok_buf=NULL, *tok_buf_old=NULL;
00259 int n=0, success=0;
00260 struct dirent *dp;
00261 DIR *dirp;
00262
00263 eb_debug(DBG_CORE, ">Entering\n");
00264 modules_path=g_strdup(cGetLocalPref("modules_path"));
00265 tok_buf = g_new0(char, strlen(modules_path)+1);
00266 /* Save the old pointer, because strtok_r will change it */
00267 tok_buf_old=tok_buf;
00268 lt_dlinit();
00269 lt_dlsetsearchpath(modules_path);
00270
00271 /* Use a thread-safe strtok */
00272 #ifdef HAVE_STRTOK_R
00273 cur_path=strtok_r(modules_path, ":", &tok_buf);
00274 #else
00275 cur_path=strtok(modules_path, ":");
00276 #endif
00277 if(!cur_path)
00278 cur_path=MODULE_DIR;
00279 do {
00280 if((dirp = opendir(cur_path)) == NULL)
00281 {
00282 sprintf(buf, _("Cannot open module directory \"%s\""), cur_path);
00283 do_error_dialog(buf, _("Warning"));
00284 buf[0] = '\0';
00285 break;
00286 }
00287 n = 0;
00288 while((dp = readdir(dirp)) != NULL)
00289 {
00290 if( dp == NULL )
00291 {
00292 sprintf(buf, _("Looking for modules in %s"), cur_path);
00293 perror(buf);
00294 continue;
00295 }
00296 else if( select_module_entry( dp ) )
00297 {
00298 n++;
00299 success = load_module(cur_path, dp->d_name);
00300 }
00301 }
00302 if( n == 0 )
00303 {
00304 eb_debug(DBG_CORE, "<No modules found in %s, returning.\n", cur_path);
00305 }
00306 else
00307 {
00308 eb_debug(DBG_CORE, "Loaded %d modules from %s.\n", n, cur_path);
00309 }
00310 closedir(dirp);
00311 #ifdef HAVE_STRTOK_R
00312 } while((cur_path=strtok_r(NULL, ":", &tok_buf)));
00313 #else
00314 } while((cur_path=strtok(NULL, ":")));
00315 #endif
00316
00317 g_free(modules_path);
00318 g_free(tok_buf_old);
00319 eb_debug(DBG_CORE, "Adding idle_check\n");
00320 add_idle_check();
00321 eb_debug(DBG_CORE, "<End services_init\n");
00322 }
|
|
||||||||||||
|
Definition at line 253 of file service.c. Referenced by ok_callback().
00254 {
00255 gchar oldnicklog[255], newnicklog[255];
00256 strcpy(oldnicklog, config_dir);
00257 strcat(oldnicklog, "logs/");
00258 strcpy(newnicklog, oldnicklog);
00259 strcat(oldnicklog, oldnick);
00260 strcat(newnicklog, newnick);
00261 rename(oldnicklog, newnicklog);
00262 printf("Renamed log from %s to %s\n", oldnicklog, newnicklog);
00263 }
|
|
|
Definition at line 148 of file service.c. References is_idle, lastsent, and RUN_SERVICE. Referenced by add_idle_check(), check_idle(), and send_message().
00149 {
00150 /* Are we idle? If so, not anymore */
00151 if (is_idle > 0) {
00152 GList * node;
00153 is_idle = 0;
00154 for(node = accounts; node; node = node->next )
00155 {
00156 if(((eb_local_account *)(node->data))->connected)
00157 {
00158 if(RUN_SERVICE(((eb_local_account*)(node->data)))->set_idle)
00159 {
00160 RUN_SERVICE(((eb_local_account*)node->data))->set_idle(
00161 (eb_local_account*)node->data, 0);
00162 }
00163 }
00164 }
00165 }
00166 time(&lastsent);
00167 }
|
|
|
|
|
|
Definition at line 34 of file service.h. Referenced by add_service(), get_service_id(), get_service_list(), and get_service_name(). |