comparison src/server.c @ 1153:3063e6743913

[gaim-migrate @ 1163] handle the keepalives better. have ICQ force keepalives for connections, it's a bad hack but it's probably necessary for a UDP protocol. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 28 Nov 2000 04:12:06 +0000
parents cd96ca1aed02
children 4fd0d35826fe
comparison
equal deleted inserted replaced
1152:201ec77f3a60 1153:3063e6743913
65 bcs = gc->buddy_chats; 65 bcs = gc->buddy_chats;
66 } 66 }
67 67
68 if (gc->idle_timer > 0) 68 if (gc->idle_timer > 0)
69 gtk_timeout_remove(gc->idle_timer); 69 gtk_timeout_remove(gc->idle_timer);
70 gc->idle_timer = -1; 70 gc->idle_timer = 0;
71 71
72 if (gc->keepalive > 0) 72 if (gc->keepalive > 0)
73 gtk_timeout_remove(gc->keepalive); 73 gtk_timeout_remove(gc->keepalive);
74 gc->keepalive = -1; 74 gc->keepalive = 0;
75 75
76 if (gc->prpl && gc->prpl->close) 76 if (gc->prpl && gc->prpl->close)
77 (*gc->prpl->close)(gc); 77 (*gc->prpl->close)(gc);
78 78
79 account_offline(gc); 79 account_offline(gc);
109 serv_touch_idle(gc); 109 serv_touch_idle(gc);
110 110
111 time(&gc->login_time); 111 time(&gc->login_time);
112 112
113 serv_add_buddy(gc, gc->username); 113 serv_add_buddy(gc, gc->username);
114
115 update_keepalive(gc, gc->options & OPT_USR_KEEPALV);
114 } 116 }
115 117
116 118
117 119
118 void serv_send_im(struct gaim_connection *gc, char *name, char *message, int away) 120 void serv_send_im(struct gaim_connection *gc, char *name, char *message, int away)
702 chat_write(b, who, w, message); 704 chat_write(b, who, w, message);
703 } 705 }
704 706
705 void send_keepalive(gpointer d) { 707 void send_keepalive(gpointer d) {
706 struct gaim_connection *gc = (struct gaim_connection *)d; 708 struct gaim_connection *gc = (struct gaim_connection *)d;
707 debug_print("sending oscar NOP\n");
708 if (gc->prpl && gc->prpl->keepalive) 709 if (gc->prpl && gc->prpl->keepalive)
709 (*gc->prpl->keepalive)(gc); 710 (*gc->prpl->keepalive)(gc);
710 } 711 }
711 712
712 void update_keepalive(struct gaim_connection *gc, gboolean on) { 713 void update_keepalive(struct gaim_connection *gc, gboolean on) {
713 if (on && gc->keepalive < 0 && blist) { 714 if (on && !gc->keepalive && blist) {
714 debug_print("allowing NOP\n"); 715 debug_print("allowing NOP\n");
715 gc->keepalive = gtk_timeout_add(60000, (GtkFunction)send_keepalive, gc); 716 gc->keepalive = gtk_timeout_add(60000, (GtkFunction)send_keepalive, gc);
716 } else if (!on && gc->keepalive > -1) { 717 } else if (!on && gc->keepalive > 0) {
717 debug_print("removing NOP\n"); 718 debug_print("removing NOP\n");
718 gtk_timeout_remove(gc->keepalive); 719 gtk_timeout_remove(gc->keepalive);
719 gc->keepalive = -1; 720 gc->keepalive = 0;
720 } 721 }
721 } 722 }