Mercurial > pidgin.yaz
comparison src/protocols/oscar/oscar.c @ 11338:17142948653e
[gaim-migrate @ 13551]
Change the GAIM_CONV_IM and GAIM_CONV_CHAT enums to GAIM_CONV_TYPE_IM
and GAIM_CONV_TYPE_CHAT. This touched A LOT of files. Also combined
two oscar header files (one of them was small and dorky).
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 25 Aug 2005 02:33:44 +0000 |
parents | 10066662176a |
children | 6c1ad49fcb4b |
comparison
equal
deleted
inserted
replaced
11337:1462b64f8fc9 | 11338:17142948653e |
---|---|
59 #define OSCAR_STATUS_ID_CUSTOM "custom" | 59 #define OSCAR_STATUS_ID_CUSTOM "custom" |
60 | 60 |
61 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" | 61 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
62 | 62 |
63 #define OSCAR_CONNECT_STEPS 6 | 63 #define OSCAR_CONNECT_STEPS 6 |
64 #define OSCAR_DEFAULT_LOGIN_SERVER "login.oscar.aol.com" | |
65 #define OSCAR_DEFAULT_LOGIN_PORT 5190 | |
64 #define OSCAR_DEFAULT_CUSTOM_ENCODING "ISO-8859-1" | 66 #define OSCAR_DEFAULT_CUSTOM_ENCODING "ISO-8859-1" |
65 #define OSCAR_DEFAULT_AUTHORIZATION TRUE | 67 #define OSCAR_DEFAULT_AUTHORIZATION TRUE |
66 #define OSCAR_DEFAULT_HIDE_IP TRUE | 68 #define OSCAR_DEFAULT_HIDE_IP TRUE |
67 #define OSCAR_DEFAULT_WEB_AWARE FALSE | 69 #define OSCAR_DEFAULT_WEB_AWARE FALSE |
68 | 70 |
950 if (dim->connected) | 952 if (dim->connected) |
951 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), dim->name); | 953 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), dim->name); |
952 else | 954 else |
953 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), dim->name); | 955 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), dim->name); |
954 | 956 |
955 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, dim->name, | 957 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, dim->name, |
956 gaim_connection_get_account(dim->gc)); | 958 gaim_connection_get_account(dim->gc)); |
957 if (conv) { | 959 if (conv) { |
958 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); | 960 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
959 gaim_conversation_update_progress(conv, 0); | 961 gaim_conversation_update_progress(conv, 0); |
960 } else { | 962 } else { |
1028 } | 1030 } |
1029 } | 1031 } |
1030 | 1032 |
1031 dim->conn->fd = source; | 1033 dim->conn->fd = source; |
1032 aim_conn_completeconnect(od->sess, dim->conn); | 1034 aim_conn_completeconnect(od->sess, dim->conn); |
1033 conv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name); | 1035 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, dim->gc->account, dim->name); |
1034 | 1036 |
1035 /* This is the best way to see if we're connected or not */ | 1037 /* This is the best way to see if we're connected or not */ |
1036 /* Is this really needed? */ | 1038 /* Is this really needed? */ |
1037 if (getpeername(source, &name, &name_len) == 0) { | 1039 if (getpeername(source, &name, &name_len) == 0) { |
1038 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); | 1040 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); |
1113 host = g_strndup(d->ip, i); | 1115 host = g_strndup(d->ip, i); |
1114 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; | 1116 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
1115 dim->gpc_pend = TRUE; | 1117 dim->gpc_pend = TRUE; |
1116 rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); | 1118 rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
1117 | 1119 |
1118 conv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, d->sn); | 1120 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, dim->gc->account, d->sn); |
1119 tmp = g_strdup_printf(_("Attempting to connect to %s at %s:%hu for Direct IM."), d->sn, host, | 1121 tmp = g_strdup_printf(_("Attempting to connect to %s at %s:%hu for Direct IM."), d->sn, host, |
1120 port); | 1122 port); |
1121 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); | 1123 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); |
1122 g_free(tmp); | 1124 g_free(tmp); |
1123 | 1125 |
1159 | 1161 |
1160 gaim_debug_info("oscar", | 1162 gaim_debug_info("oscar", |
1161 "DirectIM: initiate success to %s\n", sn); | 1163 "DirectIM: initiate success to %s\n", sn); |
1162 dim = oscar_direct_im_find(od, sn); | 1164 dim = oscar_direct_im_find(od, sn); |
1163 | 1165 |
1164 conv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, sn); | 1166 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, dim->gc->account, sn); |
1165 gaim_input_remove(dim->watcher); | 1167 gaim_input_remove(dim->watcher); |
1166 dim->conn = newconn; | 1168 dim->conn = newconn; |
1167 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); | 1169 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
1168 dim->connected = TRUE; | 1170 dim->connected = TRUE; |
1169 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); | 1171 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
1202 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | 1204 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ |
1203 /* The callback will callback? I don't get how that would happen here. */ | 1205 /* The callback will callback? I don't get how that would happen here. */ |
1204 dim->watcher = 0; | 1206 dim->watcher = 0; |
1205 } | 1207 } |
1206 | 1208 |
1207 c = gaim_find_conversation_with_account(GAIM_CONV_IM, sn, | 1209 c = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, sn, |
1208 gaim_connection_get_account(gc)); | 1210 gaim_connection_get_account(gc)); |
1209 if (c != NULL) | 1211 if (c != NULL) |
1210 gaim_conversation_update_progress(c, percent); | 1212 gaim_conversation_update_progress(c, percent); |
1211 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, | 1213 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
1212 oscar_callback, dim->conn); | 1214 oscar_callback, dim->conn); |
1539 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, | 1541 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
1540 oscar_callback, dim->conn); | 1542 oscar_callback, dim->conn); |
1541 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, | 1543 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, |
1542 gaim_odc_initiate, 0); | 1544 gaim_odc_initiate, 0); |
1543 | 1545 |
1544 conv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, who); | 1546 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, dim->gc->account, who); |
1545 tmp = g_strdup_printf(_("Asking %s to connect to us at %s:%hu for Direct IM."), who, ip, | 1547 tmp = g_strdup_printf(_("Asking %s to connect to us at %s:%hu for Direct IM."), who, ip, |
1546 gaim_network_get_port_from_fd(listenfd)); | 1548 gaim_network_get_port_from_fd(listenfd)); |
1547 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); | 1549 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); |
1548 g_free(tmp); | 1550 g_free(tmp); |
1549 } else { | 1551 } else { |
1807 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | 1809 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); |
1808 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); | 1810 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
1809 aim_conn_addhandler(sess, conn, AIM_CB_FAM_ATH, AIM_CB_ATH_SECURID_REQUEST, gaim_parse_auth_securid_request, 0); | 1811 aim_conn_addhandler(sess, conn, AIM_CB_FAM_ATH, AIM_CB_ATH_SECURID_REQUEST, gaim_parse_auth_securid_request, 0); |
1810 | 1812 |
1811 conn->status |= AIM_CONN_STATUS_INPROGRESS; | 1813 conn->status |= AIM_CONN_STATUS_INPROGRESS; |
1812 if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), | 1814 if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER), |
1813 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), | 1815 gaim_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT), |
1814 oscar_login_connect, gc) < 0) { | 1816 oscar_login_connect, gc) < 0) { |
1815 gaim_connection_error(gc, _("Couldn't connect to host")); | 1817 gaim_connection_error(gc, _("Couldn't connect to host")); |
1816 return; | 1818 return; |
1817 } | 1819 } |
1818 | 1820 |
2295 char *host; int port; | 2297 char *host; int port; |
2296 int i, rc; | 2298 int i, rc; |
2297 va_list ap; | 2299 va_list ap; |
2298 struct aim_authresp_info *info; | 2300 struct aim_authresp_info *info; |
2299 | 2301 |
2300 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); | 2302 port = gaim_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT); |
2301 | 2303 |
2302 va_start(ap, fr); | 2304 va_start(ap, fr); |
2303 info = va_arg(ap, struct aim_authresp_info *); | 2305 info = va_arg(ap, struct aim_authresp_info *); |
2304 va_end(ap); | 2306 va_end(ap); |
2305 | 2307 |
2890 char *host; | 2892 char *host; |
2891 int port; | 2893 int port; |
2892 va_list ap; | 2894 va_list ap; |
2893 struct aim_redirect_data *redir; | 2895 struct aim_redirect_data *redir; |
2894 | 2896 |
2895 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); | 2897 port = gaim_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT); |
2896 | 2898 |
2897 va_start(ap, fr); | 2899 va_start(ap, fr); |
2898 redir = va_arg(ap, struct aim_redirect_data *); | 2900 redir = va_arg(ap, struct aim_redirect_data *); |
2899 va_end(ap); | 2901 va_end(ap); |
2900 | 2902 |
5120 } | 5122 } |
5121 | 5123 |
5122 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) | 5124 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
5123 { | 5125 { |
5124 GaimConnection *gc = sess->aux_data; | 5126 GaimConnection *gc = sess->aux_data; |
5127 GaimAccount *account = gaim_connection_get_account(gc); | |
5125 OscarData *od = (OscarData *)gc->proto_data; | 5128 OscarData *od = (OscarData *)gc->proto_data; |
5126 va_list ap; | 5129 va_list ap; |
5127 fu16_t maxsiglen; | 5130 fu16_t maxsiglen; |
5128 | 5131 |
5129 va_start(ap, fr); | 5132 va_start(ap, fr); |
5137 | 5140 |
5138 if (od->icq) | 5141 if (od->icq) |
5139 aim_locate_setcaps(od->sess, caps_icq); | 5142 aim_locate_setcaps(od->sess, caps_icq); |
5140 else | 5143 else |
5141 aim_locate_setcaps(od->sess, caps_aim); | 5144 aim_locate_setcaps(od->sess, caps_aim); |
5142 oscar_set_info(gc, gc->account->user_info); | 5145 oscar_set_info(gc, account->user_info); |
5146 /* TODO: Should set the status here, as well. */ | |
5143 | 5147 |
5144 return 1; | 5148 return 1; |
5145 } | 5149 } |
5146 | 5150 |
5147 static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) { | 5151 static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5639 struct aim_sendimext_args args; | 5643 struct aim_sendimext_args args; |
5640 struct stat st; | 5644 struct stat st; |
5641 gsize len; | 5645 gsize len; |
5642 GaimConversation *conv; | 5646 GaimConversation *conv; |
5643 | 5647 |
5644 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, name, account); | 5648 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, account); |
5645 | 5649 |
5646 if (strstr(message, "<IMG ")) | 5650 if (strstr(message, "<IMG ")) |
5647 gaim_conversation_write(conv, "", | 5651 gaim_conversation_write(conv, "", |
5648 _("Your IM Image was not sent. " | 5652 _("Your IM Image was not sent. " |
5649 "You must be Direct Connected to send IM Images."), | 5653 "You must be Direct Connected to send IM Images."), |
7797 static void | 7801 static void |
7798 init_plugin(GaimPlugin *plugin) | 7802 init_plugin(GaimPlugin *plugin) |
7799 { | 7803 { |
7800 GaimAccountOption *option; | 7804 GaimAccountOption *option; |
7801 | 7805 |
7802 option = gaim_account_option_string_new(_("Auth host"), "server", FAIM_LOGIN_SERVER); | 7806 option = gaim_account_option_string_new(_("Auth host"), "server", OSCAR_DEFAULT_LOGIN_SERVER); |
7803 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 7807 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
7804 | 7808 |
7805 option = gaim_account_option_int_new(_("Auth port"), "port", FAIM_LOGIN_PORT); | 7809 option = gaim_account_option_int_new(_("Auth port"), "port", OSCAR_DEFAULT_LOGIN_PORT); |
7806 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 7810 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
7807 | 7811 |
7808 option = gaim_account_option_string_new(_("Encoding"), "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); | 7812 option = gaim_account_option_string_new(_("Encoding"), "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); |
7809 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 7813 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
7810 | 7814 |
7811 gaim_prefs_add_none("/plugins/prpl/oscar"); | 7815 gaim_prefs_add_none("/plugins/prpl/oscar"); |
7812 gaim_prefs_add_bool("/plugins/prpl/oscar/recent_buddies", FALSE); | 7816 gaim_prefs_add_bool("/plugins/prpl/oscar/recent_buddies", FALSE); |
7813 gaim_prefs_add_bool("/plugins/prpl/oscar/show_idle", FALSE); | 7817 gaim_prefs_add_bool("/plugins/prpl/oscar/show_idle", FALSE); |
7814 } | 7818 } |
7815 | 7819 |