Mercurial > pidgin
comparison src/protocols/oscar/oscar.c @ 10400:6a043ae92db6
[gaim-migrate @ 11631]
I'm about to go home for the holidays, so I figured I'd commit this before
I left so someone else could pick up on it while I'm gone.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 19 Dec 2004 20:32:32 +0000 |
parents | 3cf69ffdc25e |
children | 3e4ecbdf8d0a |
comparison
equal
deleted
inserted
replaced
10399:aab0c9508318 | 10400:6a043ae92db6 |
---|---|
1704 "Screen name sent, waiting for response\n"); | 1704 "Screen name sent, waiting for response\n"); |
1705 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); | 1705 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); |
1706 ck[1] = 0x65; | 1706 ck[1] = 0x65; |
1707 } | 1707 } |
1708 | 1708 |
1709 static void oscar_login(GaimAccount *account) { | 1709 static void oscar_login(GaimAccount *account, GaimStatus *status) { |
1710 aim_session_t *sess; | 1710 aim_session_t *sess; |
1711 aim_conn_t *conn; | 1711 aim_conn_t *conn; |
1712 GaimConnection *gc = gaim_account_get_connection(account); | 1712 GaimConnection *gc = gaim_account_get_connection(account); |
1713 OscarData *od = gc->proto_data = g_new0(OscarData, 1); | 1713 OscarData *od = gc->proto_data = g_new0(OscarData, 1); |
1714 GaimStatusType *status_type; | |
1715 GaimStatusPrimitive primitive; | |
1716 | |
1717 status_type = gaim_status_get_type(status); | |
1718 primitive = gaim_status_type_get_primitive(status_type); | |
1714 | 1719 |
1715 gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc); | 1720 gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc); |
1721 | |
1722 if (primitive == GAIM_STATUS_OFFLINE) | |
1723 return; | |
1716 | 1724 |
1717 if (!aim_snvalid(gaim_account_get_username(account))) { | 1725 if (!aim_snvalid(gaim_account_get_username(account))) { |
1718 gchar *buf; | 1726 gchar *buf; |
1719 buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), gaim_account_get_username(account)); | 1727 buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), gaim_account_get_username(account)); |
1720 gaim_connection_error(gc, buf); | 1728 gaim_connection_error(gc, buf); |
5551 | 5559 |
5552 static void | 5560 static void |
5553 oscar_set_status_aim(GaimAccount *account, GaimStatus *status) | 5561 oscar_set_status_aim(GaimAccount *account, GaimStatus *status) |
5554 { | 5562 { |
5555 GaimConnection *gc = gaim_account_get_connection(account); | 5563 GaimConnection *gc = gaim_account_get_connection(account); |
5556 OscarData *od = (OscarData *)gc->proto_data; | 5564 OscarData *od = NULL; |
5557 GaimStatusType *status_type; | 5565 GaimStatusType *status_type; |
5558 GaimStatusPrimitive primitive; | 5566 GaimStatusPrimitive primitive; |
5559 GaimPresence *presence; | 5567 GaimPresence *presence; |
5560 const gchar *status_id; | 5568 const gchar *status_id; |
5561 int charset = 0; | 5569 int charset = 0; |
5566 status_type = gaim_status_get_type(status); | 5574 status_type = gaim_status_get_type(status); |
5567 primitive = gaim_status_type_get_primitive(status_type); | 5575 primitive = gaim_status_type_get_primitive(status_type); |
5568 status_id = gaim_status_get_id(status); | 5576 status_id = gaim_status_get_id(status); |
5569 presence = gaim_account_get_presence(account); | 5577 presence = gaim_account_get_presence(account); |
5570 | 5578 |
5579 if (!gaim_status_is_active(status)) /* Is this right? I'm confused. */ | |
5580 return; | |
5581 | |
5571 gaim_debug_info("oscar", "Setting status to %s\n", status_id); | 5582 gaim_debug_info("oscar", "Setting status to %s\n", status_id); |
5572 | 5583 |
5573 if (od->rights.maxawaymsglen == 0) | 5584 if (gc) |
5585 od = (OscarData *)gc->proto_data; | |
5586 | |
5587 if (od && od->rights.maxawaymsglen == 0) | |
5574 gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."), | 5588 gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."), |
5575 _("You have probably requested to set your " | 5589 _("You have probably requested to set your " |
5576 "away message before the login procedure " | 5590 "away message before the login procedure " |
5577 "completed. You remain in a \"present\" " | 5591 "completed. You remain in a \"present\" " |
5578 "state; try setting it again when you are " | 5592 "state; try setting it again when you are " |
5579 "fully connected.")); | 5593 "fully connected.")); |
5580 | 5594 |
5581 if (primitive == GAIM_STATUS_AVAILABLE) { | 5595 if (primitive == GAIM_STATUS_AVAILABLE) { |
5582 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); | 5596 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
5583 | 5597 |
5584 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); | 5598 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
5679 | 5693 |
5680 static void | 5694 static void |
5681 oscar_set_status(GaimAccount *account, GaimStatus *status) | 5695 oscar_set_status(GaimAccount *account, GaimStatus *status) |
5682 { | 5696 { |
5683 GaimConnection *gc = gaim_account_get_connection(account); | 5697 GaimConnection *gc = gaim_account_get_connection(account); |
5684 OscarData *od = (OscarData *)gc->proto_data; | 5698 GaimStatusType *type = gaim_status_get_type(status); |
5685 | 5699 int primitive = gaim_status_type_get_primitive(type); |
5686 if (od->icq) | 5700 |
5687 oscar_set_status_icq(account, status); | 5701 if (primitive == !GAIM_STATUS_OFFLINE && !gc) { |
5688 else | 5702 gaim_account_connect(account, status); |
5689 oscar_set_status_aim(account, status); | 5703 } else if (primitive == GAIM_STATUS_OFFLINE && gc) { |
5690 | 5704 gaim_account_disconnect(account); |
5705 } else { | |
5706 | |
5707 if (aim_sn_is_icq(gaim_account_get_username(account))) | |
5708 oscar_set_status_icq(account, status); | |
5709 else | |
5710 oscar_set_status_aim(account, status); | |
5711 } | |
5691 return; | 5712 return; |
5692 } | 5713 } |
5693 | 5714 |
5694 static void | 5715 static void |
5695 oscar_warn(GaimConnection *gc, const char *name, gboolean anonymous) { | 5716 oscar_warn(GaimConnection *gc, const char *name, gboolean anonymous) { |
6866 g_return_val_if_fail(account != NULL, NULL); | 6887 g_return_val_if_fail(account != NULL, NULL); |
6867 | 6888 |
6868 /* Oscar-common status types */ | 6889 /* Oscar-common status types */ |
6869 type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, | 6890 type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, |
6870 OSCAR_STATUS_ID_OFFLINE, | 6891 OSCAR_STATUS_ID_OFFLINE, |
6871 _("Offline"), FALSE, FALSE, FALSE); | 6892 _("Offline"), FALSE, TRUE, FALSE); |
6872 status_types = g_list_append(status_types, type); | 6893 status_types = g_list_append(status_types, type); |
6873 | 6894 |
6874 type = gaim_status_type_new_full(GAIM_STATUS_ONLINE, | 6895 type = gaim_status_type_new_full(GAIM_STATUS_ONLINE, |
6875 OSCAR_STATUS_ID_ONLINE, | 6896 OSCAR_STATUS_ID_ONLINE, |
6876 _("Online"), FALSE, FALSE, FALSE); | 6897 _("Online"), FALSE, TRUE, FALSE); |
6877 status_types = g_list_append(status_types, type); | 6898 status_types = g_list_append(status_types, type); |
6878 | 6899 |
6879 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, | 6900 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, |
6880 OSCAR_STATUS_ID_AVAILABLE, | 6901 OSCAR_STATUS_ID_AVAILABLE, |
6881 _("Available"), TRUE, TRUE, FALSE, | 6902 _("Available"), TRUE, TRUE, FALSE, |