Mercurial > pidgin
changeset 423:0d4e80bdb96b
[gaim-migrate @ 433]
No more --enable-oscar option. From now on, it's a toggle in the preferences.
PLEASE DO NOT USE OSCAR, even though it's very easy to.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 21 Jun 2000 19:33:58 +0000 |
parents | 7cd05539952d |
children | 22700acd9b49 |
files | acconfig.h configure.in libfaim/Makefile.am src/aim.c src/buddy.c src/dialogs.c src/gaim.h src/oscar.c src/prefs.c src/server.c src/toc.c src/util.c |
diffstat | 12 files changed, 248 insertions(+), 279 deletions(-) [+] |
line wrap: on
line diff
--- a/acconfig.h Mon Jun 19 21:58:32 2000 +0000 +++ b/acconfig.h Wed Jun 21 19:33:58 2000 +0000 @@ -5,7 +5,6 @@ #undef HAVE_STPCPY #undef HAVE_LIBSM #undef USE_APPLET -#undef USE_OSCAR #undef DEBUG #undef GAIM_PLUGINS #undef NAS_SOUND
--- a/configure.in Mon Jun 19 21:58:32 2000 +0000 +++ b/configure.in Wed Jun 21 19:33:58 2000 +0000 @@ -36,13 +36,10 @@ AC_ARG_ENABLE(gnome, [ --enable-gnome compile as a GNOME applet],enable_gnome=yes,) AM_CONDITIONAL(GNOMEAPPLET, test x$enable_gnome = xyes) AC_ARG_ENABLE(esd, [ --disable-esd Turn off ESD (default=auto)],enable_esd=no,enable_esd=yes) -AC_ARG_ENABLE(oscar, [ --enable-oscar Enable Oscar support (experimental)],enable_oscar=yes,) AC_ARG_ENABLE(nas, [ --enable-nas Enable NAS (Network Audio System) support],enable_nas=yes,) AC_ARG_ENABLE(plugins, [ --disable-plugins compile with out plugin support],enable_plugins=no,enable_plugins=yes) AM_CONDITIONAL(PLUGINS, test x$enable_plugins = xyes) -LIBFAIM_DO="" - if test "$enable_debug" = yes ; then dnl someone please tell me what -d does dnl CFLAGS="$CFLAGS -Wall -d -g" @@ -50,16 +47,11 @@ AC_DEFINE(DEBUG) fi -if test "$enable_oscar" = yes ; then - CFLAGS="$CFLAGS -I../libfaim/faim" - AC_DEFINE(USE_OSCAR) - LDADD="$LDADD -L../libfaim -lfaim -pthread" - LIBFAIM_DO="libfaim.a" -fi - AM_PATH_GLIB(1.2.0) AM_PATH_GTK(1.2.0,,,gthread) LIBS="$LIBS $GTK_LIBS" +CFLAGS="$CFLAGS -I../libfaim/faim" +LDADD="$LDADD -L../libfaim -lfaim -pthread" if test "$enable_gnome" = yes ; then GNOME_INIT(applets)
--- a/libfaim/Makefile.am Mon Jun 19 21:58:32 2000 +0000 +++ b/libfaim/Makefile.am Wed Jun 21 19:33:58 2000 +0000 @@ -1,6 +1,4 @@ -noinst_LIBRARIES = $(LIBFAIM_DO) - -EXTRA_LIBRARIES = libfaim.a +noinst_LIBRARIES = libfaim.a EXTRA_DIST = faim/aim.h faim/aim_cbtypes.h faim/faimconfig.h README \ README.gaim CHANGES CHANGES.gaim COPYING BUGS
--- a/src/aim.c Mon Jun 19 21:58:32 2000 +0000 +++ b/src/aim.c Wed Jun 21 19:33:58 2000 +0000 @@ -202,7 +202,9 @@ running = FALSE; return; } -#ifdef USE_OSCAR + + if (!USE_OSCAR) /* serv_login will set up USE_OSCAR */ + gaim_setup(); } void auth_failed() { @@ -213,7 +215,6 @@ * process, it doesn't end there. gaim_setup will be called later from * oscar.c, after the buddy list is made and serv_finish_login is called */ void gaim_setup() { -#endif /* USE_OSCAR */ if (sound_options & OPT_SOUND_LOGIN && sound_options & OPT_SOUND_SILENT_SIGNON) { logins_not_muted = 0; @@ -461,7 +462,7 @@ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(remember), (general_options & OPT_GEN_REMEMBER_PASS)); - + if (current_user) { GList *all = aim_users; GList *srch = g_list_find(all, (void *)current_user);
--- a/src/buddy.c Mon Jun 19 21:58:32 2000 +0000 +++ b/src/buddy.c Wed Jun 21 19:33:58 2000 +0000 @@ -452,13 +452,13 @@ gtk_menu_append(GTK_MENU(menu), button); gtk_widget_show(button); -#ifdef USE_OSCAR /* FIXME : someday maybe TOC can do this too */ + if (USE_OSCAR) { button = gtk_menu_item_new_with_label(_("Away Msg")); gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(pressed_away_msg), b); gtk_menu_append(GTK_MENU(menu), button); gtk_widget_show(button); -#endif + } button = gtk_menu_item_new_with_label(_("Toggle Logging")); gtk_signal_connect(GTK_OBJECT(button), "activate", @@ -1636,10 +1636,8 @@ /* We don't save this 'at home', it's on the server. * So, we gotta resend the config to the server. */ serv_save_config(); -#ifdef USE_OSCAR /* we do this here because we can :) */ serv_set_permit_deny(); -#endif }
--- a/src/dialogs.c Mon Jun 19 21:58:32 2000 +0000 +++ b/src/dialogs.c Wed Jun 21 19:33:58 2000 +0000 @@ -453,14 +453,10 @@ { int no = atoi(d); -#ifndef USE_OSCAR - char *w = strtok(NULL, ":"); -#else - char *w = d + 4; -#endif + char *w; char buf[256]; char buf2[32]; - + #ifdef GAIM_PLUGINS GList *c = callbacks; struct gaim_callback *g; @@ -475,6 +471,11 @@ } #endif + if (USE_OSCAR) + w = d + 4; + else + w = strtok(NULL, ":"); + switch(no) { case 69:
--- a/src/gaim.h Mon Jun 19 21:58:32 2000 +0000 +++ b/src/gaim.h Wed Jun 21 19:33:58 2000 +0000 @@ -249,14 +249,12 @@ int exchange; }; -#ifdef USE_OSCAR struct chat_connection { char *name; int fd; /* this is redundant since we have the conn below */ struct aim_conn_t *conn; int inpa; }; -#endif struct debug_window { GtkWidget *window; @@ -386,7 +384,7 @@ #define TYPE_SIGNOFF 4 #define TYPE_KEEPALIVE 5 -#define REVISION "gaim:$Revision: 421 $" +#define REVISION "gaim:$Revision: 433 $" #define FLAPON "FLAPON\r\n\r\n" #define ROAST "Tic/Toc" @@ -406,11 +404,9 @@ #endif /* USE_APPLET */ /* Globals in oscar.c */ -#ifdef USE_OSCAR extern struct aim_session_t *gaim_sess; extern struct aim_conn_t *gaim_conn; extern GList *oscar_chats; -#endif /* Globals in server.c */ extern int correction_time; @@ -466,6 +462,8 @@ #define OPT_GEN_CHECK_SPELLING 0x00008000 #define OPT_GEN_POPUP_CHAT 0x00010000 #define OPT_GEN_BACK_ON_IM 0x00020000 +#define OPT_GEN_USE_OSCAR 0x00040000 +extern int USE_OSCAR; extern int display_options; #define OPT_DISP_SHOW_TIME 0x00000001 @@ -629,11 +627,9 @@ extern int connect_address(unsigned int, unsigned short); /* Functions in oscar.c */ -#ifdef USE_OSCAR extern int oscar_login(char *, char *); extern void oscar_close(); extern struct chat_connection *find_oscar_chat(char *name); -#endif /* not #else because we still use some toc functions */ /* Functions in toc.c */ extern void toc_close(); @@ -684,6 +680,7 @@ extern void hide_login_progress(char *); extern void set_login_progress(int, char *); extern void show_login(); +extern void gaim_setup(); #ifdef USE_APPLET extern void createOnlinePopup(); extern void applet_show_login(AppletWidget *, gpointer);
--- a/src/oscar.c Mon Jun 19 21:58:32 2000 +0000 +++ b/src/oscar.c Wed Jun 21 19:33:58 2000 +0000 @@ -24,7 +24,6 @@ #include "../config.h" #endif -#ifdef USE_OSCAR #include <netdb.h> #include <gtk/gtk.h> @@ -48,6 +47,7 @@ struct aim_conn_t *gaim_conn; int gaim_caps = AIM_CAPS_CHAT | AIM_CAPS_SENDFILE | AIM_CAPS_GETFILE | AIM_CAPS_VOICE | AIM_CAPS_IMIMAGE | AIM_CAPS_BUDDYICON; +int USE_OSCAR = 0; GList *oscar_chats = NULL; @@ -353,10 +353,6 @@ return 1; } -extern void gaim_setup(); -extern int bud_list_cache_exists(); -extern void do_import(GtkWidget *w, void *dummy); - int gaim_handle_redirect(struct aim_session_t *sess, struct command_rx_struct *command, ...) { va_list ap; @@ -808,5 +804,3 @@ return 1; } - -#endif /* USE_OSCAR */
--- a/src/prefs.c Mon Jun 19 21:58:32 2000 +0000 +++ b/src/prefs.c Wed Jun 21 19:33:58 2000 +0000 @@ -212,7 +212,6 @@ return TRUE; } -#ifndef USE_OSCAR static int connection_key_pressed(GtkWidget *w, GdkEvent *event, void *dummy) { @@ -228,7 +227,6 @@ save_prefs(); return TRUE; } -#endif @@ -326,13 +324,10 @@ GtkWidget *appearance_page; GtkWidget *chat_page; GtkWidget *browser_page; -#ifndef USE_OSCAR /* sorry, since we don't control the comm we can't set - the connection */ GtkWidget *connection_page; GtkWidget *connectopt; GtkWidget *hbox; GtkWidget *hbox2; -#endif #ifdef USE_APPLET GtkWidget *applet_page; GtkWidget *appletbox; @@ -456,12 +451,15 @@ /* Connection */ -#ifndef USE_OSCAR connection_page = gtk_vbox_new(FALSE, 0); label = gtk_label_new(_("Connection")); gtk_widget_show(label); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), connection_page, label); + gaim_button(_("Use Oscar Protocol (experimental; only takes effect before signon)"), &general_options, OPT_GEN_USE_OSCAR, connection_page); + label = gtk_label_new(_("The following options do not apply if you use Oscar.")); + gtk_box_pack_start(GTK_BOX(connection_page), label, FALSE, FALSE, 10); + gtk_widget_show(label); hbox = gtk_hbox_new(FALSE, 0); label = gtk_label_new(_("TOC Host:")); gtk_widget_show(label); @@ -585,8 +583,6 @@ gtk_signal_connect(GTK_OBJECT(pd->proxy_port_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL); -#endif /* USE_OSCAR */ - /* Away */ a = awaymessage;
--- a/src/server.c Mon Jun 19 21:58:32 2000 +0000 +++ b/src/server.c Wed Jun 21 19:33:58 2000 +0000 @@ -30,10 +30,8 @@ #include <sys/time.h> #include <unistd.h> #include <gtk/gtk.h> -#ifdef USE_OSCAR #include <aim.h> extern int gaim_caps; -#endif #include "gaim.h" static int idle_timer = -1; @@ -46,20 +44,23 @@ int serv_login(char *username, char *password) { -#ifndef USE_OSCAR - return toc_login(username, password); -#else - return oscar_login(username, password); -#endif + if (!(general_options & OPT_GEN_USE_OSCAR)) { + USE_OSCAR = 0; + return toc_login(username, password); + } else { + USE_OSCAR = 1; + debug_print("Logging in using Oscar. Expect problems.\n"); + return oscar_login(username, password); + } } void serv_close() { -#ifndef USE_OSCAR - toc_close(); -#else - oscar_close(); -#endif + if (!USE_OSCAR) + toc_close(); + else + oscar_close(); + gtk_timeout_remove(idle_timer); idle_timer = -1; } @@ -156,55 +157,55 @@ void serv_send_im(char *name, char *message, int away) { -#ifndef USE_OSCAR + if (!USE_OSCAR) { char buf[MSG_LEN - 7]; g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name), message, ((away) ? " auto" : "")); sflap_send(buf, strlen(buf), TYPE_DATA); -#else + } else { if (away) aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_AWAY, message); else aim_send_im(gaim_sess, gaim_conn, name, 0, message); -#endif + } if (!away) serv_touch_idle(); } void serv_get_info(char *name) { -#ifndef USE_OSCAR + if (!USE_OSCAR) { char buf[MSG_LEN]; g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name)); sflap_send(buf, -1, TYPE_DATA); -#else + } else { aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_GENERALINFO); -#endif + } } void serv_get_away_msg(char *name) { -#ifndef USE_OSCAR + if (!USE_OSCAR) { /* HAHA! TOC doesn't have this yet */ -#else + } else { aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_AWAYMESSAGE); -#endif + } } void serv_get_dir(char *name) { -#ifndef USE_OSCAR - char buf[MSG_LEN]; - g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name)); - sflap_send(buf, -1, TYPE_DATA); -#endif + if (!USE_OSCAR) { + char buf[MSG_LEN]; + g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name)); + sflap_send(buf, -1, TYPE_DATA); + } } void serv_set_dir(char *first, char *middle, char *last, char *maiden, char *city, char *state, char *country, int web) { -#ifndef USE_OSCAR + if (!USE_OSCAR) { char buf2[BUF_LEN*4], buf[BUF_LEN]; g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first, middle, last, maiden, city, state, country, @@ -212,54 +213,54 @@ escape_text(buf2); g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2); sflap_send(buf, -1, TYPE_DATA); -#endif + } } void serv_dir_search(char *first, char *middle, char *last, char *maiden, char *city, char *state, char *country, char *email) { -#ifndef USE_OSCAR - char buf[BUF_LONG]; - g_snprintf(buf, sizeof(buf)/2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle, last, maiden, city, state, country, email); - sprintf(debug_buff,"Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, city, state, country); - debug_print(debug_buff); - sflap_send(buf, -1, TYPE_DATA); -#else - if (strlen(email)) - aim_usersearch_address(gaim_sess, gaim_conn, email); -#endif + if (!USE_OSCAR) { + char buf[BUF_LONG]; + g_snprintf(buf, sizeof(buf)/2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle, last, maiden, city, state, country, email); + sprintf(debug_buff,"Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, city, state, country); + debug_print(debug_buff); + sflap_send(buf, -1, TYPE_DATA); + } else { + if (strlen(email)) + aim_usersearch_address(gaim_sess, gaim_conn, email); + } } void serv_set_away(char *message) { -#ifndef USE_OSCAR - char buf[MSG_LEN]; - if (message) - g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message); - else - g_snprintf(buf, MSG_LEN, "toc_set_away \"\""); - sflap_send(buf, -1, TYPE_DATA); -#else - aim_bos_setprofile(gaim_sess, gaim_conn, current_user->user_info, - message, gaim_caps); -#endif + if (!USE_OSCAR) { + char buf[MSG_LEN]; + if (message) + g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message); + else + g_snprintf(buf, MSG_LEN, "toc_set_away \"\""); + sflap_send(buf, -1, TYPE_DATA); + } else { + aim_bos_setprofile(gaim_sess, gaim_conn, current_user->user_info, + message, gaim_caps); + } } void serv_set_info(char *info) { -#ifndef USE_OSCAR - char buf[MSG_LEN]; - g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info); - sflap_send(buf, -1, TYPE_DATA); -#else - if (awaymessage) - aim_bos_setprofile(gaim_sess, gaim_conn, info, - awaymessage->message, gaim_caps); - else - aim_bos_setprofile(gaim_sess, gaim_conn, info, - NULL, gaim_caps); -#endif + if (!USE_OSCAR) { + char buf[MSG_LEN]; + g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info); + sflap_send(buf, -1, TYPE_DATA); + } else { + if (awaymessage) + aim_bos_setprofile(gaim_sess, gaim_conn, info, + awaymessage->message, gaim_caps); + else + aim_bos_setprofile(gaim_sess, gaim_conn, info, + NULL, gaim_caps); + } } extern gboolean change_password; @@ -267,34 +268,34 @@ extern char *new_password; void serv_change_passwd(char *orig, char *new) { -#ifndef USE_OSCAR - char *buf = g_malloc(BUF_LONG); - g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new); - sflap_send(buf, strlen(buf), TYPE_DATA); - g_free(buf); -#else - if (change_password) return; - change_password = TRUE; - old_password = g_strdup(orig); - new_password = g_strdup(new); - aim_bos_reqservice(gaim_sess, gaim_conn, AIM_CONN_TYPE_AUTH); -#endif + if (!USE_OSCAR) { + char *buf = g_malloc(BUF_LONG); + g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new); + sflap_send(buf, strlen(buf), TYPE_DATA); + g_free(buf); + } else { + if (change_password) return; + change_password = TRUE; + old_password = g_strdup(orig); + new_password = g_strdup(new); + aim_bos_reqservice(gaim_sess, gaim_conn, AIM_CONN_TYPE_AUTH); + } } void serv_add_buddy(char *name) { -#ifndef USE_OSCAR - char buf[1024]; - g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name)); - sflap_send(buf, -1, TYPE_DATA); -#else - aim_add_buddy(gaim_sess, gaim_conn, name); -#endif + if (!USE_OSCAR) { + char buf[1024]; + g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name)); + sflap_send(buf, -1, TYPE_DATA); + } else { + aim_add_buddy(gaim_sess, gaim_conn, name); + } } void serv_add_buddies(GList *buddies) { -#ifndef USE_OSCAR + if (!USE_OSCAR) { char buf[MSG_LEN]; int n, num = 0; @@ -310,7 +311,7 @@ buddies = buddies->next; } sflap_send(buf, -1, TYPE_DATA); -#else + } else { char buf[MSG_LEN]; int n = 0; while(buddies) { @@ -323,50 +324,50 @@ buddies = buddies->next; } aim_bos_setbuddylist(gaim_sess, gaim_conn, buf); -#endif + } } void serv_remove_buddy(char *name) { -#ifndef USE_OSCAR - char buf[1024]; - g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); - sflap_send(buf, -1, TYPE_DATA); -#else - aim_remove_buddy(gaim_sess, gaim_conn, name); -#endif + if (!USE_OSCAR) { + char buf[1024]; + g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); + sflap_send(buf, -1, TYPE_DATA); + } else { + aim_remove_buddy(gaim_sess, gaim_conn, name); + } } void serv_add_permit(char *name) { -#ifndef USE_OSCAR - char buf[1024]; - g_snprintf(buf, sizeof(buf), "toc_add_permit %s", normalize(name)); - sflap_send(buf, -1, TYPE_DATA); -#else - serv_set_permit_deny(); -#endif + if (!USE_OSCAR) { + char buf[1024]; + g_snprintf(buf, sizeof(buf), "toc_add_permit %s", normalize(name)); + sflap_send(buf, -1, TYPE_DATA); + } else { + serv_set_permit_deny(); + } } void serv_add_deny(char *name) { -#ifndef USE_OSCAR - char buf[1024]; - g_snprintf(buf, sizeof(buf), "toc_add_deny %s", normalize(name)); - sflap_send(buf, -1, TYPE_DATA); -#else - serv_set_permit_deny(); -#endif + if (!USE_OSCAR) { + char buf[1024]; + g_snprintf(buf, sizeof(buf), "toc_add_deny %s", normalize(name)); + sflap_send(buf, -1, TYPE_DATA); + } else { + serv_set_permit_deny(); + } } void serv_set_permit_deny() { -#ifndef USE_OSCAR + if (!USE_OSCAR) { char buf[MSG_LEN]; int at; GList *list; @@ -401,7 +402,7 @@ buf[at] = 0; sflap_send(buf, -1, TYPE_DATA); } -#else + } else { /* oscar requires us to do everyone at once (?) */ /* I think this code is OK now. */ char buf[BUF_LONG]; int at; GList *list, *grp, *bud; @@ -439,30 +440,30 @@ aim_bos_changevisibility(gaim_sess, gaim_conn, AIM_VISIBILITYCHANGE_DENYADD, buf); } -#endif + } } void serv_set_idle(int time) { -#ifndef USE_OSCAR - char buf[256]; - g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time); - sflap_send(buf, -1, TYPE_DATA); -#else - aim_bos_setidle(gaim_sess, gaim_conn, time); -#endif + if (!USE_OSCAR) { + char buf[256]; + g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time); + sflap_send(buf, -1, TYPE_DATA); + } else { + aim_bos_setidle(gaim_sess, gaim_conn, time); + } } void serv_warn(char *name, int anon) { -#ifndef USE_OSCAR - char *send = g_malloc(256); - g_snprintf(send, 255, "toc_evil %s %s", name, - ((anon) ? "anon" : "norm")); - sflap_send(send, -1, TYPE_DATA); - g_free(send); -#endif + if (!USE_OSCAR) { + char *send = g_malloc(256); + g_snprintf(send, 255, "toc_evil %s %s", name, + ((anon) ? "anon" : "norm")); + sflap_send(send, -1, TYPE_DATA); + g_free(send); + } } void serv_build_config(char *buf, int len) { @@ -472,79 +473,77 @@ void serv_save_config() { -#ifndef USE_OSCAR - char *buf = g_malloc(BUF_LONG); - char *buf2 = g_malloc(MSG_LEN); - serv_build_config(buf, BUF_LONG / 2); - g_snprintf(buf2, MSG_LEN, "toc_set_config {%s}", buf); - sflap_send(buf2, -1, TYPE_DATA); - g_free(buf2); - g_free(buf); -#endif + if (!USE_OSCAR) { + char *buf = g_malloc(BUF_LONG); + char *buf2 = g_malloc(MSG_LEN); + serv_build_config(buf, BUF_LONG / 2); + g_snprintf(buf2, MSG_LEN, "toc_set_config {%s}", buf); + sflap_send(buf2, -1, TYPE_DATA); + g_free(buf2); + g_free(buf); + } } void serv_accept_chat(int i) { -#ifndef USE_OSCAR - char *buf = g_malloc(256); - g_snprintf(buf, 255, "toc_chat_accept %d", i); - sflap_send(buf, -1, TYPE_DATA); - g_free(buf); -#else + if (!USE_OSCAR) { + char *buf = g_malloc(256); + g_snprintf(buf, 255, "toc_chat_accept %d", i); + sflap_send(buf, -1, TYPE_DATA); + g_free(buf); + } else { /* this should never get called because libfaim doesn't use the id * (i'm not even sure Oscar does). go through serv_join_chat instead */ -#endif + } } void serv_join_chat(int exchange, char *name) { -#ifndef USE_OSCAR - char buf[BUF_LONG]; - g_snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name); - sflap_send(buf, -1, TYPE_DATA); -#else - sprintf(debug_buff, "Attempting to join chat room %s.\n", name); - debug_print(debug_buff); - /* aim_bos_reqservice(gaim_sess, gaim_conn, AIM_CONN_TYPE_CHATNAV); */ - /* aim_chatnav_createroom(gaim_sess, aim_getconn_type(gaim_sess, AIM_CONN_TYPE_CHATNAV), name, 0x0004); */ - aim_chat_join(gaim_sess, gaim_conn, 0x0004, name); -#endif + if (!USE_OSCAR) { + char buf[BUF_LONG]; + g_snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name); + sflap_send(buf, -1, TYPE_DATA); + } else { + sprintf(debug_buff, "Attempting to join chat room %s.\n", name); + debug_print(debug_buff); + aim_chat_join(gaim_sess, gaim_conn, 0x0004, name); + } } void serv_chat_invite(int id, char *message, char *name) { -#ifndef USE_OSCAR - char buf[BUF_LONG]; - g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name)); - sflap_send(buf, -1, TYPE_DATA); -#else - GList *bcs = buddy_chats; - struct buddy_chat *b = NULL; + if (!USE_OSCAR) { + char buf[BUF_LONG]; + g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name)); + sflap_send(buf, -1, TYPE_DATA); + } else { + GList *bcs = buddy_chats; + struct buddy_chat *b = NULL; - while (bcs) { - b = (struct buddy_chat *)bcs->data; - if (id == b->id) - break; - bcs = bcs->next; - b = NULL; + while (bcs) { + b = (struct buddy_chat *)bcs->data; + if (id == b->id) + break; + bcs = bcs->next; + b = NULL; + } + + if (!b) + return; + + aim_chat_invite(gaim_sess, gaim_conn, name, message, 0x4, b->name, 0x1); } - - if (!b) - return; - - aim_chat_invite(gaim_sess, gaim_conn, name, message, 0x4, b->name, 0x1); -#endif } void serv_chat_leave(int id) { -#ifndef USE_OSCAR - char *buf = g_malloc(256); - g_snprintf(buf, 255, "toc_chat_leave %d", id); - sflap_send(buf, -1, TYPE_DATA); - g_free(buf); -#else + if (!USE_OSCAR) { + char *buf = g_malloc(256); + g_snprintf(buf, 255, "toc_chat_leave %d", id); + sflap_send(buf, -1, TYPE_DATA); + g_free(buf); + } else { GList *bcs = buddy_chats; struct buddy_chat *b = NULL; struct chat_connection *c = NULL; @@ -576,45 +575,45 @@ } /* we do this because with Oscar it doesn't tell us we left */ serv_got_chat_left(b->id); -#endif + } } void serv_chat_whisper(int id, char *who, char *message) { -#ifndef USE_OSCAR - char buf2[MSG_LEN]; - g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message); - sflap_send(buf2, -1, TYPE_DATA); -#else - do_error_dialog("Sorry, Oscar doesn't whisper. Send an IM. (The last message was not received.)", - "Gaim - Chat"); -#endif + if (!USE_OSCAR) { + char buf2[MSG_LEN]; + g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message); + sflap_send(buf2, -1, TYPE_DATA); + } else { + do_error_dialog("Sorry, Oscar doesn't whisper. Send an IM. (The last message was not received.)", + "Gaim - Chat"); + } } void serv_chat_send(int id, char *message) { -#ifndef USE_OSCAR - char buf[MSG_LEN]; - g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message); - sflap_send(buf, -1, TYPE_DATA); -#else - struct aim_conn_t *cn; - GList *bcs = buddy_chats; - struct buddy_chat *b = NULL; + if (!USE_OSCAR) { + char buf[MSG_LEN]; + g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message); + sflap_send(buf, -1, TYPE_DATA); + } else { + struct aim_conn_t *cn; + GList *bcs = buddy_chats; + struct buddy_chat *b = NULL; - while (bcs) { - b = (struct buddy_chat *)bcs->data; - if (id == b->id) - break; - bcs = bcs->next; - b = NULL; + while (bcs) { + b = (struct buddy_chat *)bcs->data; + if (id == b->id) + break; + bcs = bcs->next; + b = NULL; + } + if (!b) + return; + + cn = aim_chat_getconn(gaim_sess, b->name); + aim_chat_send_im(gaim_sess, cn, message); } - if (!b) - return; - - cn = aim_chat_getconn(gaim_sess, b->name); - aim_chat_send_im(gaim_sess, cn, message); -#endif } @@ -883,16 +882,16 @@ static void chat_invite_callback(GtkWidget *w, GtkWidget *w2) { -#ifndef USE_OSCAR - int i = (int)gtk_object_get_user_data(GTK_OBJECT(w2)); - serv_accept_chat(i); - gtk_widget_destroy(w2); -#else - char *i = (char *)gtk_object_get_user_data(GTK_OBJECT(w2)); - serv_join_chat(0, i); /* for oscar, it doesn't use the id anyway */ - g_free(i); - gtk_widget_destroy(w2); -#endif + if (!USE_OSCAR) { + int i = (int)gtk_object_get_user_data(GTK_OBJECT(w2)); + serv_accept_chat(i); + gtk_widget_destroy(w2); + } else { + char *i = (char *)gtk_object_get_user_data(GTK_OBJECT(w2)); + serv_join_chat(0, i); /* for oscar, it doesn't use the id anyway */ + g_free(i); + gtk_widget_destroy(w2); + } } @@ -946,11 +945,11 @@ /* gtk_widget_set_usize(d, 200, 110); */ -#ifndef USE_OSCAR - gtk_object_set_user_data(GTK_OBJECT(d), (void *)id); -#else - gtk_object_set_user_data(GTK_OBJECT(d), (void *)g_strdup(name)); -#endif + + if (!USE_OSCAR) + gtk_object_set_user_data(GTK_OBJECT(d), (void *)id); + else + gtk_object_set_user_data(GTK_OBJECT(d), (void *)g_strdup(name)); gtk_window_set_title(GTK_WINDOW(d), "Buddy chat invite"); @@ -1074,20 +1073,17 @@ void serv_rvous_accept(char *name, char *cookie, char *uid) { -#ifndef USE_OSCAR + /* Oscar doesn't matter here because this won't ever be called for it */ char buf[MSG_LEN]; g_snprintf(buf, MSG_LEN, "toc_rvous_accept %s %s %s", normalize(name), cookie, uid); sflap_send(buf, strlen(buf), TYPE_DATA); -#endif } void serv_rvous_cancel(char *name, char *cookie, char *uid) { -#ifndef USE_OSCAR char buf[MSG_LEN]; g_snprintf(buf, MSG_LEN, "toc_rvous_cancel %s %s %s", normalize(name), cookie, uid); sflap_send(buf, strlen(buf), TYPE_DATA); -#endif }
--- a/src/toc.c Mon Jun 19 21:58:32 2000 +0000 +++ b/src/toc.c Wed Jun 21 19:33:58 2000 +0000 @@ -38,7 +38,6 @@ #include "gaim.h" #include "gnome_applet_mgr.h" -#ifndef USE_OSCAR /* descriptor for talking to TOC */ @@ -827,8 +826,6 @@ return NULL; } -#endif /* USE_OSCAR */ - void toc_build_config(char *s, int len) { GList *grp = groups;
--- a/src/util.c Mon Jun 19 21:58:32 2000 +0000 +++ b/src/util.c Wed Jun 21 19:33:58 2000 +0000 @@ -408,7 +408,7 @@ /* we only need this for TOC, because messages must be escaped */ int escape_message(char *msg) { -#ifndef USE_OSCAR +if (!USE_OSCAR) { char *c, *cpy; int cnt=0; /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */ @@ -438,15 +438,15 @@ msg[cnt]='\0'; g_free(cpy); return cnt; -#else +} else { return strlen(msg); -#endif +} } /* we don't need this for oscar either */ int escape_text(char *msg) { -#ifndef USE_OSCAR +if (!USE_OSCAR) { char *c, *cpy; int cnt=0; /* Assumes you have a buffer able to cary at least BUF_LEN * 4 bytes */ @@ -479,9 +479,9 @@ msg[cnt]='\0'; g_free(cpy); return cnt; -#else +} else { return strlen(msg); -#endif +} } char * escape_text2(char *msg)