comparison src/protocols/toc/toc.c @ 9058:cde9fb3546ed

[gaim-migrate @ 9834] Removed OPT_PROTO_CORRECT_TIME and moved some functionality out of the core and into oscar.c and toc.c committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 25 May 2004 03:54:12 +0000
parents 7ab20f829190
children 6d7bb1274755
comparison
equal deleted inserted replaced
9057:c55aa23bf56e 9058:cde9fb3546ed
22 22
23 #include "account.h" 23 #include "account.h"
24 #include "accountopt.h" 24 #include "accountopt.h"
25 #include "conversation.h" 25 #include "conversation.h"
26 #include "debug.h" 26 #include "debug.h"
27 #include "prpl.h" 27 #include "multi.h"
28 #include "notify.h" 28 #include "notify.h"
29 #include "proxy.h" 29 #include "proxy.h"
30 #include "prpl.h"
30 #include "request.h" 31 #include "request.h"
31 #include "util.h" 32 #include "util.h"
32 33
33 static GaimPlugin *my_protocol = NULL; 34 static GaimPlugin *my_protocol = NULL;
34 35
588 } 589 }
589 590
590 static void toc_callback(gpointer data, gint source, GaimInputCondition condition) 591 static void toc_callback(gpointer data, gint source, GaimInputCondition condition)
591 { 592 {
592 GaimConnection *gc = (GaimConnection *)data; 593 GaimConnection *gc = (GaimConnection *)data;
594 GaimAccount *account = gaim_connection_get_account(gc);
593 struct toc_data *tdt = (struct toc_data *)gc->proto_data; 595 struct toc_data *tdt = (struct toc_data *)gc->proto_data;
594 struct sflap_hdr *hdr; 596 struct sflap_hdr *hdr;
595 struct signon so; 597 struct signon so;
596 char buf[8 * 1024], *c; 598 char buf[8 * 1024], *c;
597 char snd[BUF_LEN * 2]; 599 char snd[BUF_LEN * 2];
598 600
599 const char *username = gaim_account_get_username(gc->account); 601 const char *username = gaim_account_get_username(account);
600 char *password; 602 char *password;
601 603
602 /* there's data waiting to be read, so read it. */ 604 /* there's data waiting to be read, so read it. */
603 if (wait_reply(gc, buf, 8 * 1024) <= 0) { 605 if (wait_reply(gc, buf, 8 * 1024) <= 0) {
604 gaim_connection_error(gc, _("Connection Closed")); 606 gaim_connection_error(gc, _("Connection Closed"));
668 670
669 tdt->state = STATE_ONLINE; 671 tdt->state = STATE_ONLINE;
670 672
671 gaim_connection_set_state(gc, GAIM_CONNECTED); 673 gaim_connection_set_state(gc, GAIM_CONNECTED);
672 serv_finish_login(gc); 674 serv_finish_login(gc);
675
676 /*
677 * Add me to my buddy list so that we know the time when
678 * the server thinks I signed on.
679 */
680 serv_add_buddy(gc, username, NULL);
673 681
674 /* Client sends TOC toc_init_done message */ 682 /* Client sends TOC toc_init_done message */
675 gaim_debug(GAIM_DEBUG_INFO, "toc", 683 gaim_debug(GAIM_DEBUG_INFO, "toc",
676 "Client sends TOC toc_init_done message\n"); 684 "Client sends TOC toc_init_done message\n");
677 g_snprintf(snd, sizeof snd, "toc_init_done"); 685 g_snprintf(snd, sizeof snd, "toc_init_done");
776 time(&time_idle); 784 time(&time_idle);
777 time_idle -= idle * 60; 785 time_idle -= idle * 60;
778 } else 786 } else
779 time_idle = 0; 787 time_idle = 0;
780 788
789 /*
790 * If we have info for ourselves then set our display name, warning
791 * level and official time of login.
792 */
781 tmp = g_strdup(gaim_normalize(gc->account, gaim_account_get_username(gc->account))); 793 tmp = g_strdup(gaim_normalize(gc->account, gaim_account_get_username(gc->account)));
782 if (!strcmp(tmp, gaim_normalize(gc->account, c))) 794 if (!strcmp(tmp, gaim_normalize(gc->account, c))) {
783 gaim_connection_set_display_name(gc, c); 795 gaim_connection_set_display_name(gc, c);
796 gc->evil = evil;
797 gc->login_time_official = signon;
798 }
784 g_free(tmp); 799 g_free(tmp);
785 800
786 serv_got_update(gc, c, logged, evil, signon, time_idle, type); 801 serv_got_update(gc, c, logged, evil, signon, time_idle, type);
787 } else if (!g_ascii_strcasecmp(c, "ERROR")) { 802 } else if (!g_ascii_strcasecmp(c, "ERROR")) {
788 gaim_notify_error(gc, NULL, show_error_message(), NULL); 803 gaim_notify_error(gc, NULL, show_error_message(), NULL);
1125 char buf[BUF_LEN * 2]; 1140 char buf[BUF_LEN * 2];
1126 1141
1127 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); 1142 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
1128 1143
1129 buddy = (GaimBuddy *) node; 1144 buddy = (GaimBuddy *) node;
1130 gc = gaim_acount_get_connection(buddy->account); 1145 gc = gaim_account_get_connection(buddy->account);
1131 1146
1132 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", 1147 g_snprintf(buf, MSG_LEN, "toc_get_dir %s",
1133 gaim_normalize(buddy->account, buddy->name)); 1148 gaim_normalize(buddy->account, buddy->name));
1134 sflap_send(gc, buf, -1, TYPE_DATA); 1149 sflap_send(gc, buf, -1, TYPE_DATA);
1135 } 1150 }
2101 #endif 2116 #endif
2102 2117
2103 static GaimPluginProtocolInfo prpl_info = 2118 static GaimPluginProtocolInfo prpl_info =
2104 { 2119 {
2105 GAIM_PRPL_API_VERSION, 2120 GAIM_PRPL_API_VERSION,
2106 OPT_PROTO_CORRECT_TIME, 2121 0,
2107 NULL, 2122 NULL,
2108 NULL, 2123 NULL,
2109 toc_list_icon, 2124 toc_list_icon,
2110 toc_list_emblems, 2125 toc_list_emblems,
2111 NULL, 2126 NULL,