00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifdef HAVE_CONFIG_H
00028 # include <config.h>
00029 #endif
00030
00031 #include "intl.h"
00032 #include <gtk/gtk.h>
00033 #include <assert.h>
00034 #include <stdlib.h>
00035 #include <string.h>
00036 #include <time.h>
00037 #if defined( _WIN32 ) && !defined(__MINGW32__)
00038 typedef unsigned long u_long;
00039 typedef unsigned long ulong;
00040 #endif
00041 #include "service.h"
00042 #include "chat_window.h"
00043 #include "away_window.h"
00044 #include "util.h"
00045 #include "status.h"
00046 #include "gtk_globals.h"
00047 #include "dialog.h"
00048 #include "message_parse.h"
00049 #include "chat_room.h"
00050 #include "value_pair.h"
00051 #include "info_window.h"
00052 #include "gtk_eb_html.h"
00053 #include "input_list.h"
00054
00055
00056
00057 #include "pixmaps/nomodule_away.xpm"
00058
00059 #define SERVICE_INFO nomodule_SERVICE_INFO
00060
00061 struct service SERVICE_INFO = { NULL, -1, FALSE, FALSE, FALSE, FALSE, NULL };
00062
00063 struct eb_nomodule_account_data {
00064 gint status;
00065 gint logged_in_time;
00066 gint evil;
00067 };
00068
00069 struct eb_nomodule_local_account_data {
00070 char password[255];
00071 int input;
00072 int keep_alive;
00073 gint status;
00074 };
00075
00076 enum
00077 {
00078 NOMODULE_OFFLINE=0
00079 };
00080
00081
00082
00083
00084
00085
00086 eb_account * eb_nomodule_new_account( gchar * account );
00087 void eb_nomodule_add_user( eb_account * account );
00088 void eb_nomodule_login( eb_local_account * account );
00089 void eb_nomodule_logout( eb_local_account * account );
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 static gint pixmaps = 0;
00102 static GdkPixmap * eb_nomodule_pixmap[NOMODULE_OFFLINE+1];
00103 static GdkBitmap * eb_nomodule_bitmap[NOMODULE_OFFLINE+1];
00104
00105 void eb_nomodule_init_pixmaps()
00106 {
00107 gint i = NOMODULE_OFFLINE;
00108 gchar ** xpm;
00109
00110 xpm = nomodule_away_xpm;
00111 eb_nomodule_pixmap[i] = gdk_pixmap_create_from_xpm_d(statuswindow->window,
00112 &eb_nomodule_bitmap[i], NULL, xpm);
00113 pixmaps = 1;
00114 }
00115
00116
00117
00118 gboolean eb_nomodule_query_connected(eb_account * account)
00119 {
00120 return FALSE;
00121 }
00122
00123 void eb_nomodule_login( eb_local_account * account )
00124 {
00125 return;
00126 }
00127
00128 void eb_nomodule_logout( eb_local_account * account )
00129 {
00130 return;
00131 }
00132
00133 void eb_nomodule_send_im( eb_local_account * account_from,
00134 eb_account * account_to,
00135 gchar * message )
00136 {
00137 return;
00138 }
00139
00140 eb_local_account * eb_nomodule_read_local_config(GList * pairs)
00141 {
00142
00143 eb_local_account * ela = g_new0(eb_local_account, 1);
00144 struct eb_nomodule_local_account_data * ala = g_new0(struct eb_nomodule_local_account_data, 1);
00145 char *ptr=NULL;
00146
00147 eb_debug(DBG_CORE, "eb_nomodule_read_local_config: entering\n");
00148
00149 ptr = value_pair_get_value(pairs, "SCREEN_NAME");
00150 if(!ptr) {
00151 fprintf(stderr, "Error! Invalid account config no SCREEN_NAME defined!\n");
00152 exit(1);
00153 }
00154 ela->handle=strdup(ptr);
00155 strncpy(ela->alias, ela->handle, 255);
00156 ptr = value_pair_get_value(pairs, "PASSWORD");
00157 if(!ptr) {
00158 fprintf(stderr, "Warning! No password specified for handle %s\n", ela->handle);
00159 }
00160 else {
00161 strncpy(ala->password, value_pair_get_value(pairs, "PASSWORD"), 255);
00162 }
00163 ela->service_id = SERVICE_INFO.protocol_id;
00164 ela->protocol_local_account_data = ala;
00165 ala->status = 0;
00166 eb_debug(DBG_CORE, "eb_nomodule_read_local_config: leaving\n");
00167
00168 return ela;
00169 }
00170
00171 GList * eb_nomodule_write_local_config( eb_local_account * account )
00172 {
00173 GList * list = NULL;
00174 value_pair * vp;
00175 struct eb_nomodule_local_account_data * alad = account->protocol_local_account_data;
00176
00177 vp = g_new0(value_pair, 1);
00178
00179 strcpy(vp->key, "SCREEN_NAME");
00180 strcpy(vp->value, escape_string(account->handle) );
00181
00182 list = g_list_append( list, vp );
00183
00184 vp = g_new0(value_pair, 1);
00185
00186 strcpy(vp->key, "PASSWORD");
00187 strcpy(vp->value, escape_string(alad->password) );
00188
00189 list = g_list_append(list, vp);
00190
00191 return list;
00192 }
00193
00194 eb_account * eb_nomodule_read_config( GList * config, struct contact *contact )
00195 {
00196 eb_account * ea = g_new0(eb_account, 1 );
00197 struct eb_nomodule_account_data * aad = g_new0(struct eb_nomodule_account_data,1);
00198
00199 aad->status = 0;
00200
00201
00202 strncpy(ea->handle, value_pair_get_value( config, "NAME"), 255);
00203
00204 ea->service_id = SERVICE_INFO.protocol_id;
00205 ea->protocol_account_data = aad;
00206 ea->account_contact = contact;
00207 ea->list_item = NULL;
00208 ea->online = 0;
00209 ea->status = NULL;
00210 ea->pix = NULL;
00211 ea->icon_handler = -1;
00212 ea->status_handler = -1;
00213
00214 return ea;
00215 }
00216
00217 GList * eb_nomodule_get_states()
00218 {
00219 GList * states = NULL;
00220 states = g_list_append(states, _("No Module or broken account"));
00221
00222 return states;
00223 }
00224
00225
00226
00227
00228 char * eb_nomodule_check_login(char * login, char * pass)
00229 {
00230 return NULL;
00231 }
00232
00233 gint eb_nomodule_get_current_state(eb_local_account * account )
00234 {
00235 return 0;
00236 }
00237
00238 void eb_nomodule_set_current_state( eb_local_account * account, gint state )
00239 {
00240 return;
00241 }
00242
00243 void eb_nomodule_add_user( eb_account * account )
00244 {
00245 return;
00246 }
00247
00248 void eb_nomodule_del_user( eb_account * account )
00249 {
00250 return;
00251 }
00252
00253 eb_account * eb_nomodule_new_account( gchar * account )
00254 {
00255 return NULL;
00256 }
00257
00258 gchar * eb_nomodule_get_status_string( eb_account * account )
00259 {
00260 static gchar string[255];
00261
00262 g_snprintf(string, 255, _("(Offline)"));
00263
00264 return string;
00265 }
00266
00267 void eb_nomodule_get_status_pixmap( eb_account * account, GdkPixmap ** pm, GdkBitmap ** bm )
00268 {
00269 struct eb_nomodule_account_data * aad;
00270
00271 if (!pixmaps)
00272 eb_nomodule_init_pixmaps();
00273
00274 aad = account->protocol_account_data;
00275
00276 *pm = eb_nomodule_pixmap[aad->status];
00277 *bm = eb_nomodule_bitmap[aad->status];
00278 }
00279
00280 void eb_nomodule_set_idle( eb_local_account * ela, gint idle )
00281 {
00282 return;
00283 }
00284
00285 void eb_nomodule_set_away(eb_local_account * account, gchar * message)
00286 {
00287 return;
00288 }
00289
00290
00291 void eb_nomodule_get_info( eb_local_account * from, eb_account * account_to )
00292 {
00293 return;
00294 }
00295
00296 input_list * eb_nomodule_get_prefs()
00297 {
00298 return NULL;
00299 }
00300
00301 void eb_nomodule_read_prefs_config(GList * values)
00302 {
00303 return;
00304 }
00305
00306 GList * eb_nomodule_write_prefs_config()
00307 {
00308 return NULL;
00309 }
00310
00311 struct service_callbacks * eb_nomodule_query_callbacks()
00312 {
00313 struct service_callbacks * sc;
00314
00315 sc = g_new0( struct service_callbacks, 1 );
00316 sc->query_connected = eb_nomodule_query_connected;
00317 sc->login = eb_nomodule_login;
00318 sc->logout = eb_nomodule_logout;
00319 sc->send_im = eb_nomodule_send_im;
00320 sc->read_local_account_config = eb_nomodule_read_local_config;
00321 sc->write_local_config = eb_nomodule_write_local_config;
00322 sc->read_account_config = eb_nomodule_read_config;
00323 sc->get_states = eb_nomodule_get_states;
00324 sc->get_current_state = eb_nomodule_get_current_state;
00325 sc->set_current_state = eb_nomodule_set_current_state;
00326 sc->check_login = eb_nomodule_check_login;
00327 sc->add_user = eb_nomodule_add_user;
00328 sc->del_user = eb_nomodule_del_user;
00329 sc->new_account = eb_nomodule_new_account;
00330 sc->get_status_string = eb_nomodule_get_status_string;
00331 sc->get_status_pixmap = eb_nomodule_get_status_pixmap;
00332 sc->set_idle = eb_nomodule_set_idle;
00333 sc->set_away = eb_nomodule_set_away;
00334 sc->send_chat_room_message = NULL;
00335 sc->join_chat_room = NULL;
00336 sc->leave_chat_room = NULL;
00337 sc->make_chat_room = NULL;
00338 sc->send_invite = NULL;
00339 sc->accept_invite = NULL;
00340 sc->decline_invite = NULL;
00341 sc->get_info = eb_nomodule_get_info;
00342
00343 sc->get_prefs = eb_nomodule_get_prefs;
00344 sc->read_prefs_config = eb_nomodule_read_prefs_config;
00345 sc->write_prefs_config = eb_nomodule_write_prefs_config;
00346
00347 return sc;
00348 }