comparison src/protocols/oscar/oscar.c @ 9992:7596ad640b56

[gaim-migrate @ 10905] Ta-ra-ra-boom de-ay, or something committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 09 Sep 2004 03:20:48 +0000
parents cc4b2125d05d
children 792a7409f6b0
comparison
equal deleted inserted replaced
9991:cc4b2125d05d 9992:7596ad640b56
2192 od->killme = TRUE; 2192 od->killme = TRUE;
2193 return 1; 2193 return 1;
2194 } 2194 }
2195 2195
2196 2196
2197 gaim_debug_misc("oscar", 2197 gaim_debug_misc("oscar", "Reg status: %hu\n", info->regstatus);
2198 "Reg status: %hu\n", info->regstatus);
2199 2198
2200 if (info->email) { 2199 if (info->email) {
2201 gaim_debug_misc("oscar", "Email: %s\n", info->email); 2200 gaim_debug_misc("oscar", "Email: %s\n", info->email);
2202 } else { 2201 } else {
2203 gaim_debug_misc("oscar", "Email is NULL\n"); 2202 gaim_debug_misc("oscar", "Email is NULL\n");
5533 static void 5532 static void
5534 oscar_set_status_aim(GaimAccount *account, GaimStatus *status) 5533 oscar_set_status_aim(GaimAccount *account, GaimStatus *status)
5535 { 5534 {
5536 GaimConnection *gc = gaim_account_get_connection(account); 5535 GaimConnection *gc = gaim_account_get_connection(account);
5537 OscarData *od = (OscarData *)gc->proto_data; 5536 OscarData *od = (OscarData *)gc->proto_data;
5538 GaimStatusType *statusType; 5537 GaimStatusType *status_type;
5539 GaimStatusPrimitive primitive; 5538 GaimStatusPrimitive primitive;
5540 GaimPresence *presence; 5539 GaimPresence *presence;
5541 const gchar *status_id; 5540 const gchar *status_id;
5542 int charset = 0; 5541 int charset = 0;
5543 gchar *text_html = NULL; 5542 gchar *text_html = NULL;
5544 char *msg = NULL; 5543 char *msg = NULL;
5545 gsize msglen = 0; 5544 gsize msglen = 0;
5546 5545
5547 statusType = gaim_status_get_type(status); 5546 status_type = gaim_status_get_type(status);
5548 primitive = gaim_status_type_get_primitive(statusType); 5547 primitive = gaim_status_type_get_primitive(status_type);
5549 status_id = gaim_status_get_id(status); 5548 status_id = gaim_status_get_id(status);
5550 presence = gaim_account_get_presence(account); 5549 presence = gaim_account_get_presence(account);
5551 5550
5552 if (primitive == GAIM_STATUS_HIDDEN) 5551 if (primitive == GAIM_STATUS_HIDDEN)
5553 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); 5552 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE);
5564 "completed. You remain in a \"present\" " 5563 "completed. You remain in a \"present\" "
5565 "state; try setting it again when you are " 5564 "state; try setting it again when you are "
5566 "fully connected.")); 5565 "fully connected."));
5567 5566
5568 status_id = gaim_status_get_name(status); 5567 status_id = gaim_status_get_name(status);
5569 if (status_id == NULL) { 5568
5569 if (primitive == GAIM_STATUS_AVAILABLE) {
5570 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); 5570 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0);
5571 return; 5571 return;
5572 } 5572 }
5573 text_html = gaim_strdup_withhtml(status_id); 5573 text_html = gaim_strdup_withhtml(status_id);
5574
5575 #if 0
5576 /* Set an available message */
5577 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0);
5578 aim_srv_setavailmsg(od->sess, text);
5579 #endif
5574 5580
5575 charset = oscar_charset_check(text_html); 5581 charset = oscar_charset_check(text_html);
5576 if (charset == AIM_CHARSET_UNICODE) { 5582 if (charset == AIM_CHARSET_UNICODE) {
5577 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); 5583 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
5578 aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg, 5584 aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg,
7141 NULL, FALSE, FALSE, NULL, 7147 NULL, FALSE, FALSE, NULL,
7142 _("Search"), G_CALLBACK(search_by_email_cb), 7148 _("Search"), G_CALLBACK(search_by_email_cb),
7143 _("Cancel"), NULL, gc); 7149 _("Cancel"), NULL, gc);
7144 } 7150 }
7145 7151
7146 static void oscar_setavailmsg(GaimConnection *gc, char *text) {
7147 OscarData *od = (OscarData *)gc->proto_data;
7148
7149 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0);
7150 aim_srv_setavailmsg(od->sess, text);
7151 }
7152
7153 static void oscar_show_setavailmsg(GaimPluginAction *action)
7154 {
7155 GaimConnection *gc = (GaimConnection *) action->context;
7156 gaim_request_input(gc, NULL, _("Available Message:"), NULL,
7157 _("I'm doing work and hoping for a distraction--IM me!"),
7158 TRUE, FALSE, NULL,
7159 _("OK"), G_CALLBACK(oscar_setavailmsg),
7160 _("Cancel"), NULL,
7161 gc);
7162 }
7163
7164 static void oscar_show_set_info(GaimPluginAction *action) 7152 static void oscar_show_set_info(GaimPluginAction *action)
7165 { 7153 {
7166 GaimConnection *gc = (GaimConnection *) action->context; 7154 GaimConnection *gc = (GaimConnection *) action->context;
7167 gaim_account_request_change_user_info(gaim_connection_get_account(gc)); 7155 gaim_account_request_change_user_info(gaim_connection_get_account(gc));
7168 } 7156 }
7243 act = gaim_plugin_action_new(_("Set User Info (URL)..."), 7231 act = gaim_plugin_action_new(_("Set User Info (URL)..."),
7244 oscar_show_set_info_icqurl); 7232 oscar_show_set_info_icqurl);
7245 m = g_list_append(m, act); 7233 m = g_list_append(m, act);
7246 } 7234 }
7247 7235
7248 if (!od->icq) {
7249 act = gaim_plugin_action_new(_("Set Available Message..."),
7250 oscar_show_setavailmsg);
7251 m = g_list_append(m, act);
7252 }
7253
7254 act = gaim_plugin_action_new(_("Change Password..."), 7236 act = gaim_plugin_action_new(_("Change Password..."),
7255 oscar_change_pass); 7237 oscar_change_pass);
7256 m = g_list_append(m, act); 7238 m = g_list_append(m, act);
7257 7239
7258 if (od->sess->authinfo->chpassurl) { 7240 if (od->sess->authinfo->chpassurl) {
7346 fu32_t presence; 7328 fu32_t presence;
7347 7329
7348 presence = aim_ssi_getpresence(sess->ssi.local); 7330 presence = aim_ssi_getpresence(sess->ssi.local);
7349 7331
7350 if (value) { 7332 if (value) {
7351 // presence |= 0x00400000; 7333 /* Based on the packet capture I thought it was the first one */
7334 /* Stu thinks it's the second one. */
7335 /* presence |= 0x00400000; */
7352 presence &= ~0x00020000; 7336 presence &= ~0x00020000;
7353 aim_ssi_setpresence(sess, presence); 7337 aim_ssi_setpresence(sess, presence);
7354 } else { 7338 } else {
7355 // presence &= ~0x00400000; 7339 /* presence &= ~0x00400000; */
7356 presence |= 0x00020000; 7340 presence |= 0x00020000;
7357 aim_ssi_setpresence(sess, presence); 7341 aim_ssi_setpresence(sess, presence);
7358 } 7342 }
7359 } 7343 }
7360 7344