comparison src/protocols/oscar/oscar.c @ 10747:0e6b33463a3a

[gaim-migrate @ 12349] This gets rid of that "you tried to set your away message too early" error message for oscar. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 27 Mar 2005 04:52:55 +0000
parents 94cc67130789
children bf5e48215158
comparison
equal deleted inserted replaced
10746:1f51dd1a7f87 10747:0e6b33463a3a
5700 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); 5700 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr);
5701 g_free(errstr); 5701 g_free(errstr);
5702 } 5702 }
5703 5703
5704 g_free(text_html); 5704 g_free(text_html);
5705
5706 return;
5707 } 5705 }
5708 5706
5709 static void 5707 static void
5710 oscar_set_status_aim(GaimAccount *account, GaimStatus *status) 5708 oscar_set_status_aim(GaimAccount *account, GaimStatus *status)
5711 { 5709 {
5722 5720
5723 status_type = gaim_status_get_type(status); 5721 status_type = gaim_status_get_type(status);
5724 primitive = gaim_status_type_get_primitive(status_type); 5722 primitive = gaim_status_type_get_primitive(status_type);
5725 status_id = gaim_status_get_id(status); 5723 status_id = gaim_status_get_id(status);
5726 presence = gaim_account_get_presence(account); 5724 presence = gaim_account_get_presence(account);
5727
5728 gaim_debug_info("oscar", "Setting status to %s\n", status_id);
5729 5725
5730 if (gc) 5726 if (gc)
5731 od = (OscarData *)gc->proto_data; 5727 od = (OscarData *)gc->proto_data;
5732 5728
5733 if ((od == NULL) || (od->rights.maxawaymsglen == 0)) { 5729 if ((od == NULL) || (od->rights.maxawaymsglen == 0)) {
5838 else if (!strcmp(status_id, OSCAR_STATUS_ID_INVISIBLE)) 5834 else if (!strcmp(status_id, OSCAR_STATUS_ID_INVISIBLE))
5839 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); 5835 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE);
5840 5836
5841 else if (!strcmp(status_id, OSCAR_STATUS_ID_CUSTOM)) 5837 else if (!strcmp(status_id, OSCAR_STATUS_ID_CUSTOM))
5842 aim_setextstatus(od->sess, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); 5838 aim_setextstatus(od->sess, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
5843
5844 return;
5845 } 5839 }
5846 5840
5847 static void 5841 static void
5848 oscar_set_status(GaimAccount *account, GaimStatus *status) 5842 oscar_set_status(GaimAccount *account, GaimStatus *status)
5849 { 5843 {
5850 GaimConnection *gc = gaim_account_get_connection(account); 5844 gboolean connected = gaim_account_is_connected(account);
5851 GaimStatusType *type = gaim_status_get_type(status); 5845 GaimStatusType *type = gaim_status_get_type(status);
5852 int primitive = gaim_status_type_get_primitive(type); 5846 int primitive = gaim_status_type_get_primitive(type);
5853 5847
5848 gaim_debug_info("oscar", "Set status to %s\n", gaim_status_get_name(status));
5849
5854 if (!gaim_status_is_active(status)) 5850 if (!gaim_status_is_active(status))
5855 return; 5851 return;
5856 5852
5857 if (primitive == !GAIM_STATUS_OFFLINE && !gc) { 5853 if (primitive == !GAIM_STATUS_OFFLINE && !connected) {
5858 gaim_account_connect(account); 5854 gaim_account_connect(account);
5859 } else if (primitive == GAIM_STATUS_OFFLINE && gc) { 5855 } else if (primitive == GAIM_STATUS_OFFLINE && connected) {
5860 gaim_account_disconnect(account); 5856 gaim_account_disconnect(account);
5861 } else { 5857 } else {
5858 if (!connected)
5859 return;
5862 5860
5863 if (aim_sn_is_icq(gaim_account_get_username(account))) 5861 if (aim_sn_is_icq(gaim_account_get_username(account)))
5864 oscar_set_status_icq(account, status); 5862 oscar_set_status_icq(account, status);
5865 else 5863 else
5866 /* QQQ - Should probably also set this for ICQ */ 5864 /* QQQ - Should probably also set this for ICQ */
5867 oscar_set_status_aim(account, status); 5865 oscar_set_status_aim(account, status);
5868 } 5866 }
5869 return;
5870 } 5867 }
5871 5868
5872 static void 5869 static void
5873 oscar_warn(GaimConnection *gc, const char *name, gboolean anonymous) { 5870 oscar_warn(GaimConnection *gc, const char *name, gboolean anonymous) {
5874 OscarData *od = (OscarData *)gc->proto_data; 5871 OscarData *od = (OscarData *)gc->proto_data;
5875 aim_im_warn(od->sess, od->conn, name, anonymous ? AIM_WARN_ANON : 0); 5872 aim_im_warn(od->sess, od->conn, name, anonymous ? AIM_WARN_ANON : 0);
5876 } 5873 }
5877 5874
5878 static void oscar_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) { 5875 static void
5876 oscar_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) {
5879 OscarData *od = (OscarData *)gc->proto_data; 5877 OscarData *od = (OscarData *)gc->proto_data;
5880 5878
5881 if (!aim_snvalid(buddy->name)) { 5879 if (!aim_snvalid(buddy->name)) {
5882 gchar *buf; 5880 gchar *buf;
5883 buf = g_strdup_printf(_("Could not add the buddy %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."), buddy->name); 5881 buf = g_strdup_printf(_("Could not add the buddy %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."), buddy->name);