comparison src/server.c @ 2382:569ae9f2bb89

[gaim-migrate @ 2395] big reorg of code. list.c contains 0 gtk. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 28 Sep 2001 07:46:36 +0000
parents 427ccd7dfdd2
children b4f2a53c0ee5
comparison
equal deleted inserted replaced
2381:427ccd7dfdd2 2382:569ae9f2bb89
51 "the protocol it uses loaded, or the protocol does " 51 "the protocol it uses loaded, or the protocol does "
52 "not have a login function."), _("Login Error")); 52 "not have a login function."), _("Login Error"));
53 } 53 }
54 } 54 }
55 55
56 static gboolean send_keepalive(gpointer d)
57 {
58 struct gaim_connection *gc = d;
59 if (gc->prpl && gc->prpl->keepalive)
60 (*gc->prpl->keepalive)(gc);
61 return TRUE;
62 }
63
64 static void update_keepalive(struct gaim_connection *gc, gboolean on)
65 {
66 if (on && !gc->keepalive) {
67 debug_printf("allowing NOP\n");
68 gc->keepalive = g_timeout_add(60000, send_keepalive, gc);
69 } else if (!on && gc->keepalive > 0) {
70 debug_printf("removing NOP\n");
71 g_source_remove(gc->keepalive);
72 gc->keepalive = 0;
73 }
74 }
75
56 void serv_close(struct gaim_connection *gc) 76 void serv_close(struct gaim_connection *gc)
57 { 77 {
58 while (gc->buddy_chats) { 78 while (gc->buddy_chats) {
59 struct conversation *b = gc->buddy_chats->data; 79 struct conversation *b = gc->buddy_chats->data;
60 gc->buddy_chats = g_slist_remove(gc->buddy_chats, b); 80 gc->buddy_chats = g_slist_remove(gc->buddy_chats, b);
63 83
64 if (gc->idle_timer > 0) 84 if (gc->idle_timer > 0)
65 g_source_remove(gc->idle_timer); 85 g_source_remove(gc->idle_timer);
66 gc->idle_timer = 0; 86 gc->idle_timer = 0;
67 87
68 if (gc->keepalive > 0) 88 update_keepalive(gc, FALSE);
69 g_source_remove(gc->keepalive);
70 gc->keepalive = 0;
71 89
72 if (gc->prpl && gc->prpl->close) 90 if (gc->prpl && gc->prpl->close)
73 (*gc->prpl->close)(gc); 91 (*gc->prpl->close)(gc);
74 92
75 account_offline(gc); 93 account_offline(gc);
912 w = 0; 930 w = 0;
913 931
914 chat_write(b, who, w, buf, mtime); 932 chat_write(b, who, w, buf, mtime);
915 g_free(buf); 933 g_free(buf);
916 } 934 }
917
918 void send_keepalive(gpointer d)
919 {
920 struct gaim_connection *gc = (struct gaim_connection *)d;
921 if (gc->prpl && gc->prpl->keepalive)
922 (*gc->prpl->keepalive)(gc);
923 }
924
925 void update_keepalive(struct gaim_connection *gc, gboolean on)
926 {
927 if (on && !gc->keepalive && blist) {
928 debug_printf("allowing NOP\n");
929 gc->keepalive = g_timeout_add(60000, send_keepalive, gc);
930 } else if (!on && gc->keepalive > 0) {
931 debug_printf("removing NOP\n");
932 g_source_remove(gc->keepalive);
933 gc->keepalive = 0;
934 }
935 }