comparison src/server.c @ 2993:7239a392486c

[gaim-migrate @ 3006] 0.53 :) committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Sat, 02 Mar 2002 04:52:21 +0000
parents 8e924e4aa256
children 87fff45fa36b
comparison
equal deleted inserted replaced
2992:d16a0504f1c8 2993:7239a392486c
140 serv_add_buddy(gc, gc->username); 140 serv_add_buddy(gc, gc->username);
141 141
142 update_keepalive(gc, TRUE); 142 update_keepalive(gc, TRUE);
143 } 143 }
144 144
145 145 /* This should return the elapsed time in seconds in which Gaim will not send
146 * typing notifications.
147 * if it returns zero, it will not send any more typing notifications */
148 int serv_send_typing(struct gaim_connection *g, char *name) {
149 if (g && g->prpl && g->prpl->send_typing)
150 return g->prpl->send_typing(g, name);
151 else return 0;
152 }
153
154 void serv_send_typing_stopped(struct gaim_connection *g, char *name) {
155 if (g && g->prpl && g->prpl->send_typing_stopped)
156 g->prpl->send_typing_stopped(g, name);
157 }
146 158
147 int serv_send_im(struct gaim_connection *gc, char *name, char *message, int flags) 159 int serv_send_im(struct gaim_connection *gc, char *name, char *message, int flags)
148 { 160 {
149 int val = -EINVAL; 161 int val = -EINVAL;
150 if (gc->prpl && gc->prpl->send_im) 162 if (gc->prpl && gc->prpl->send_im)
151 val = gc->prpl->send_im(gc, name, message, flags); 163 val = gc->prpl->send_im(gc, name, message, flags);
152 164
153 if (!(flags & IM_FLAG_AWAY)) 165 if (!(flags & IM_FLAG_AWAY))
154 serv_touch_idle(gc); 166 serv_touch_idle(gc);
155 167
168 serv_send_typing_stopped(gc, name);
156 return val; 169 return val;
157 } 170 }
158 171
159 void serv_get_info(struct gaim_connection *g, char *name) 172 void serv_get_info(struct gaim_connection *g, char *name)
160 { 173 {
655 void serv_got_update(struct gaim_connection *gc, char *name, int loggedin, int evil, time_t signon, 668 void serv_got_update(struct gaim_connection *gc, char *name, int loggedin, int evil, time_t signon,
656 time_t idle, int type, guint caps) 669 time_t idle, int type, guint caps)
657 { 670 {
658 struct buddy *b = find_buddy(gc, name); 671 struct buddy *b = find_buddy(gc, name);
659 672
660 if (gc->prpl->options & OPT_PROTO_CORRECT_TIME) { 673 if (signon && (gc->prpl->options & OPT_PROTO_CORRECT_TIME)) {
661 char *tmp = g_strdup(normalize(name)); 674 char *tmp = g_strdup(normalize(name));
662 if (!g_strcasecmp(tmp, normalize(gc->username))) { 675 if (!g_strcasecmp(tmp, normalize(gc->username))) {
663 gc->evil = evil; 676 gc->evil = evil;
664 gc->correction_time = (signon - gc->login_time); 677 gc->correction_time = (signon - gc->login_time);
665 update_idle_times(); 678 update_idle_times();
746 gc->username, ((name == NULL)? "an anonymous person" : name), lev); 759 gc->username, ((name == NULL)? "an anonymous person" : name), lev);
747 760
748 do_error_dialog(buf2, _("Warned")); 761 do_error_dialog(buf2, _("Warned"));
749 } 762 }
750 763
751 764 void serv_got_typing(struct gaim_connection *gc, char *name, int timeout) {
765 struct conversation *cnv = find_conversation(name);
766 if (cnv) {
767 set_convo_gc(cnv, gc);
768 show_typing(cnv);
769 } else return;
770 plugin_event(event_got_typing, gc, name, 0, 0);
771 do_pounce(gc, name, OPT_POUNCE_TYPING);
772 if (timeout > 0) {
773 if (cnv->typing_timeout)
774 gtk_timeout_remove (cnv->typing_timeout);
775 cnv->typing_timeout = gtk_timeout_add(timeout * 1000,(GtkFunction)reset_typing,
776 g_strdup(name));
777 }
778 }
779
780 void serv_got_typing_stopped(struct gaim_connection *gc, char *name) {
781 struct conversation *c = find_conversation(name);
782 if (c->typing_timeout) {
783 gtk_timeout_remove (c->typing_timeout);
784 }
785 reset_typing(g_strdup(name));
786 }
752 787
753 static void close_invite(GtkWidget *w, GtkWidget *w2) 788 static void close_invite(GtkWidget *w, GtkWidget *w2)
754 { 789 {
755 GList *str = gtk_object_get_user_data(GTK_OBJECT(w2)); 790 GList *str = gtk_object_get_user_data(GTK_OBJECT(w2));
756 GList *tmp = str; 791 GList *tmp = str;