Mercurial > pidgin.yaz
changeset 242:14fc16f579c8
[gaim-migrate @ 252]
More updates to oscar.c (et al.) to use libfaim. Lots of good stuff now.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 20 May 2000 07:58:50 +0000 |
parents | 452993e3cdd2 |
children | 3414ff74cb0f |
files | libfaim/CHANGES.gaim src/gaim.h src/oscar.c src/server.c src/toc.c |
diffstat | 5 files changed, 102 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libfaim/CHANGES.gaim Sat May 20 06:17:50 2000 +0000 +++ b/libfaim/CHANGES.gaim Sat May 20 07:58:50 2000 +0000 @@ -1,3 +1,14 @@ +Sat May 20 06:29:31 UTC 2000 EWarmenhoven + - You can add and remove buddies now. It also tries to retrieve the + buddy list using the .gaimbdcache list, and saves it the same way + (remember the Oscar server doesn't save the list for us). + - When someone goes idle (e.g. 10 minutes idle), it appears as 266334.5 + hours idle. I'm not sure if that's my problem or libfaim's. + - Sometimes it segfaults when you try to sign in, sometimes it doesn't. + I can't figure out why. + - It still has the 2 second delay between display updates. I think I'm + going insane; it doesn't bug as much as it used to. + Sat May 20 00:16:25 UTC 2000 EWarmenhoven - First log entry! Yay! - Updated the libfaim code to the latest in CVS
--- a/src/gaim.h Sat May 20 06:17:50 2000 +0000 +++ b/src/gaim.h Sat May 20 07:58:50 2000 +0000 @@ -337,7 +337,7 @@ #define TYPE_SIGNOFF 4 #define TYPE_KEEPALIVE 5 -#define REVISION "gaim:$Revision: 247 $" +#define REVISION "gaim:$Revision: 252 $" #define FLAPON "FLAPON\r\n\r\n" #define ROAST "Tic/Toc" @@ -559,6 +559,7 @@ /* Functions in oscar.c */ extern int oscar_login(char *, char *); +extern void oscar_close(); extern int oscar_send_im(char *, char *, int); /* Functions in toc.c */
--- a/src/oscar.c Sat May 20 06:17:50 2000 +0000 +++ b/src/oscar.c Sat May 20 07:58:50 2000 +0000 @@ -39,8 +39,8 @@ #include "gnome_applet_mgr.h" static int inpa = -1; -static struct aim_session_t *gaim_sess; -static struct aim_conn_t *gaim_conn; +struct aim_session_t *gaim_sess; +struct aim_conn_t *gaim_conn; static int gaim_parse_auth_resp (struct aim_session_t *, struct command_rx_struct *, ...); static int gaim_auth_server_ready(struct aim_session_t *, struct command_rx_struct *, ...); @@ -53,6 +53,7 @@ static int gaim_parse_user_info (struct aim_session_t *, struct command_rx_struct *, ...); static int gaim_parse_unknown (struct aim_session_t *, struct command_rx_struct *, ...); static int gaim_parse_motd (struct aim_session_t *, struct command_rx_struct *, ...); +static int gaim_chatnav_info (struct aim_session_t *, struct command_rx_struct *, ...); static void oscar_callback(gpointer data, gint source, GdkInputCondition condition) { @@ -75,7 +76,7 @@ aim_logoff(sess); gdk_input_remove(inpa); break; - case 0: /* this should never happen because of the gdk_input */ + case 0: gdk_input_remove(inpa); while (gtk_events_pending()) gtk_main_iteration(); @@ -170,6 +171,17 @@ aim_send_im(gaim_sess, gaim_conn, name, 0, msg); } +void oscar_close() { +#ifdef USE_APPLET + setUserState(offline); +#endif + set_state(STATE_OFFLINE); + if (inpa > 0) + gdk_input_remove(inpa); + inpa = -1; + aim_logoff(gaim_sess); +} + int gaim_parse_auth_resp(struct aim_session_t *sess, struct command_rx_struct *command, ...) { struct aim_conn_t *bosconn = NULL; @@ -263,8 +275,14 @@ debug_print("done with BOS ServerReady\n"); break; case AIM_CONN_TYPE_CHATNAV: + aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); + aim_bos_reqrate(sess, command->conn); + aim_bos_ackrateresp(sess, command->conn); + aim_chatnav_clientready(sess, command->conn); + aim_chatnav_reqrights(sess, command->conn); break; case AIM_CONN_TYPE_CHAT: + /* FIXME */ break; default: /* huh? */ break; @@ -279,8 +297,7 @@ char *ip; char *cookie; - /* FIXME */ - char buddies[] = "EWarmenhoven&RobFlynn&Zilding&FlynOrange&"; + char buddies[] = "EWarmenhoven&"; char profile[] = "Hello"; va_start(ap, command); @@ -291,7 +308,8 @@ switch(serviceid) { case 0x0005: /* Ads */ aim_bos_setbuddylist(sess, command->conn, buddies); - aim_bos_setprofile(sess, command->conn, profile, NULL, AIM_CAPS_CHAT); + aim_bos_setprofile(sess, command->conn, profile, + NULL, AIM_CAPS_CHAT); aim_bos_clientready(sess, command->conn); @@ -316,6 +334,10 @@ show_buddy_list(); refresh_buddy_window(); #endif + serv_finish_login(); + if (bud_list_cache_exists()) + do_import(NULL, 0); + break; case 0x7: /* Authorizer */ { @@ -327,8 +349,19 @@ } break; case 0xd: /* ChatNav */ + { + struct aim_conn_t *tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, ip); + if (tstconn == NULL || tstconn->status >= AIM_CONN_STATUS_RESOLVERR) { + debug_print("unable to connect to chatnav server\n"); + return 1; + } + aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, gaim_server_ready, 0); + aim_auth_sendcookie(sess, tstconn, cookie); + } + debug_print("chatnav: connected\n"); break; case 0xe: /* Chat */ + /* FIXME */ break; default: /* huh? */ sprintf(debug_buff, "got redirect for unknown service 0x%04x\n", @@ -344,11 +377,40 @@ int gaim_parse_oncoming(struct aim_session_t *sess, struct command_rx_struct *command, ...) { + struct aim_userinfo_s *info; + int type = 0; + + va_list ap; + va_start(ap, command); + info = va_arg(ap, struct aim_userinfo_s *); + va_end(ap); + + if (info->class & AIM_CLASS_TRIAL) + type |= UC_UNCONFIRMED; + if (info->class & AIM_CLASS_AOL) + type |= UC_AOL; + if (info->class & AIM_CLASS_FREE) + type |= UC_NORMAL; + if (info->class & AIM_CLASS_AWAY) + type |= UC_UNAVAILABLE; + + serv_got_update(info->sn, 1, info->warnlevel, info->onlinesince, + info->idletime, type); + return 1; } int gaim_parse_offgoing(struct aim_session_t *sess, struct command_rx_struct *command, ...) { + char *sn; + va_list ap; + + va_start(ap, command); + sn = va_arg(ap, char *); + va_end(ap); + + serv_got_update(sn, 0, 0, 0, 0, 0); + return 1; } @@ -383,16 +445,19 @@ int gaim_parse_misses(struct aim_session_t *sess, struct command_rx_struct *command, ...) { + /* FIXME */ return 1; } int gaim_parse_user_info(struct aim_session_t *sess, struct command_rx_struct *command, ...) { + /* FIXME */ return 1; } int gaim_parse_unknown(struct aim_session_t *sess, struct command_rx_struct *command, ...) { + /* FIXME */ return 1; } @@ -413,4 +478,9 @@ return 1; } +int gaim_chatnav_info(struct aim_session_t *sess, + struct command_rx_struct *command, ...) { + /* FIXME */ + return 1; +} #endif /* USE_OSCAR */
--- a/src/server.c Sat May 20 06:17:50 2000 +0000 +++ b/src/server.c Sat May 20 07:58:50 2000 +0000 @@ -53,6 +53,8 @@ { #ifndef USE_OSCAR toc_close(); +#else + oscar_close(); #endif gtk_timeout_remove(idle_timer); idle_timer = -1; @@ -244,6 +246,8 @@ #ifndef USE_OSCAR 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 } @@ -265,6 +269,12 @@ buddies = buddies->next; } sflap_send(buf, -1, TYPE_DATA); +#else + /* oscar you have to add them one name at a time, except at login */ + while(buddies) { + serv_add_buddy((char *)buddies->data); + buddies = buddies->next; + } #endif } @@ -275,6 +285,8 @@ #ifndef USE_OSCAR 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 } @@ -359,9 +371,7 @@ } void serv_build_config(char *buf, int len) { -#ifndef USE_OSCAR toc_build_config(buf, len); -#endif }