Mercurial > pidgin.yaz
comparison src/protocols/oscar/oscar.c @ 2706:e841b14b5b89
[gaim-migrate @ 2719]
oh
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 10 Nov 2001 08:02:40 +0000 |
parents | fee85ed7fc3f |
children | 34ddcb44a4d2 |
comparison
equal
deleted
inserted
replaced
2705:5f431eefb0f2 | 2706:e841b14b5b89 |
---|---|
238 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); | 238 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); |
239 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); | 239 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); |
240 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); | 240 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); |
241 static int gaim_memrequest (aim_session_t *, aim_frame_t*, ...); | 241 static int gaim_memrequest (aim_session_t *, aim_frame_t*, ...); |
242 static int gaim_selfinfo (aim_session_t *, aim_frame_t*, ...); | 242 static int gaim_selfinfo (aim_session_t *, aim_frame_t*, ...); |
243 static int gaim_offlinemsg (aim_session_t *, aim_frame_t*, ...); | |
244 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t*, ...); | |
243 | 245 |
244 static int gaim_directim_initiate (aim_session_t *, aim_frame_t *, ...); | 246 static int gaim_directim_initiate (aim_session_t *, aim_frame_t *, ...); |
245 static int gaim_directim_incoming (aim_session_t *, aim_frame_t *, ...); | 247 static int gaim_directim_incoming (aim_session_t *, aim_frame_t *, ...); |
246 static int gaim_directim_typing (aim_session_t *, aim_frame_t *, ...); | 248 static int gaim_directim_typing (aim_session_t *, aim_frame_t *, ...); |
247 | 249 |
443 debug_printf(_("Logging in %s\n"), user->username); | 445 debug_printf(_("Logging in %s\n"), user->username); |
444 if (isdigit(*user->username)) { | 446 if (isdigit(*user->username)) { |
445 odata->icq = TRUE; | 447 odata->icq = TRUE; |
446 /* this is odd but it's necessary for a proper do_import and do_export */ | 448 /* this is odd but it's necessary for a proper do_import and do_export */ |
447 gc->protocol = PROTO_ICQ; | 449 gc->protocol = PROTO_ICQ; |
448 } else | 450 gc->checkbox = _("Send offline message"); |
451 } else { | |
449 gc->protocol = PROTO_TOC; | 452 gc->protocol = PROTO_TOC; |
453 gc->flags |= OPT_CONN_HTML; | |
454 } | |
450 | 455 |
451 sess = g_new0(aim_session_t, 1); | 456 sess = g_new0(aim_session_t, 1); |
452 | 457 |
453 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); | 458 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); |
454 aim_setdebuggingcb(sess, oscar_debug); | 459 aim_setdebuggingcb(sess, oscar_debug); |
643 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); | 648 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
644 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | 649 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); |
645 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | 650 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); |
646 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | 651 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); |
647 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); | 652 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
653 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0); | |
654 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE, gaim_offlinemsgdone, 0); | |
648 | 655 |
649 ((struct oscar_data *)gc->proto_data)->conn = bosconn; | 656 ((struct oscar_data *)gc->proto_data)->conn = bosconn; |
650 for (i = 0; i < (int)strlen(info->bosip); i++) { | 657 for (i = 0; i < (int)strlen(info->bosip); i++) { |
651 if (info->bosip[i] == ':') { | 658 if (info->bosip[i] == ':') { |
652 port = atoi(&(info->bosip[i+1])); | 659 port = atoi(&(info->bosip[i+1])); |
1977 | 1984 |
1978 debug_printf("BOS rights: Max permit = %d / Max deny = %d\n", maxpermits, maxdenies); | 1985 debug_printf("BOS rights: Max permit = %d / Max deny = %d\n", maxpermits, maxdenies); |
1979 | 1986 |
1980 aim_clientready(sess, fr->conn); | 1987 aim_clientready(sess, fr->conn); |
1981 | 1988 |
1989 aim_icq_reqofflinemsgs(sess); | |
1990 | |
1982 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); | 1991 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
1983 | 1992 |
1993 return 1; | |
1994 } | |
1995 | |
1996 static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { | |
1997 va_list ap; | |
1998 struct aim_icq_offlinemsg *msg; | |
1999 struct gaim_connection *gc = sess->aux_data; | |
2000 | |
2001 va_start(ap, fr); | |
2002 msg = va_arg(ap, struct aim_icq_offlinemsg *); | |
2003 va_end(ap); | |
2004 | |
2005 if (msg->type == 0x0001) { | |
2006 char sender[32]; | |
2007 time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); | |
2008 g_snprintf(sender, sizeof(sender), "%lu", msg->sender); | |
2009 serv_got_im(gc, sender, msg->msg, 0, t); | |
2010 } else { | |
2011 debug_printf("unknown offline message type 0x%04x\n", msg->type); | |
2012 } | |
2013 | |
2014 return 1; | |
2015 } | |
2016 | |
2017 static int gaim_offlinemsgdone(aim_session_t *sess, aim_frame_t *fr, ...) | |
2018 { | |
2019 aim_icq_ackofflinemsgs(sess); | |
1984 return 1; | 2020 return 1; |
1985 } | 2021 } |
1986 | 2022 |
1987 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) { | 2023 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) { |
1988 va_list ap; | 2024 va_list ap; |
2086 struct direct_im *dim = find_direct_im(odata, name); | 2122 struct direct_im *dim = find_direct_im(odata, name); |
2087 int ret = 0; | 2123 int ret = 0; |
2088 if (dim) { | 2124 if (dim) { |
2089 ret = aim_send_im_direct(odata->sess, dim->conn, message); | 2125 ret = aim_send_im_direct(odata->sess, dim->conn, message); |
2090 } else { | 2126 } else { |
2091 if (imflags & IM_FLAG_AWAY) | 2127 if (imflags & IM_FLAG_AWAY) { |
2092 ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message); | 2128 ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message); |
2093 else { | 2129 } else if (imflags & IM_FLAG_CHECKBOX) { |
2130 ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_OFFLINE, message); | |
2131 } else { | |
2094 struct aim_sendimext_args args; | 2132 struct aim_sendimext_args args; |
2095 GSList *h = odata->hasicons; | 2133 GSList *h = odata->hasicons; |
2096 struct icon_req *ir = NULL; | 2134 struct icon_req *ir = NULL; |
2097 char *who = normalize(name); | 2135 char *who = normalize(name); |
2098 struct stat st; | 2136 struct stat st; |
2769 | 2807 |
2770 static struct prpl *my_protocol = NULL; | 2808 static struct prpl *my_protocol = NULL; |
2771 | 2809 |
2772 void oscar_init(struct prpl *ret) { | 2810 void oscar_init(struct prpl *ret) { |
2773 ret->protocol = PROTO_OSCAR; | 2811 ret->protocol = PROTO_OSCAR; |
2774 ret->options = OPT_PROTO_HTML | OPT_PROTO_BUDDY_ICON; | 2812 ret->options = OPT_PROTO_BUDDY_ICON; |
2775 ret->name = oscar_name; | 2813 ret->name = oscar_name; |
2776 ret->list_icon = oscar_list_icon; | 2814 ret->list_icon = oscar_list_icon; |
2777 ret->away_states = oscar_away_states; | 2815 ret->away_states = oscar_away_states; |
2778 ret->actions = oscar_actions; | 2816 ret->actions = oscar_actions; |
2779 ret->do_action = oscar_do_action; | 2817 ret->do_action = oscar_do_action; |