Mercurial > pidgin.yaz
changeset 3001:87fff45fa36b
[gaim-migrate @ 3014]
Improved typing notification for Yahoo so that it sends and recieves notification that the user has stopped typing.
Also, combined serv_send_typing and serv_send_typing_stopped... expect the same with serv_got_typing_stopped.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 04 Mar 2002 04:18:02 +0000 |
parents | 6d95285533df |
children | 8851d33517e9 |
files | ChangeLog src/conversation.c src/gaim.h src/protocols/msn/msn.c src/protocols/oscar/oscar.c src/protocols/yahoo/yahoo.c src/prpl.h src/server.c |
diffstat | 8 files changed, 26 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Mar 04 03:04:49 2002 +0000 +++ b/ChangeLog Mon Mar 04 04:18:02 2002 +0000 @@ -3,6 +3,7 @@ version 0.54 * Compiles without GdkPixbuf again * GtkIMHtml will refresh when you set a new GTK+ theme + * Improved Yahoo! typing notification (thanks Brian Macke) version 0.53 (02/28/2002): * Updated Polish Translation (thanks Przemyslaw Sulek)
--- a/src/conversation.c Mon Mar 04 03:04:49 2002 +0000 +++ b/src/conversation.c Mon Mar 04 04:18:02 2002 +0000 @@ -903,7 +903,7 @@ char *txt = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, -1); if ((strlen(txt) == 0 && event->keyval < 256 && isprint(event->keyval)) || (c->type_again != 0 && time(NULL) > c->type_again)) { - int timeout = serv_send_typing(c->gc, c->name); + int timeout = serv_send_typing(c->gc, c->name, TRUE); if (timeout) c->type_again = time(NULL) + timeout; else @@ -912,11 +912,11 @@ else if (strlen(txt) == 1) { if ((GTK_OLD_EDITABLE(c->entry)->current_pos == 1 && event->keyval == GDK_BackSpace) || (GTK_OLD_EDITABLE(c->entry)->current_pos == 0 && event->keyval == GDK_Delete)) - serv_send_typing_stopped(c->gc, c->name); + serv_send_typing(c->gc, c->name, FALSE); } else if (GTK_OLD_EDITABLE(c->entry)->selection_start_pos == 0) { if (GTK_OLD_EDITABLE(c->entry)->selection_end_pos == strlen(txt) && (event->keyval == GDK_BackSpace || event->keyval == GDK_Delete)) - serv_send_typing_stopped(c->gc, c->name); + serv_send_typing(c->gc, c->name, FALSE); } g_free(txt); } @@ -2347,7 +2347,6 @@ return FALSE; } /* Reset the title (if necessary) */ - debug_printf("resetting style\n"); if (c->is_chat) { g_free(name); c->typing_timeout = 0;
--- a/src/gaim.h Mon Mar 04 03:04:49 2002 +0000 +++ b/src/gaim.h Mon Mar 04 04:18:02 2002 +0000 @@ -360,8 +360,7 @@ extern void serv_set_info(struct gaim_connection *, char *); extern void serv_set_away(struct gaim_connection *, char *, char *); extern void serv_set_away_all(char *); -extern int serv_send_typing(struct gaim_connection *, char *); -extern void serv_send_typing_stopped(struct gaim_connection *, char *); +extern int serv_send_typing(struct gaim_connection *, char *, int); extern void serv_change_passwd(struct gaim_connection *, char *, char *); extern void serv_add_buddy(struct gaim_connection *, char *); extern void serv_add_buddies(struct gaim_connection *, GList *);
--- a/src/protocols/msn/msn.c Mon Mar 04 03:04:49 2002 +0000 +++ b/src/protocols/msn/msn.c Mon Mar 04 04:18:02 2002 +0000 @@ -1484,15 +1484,15 @@ g_free(md); } -static int msn_send_typing(struct gaim_connection *gc, char *who) { +static int msn_send_typing(struct gaim_connection *gc, char *who, int typing) { struct msn_switchboard *ms = msn_find_switch(gc, who); char header[MSN_BUF_LEN] = "MIME-Version: 1.0\r\n" "Content-Type: text/x-msmsgscontrol\r\n" "User-Agent: Gaim/" VERSION "\r\n" "TypingUser: "; char buf [MSN_BUF_LEN]; - if (!ms) - return; + if (!ms || !typing) + return 0; g_snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s%s\r\n\r\n\r\n", ++ms->trId, strlen(header) + strlen("\r\n\r\n\r\n") + strlen(gc->username),
--- a/src/protocols/oscar/oscar.c Mon Mar 04 03:04:49 2002 +0000 +++ b/src/protocols/oscar/oscar.c Mon Mar 04 04:18:02 2002 +0000 @@ -2404,20 +2404,12 @@ return "Oscar"; } -static void oscar_send_typing_stopped(struct gaim_connection *gc, char *name) { - struct oscar_data *odata = (struct oscar_data *)gc->proto_data; - struct direct_im *dim = find_direct_im(odata, name); - if (!dim) - return; - aim_send_typing(odata->sess, dim->conn, FALSE); -} - -static int oscar_send_typing(struct gaim_connection *gc, char *name) { +static int oscar_send_typing(struct gaim_connection *gc, char *name, int typing) { struct oscar_data *odata = (struct oscar_data *)gc->proto_data; struct direct_im *dim = find_direct_im(odata, name); if (!dim) return 0; - aim_send_typing(odata->sess, dim->conn, TRUE); + aim_send_typing(odata->sess, dim->conn, typing); return 0; } @@ -3545,7 +3537,6 @@ ret->close = oscar_close; ret->send_im = oscar_send_im; ret->send_typing = oscar_send_typing; - ret->send_typing_stopped = oscar_send_typing_stopped; ret->set_info = oscar_set_info; ret->get_info = oscar_get_info; ret->set_away = oscar_set_away;
--- a/src/protocols/yahoo/yahoo.c Mon Mar 04 03:04:49 2002 +0000 +++ b/src/protocols/yahoo/yahoo.c Mon Mar 04 04:18:02 2002 +0000 @@ -57,11 +57,6 @@ #define USEROPT_PAGERPORT 4 #define YAHOO_PAGER_PORT 5050 -/* I just made these values up. Anyone know what they should be? - * -SeanEgan */ -#define YAHOO_TYPING_RECV_TIMEOUT 10 -#define YAHOO_TYPING_SEND_TIMEOUT 8 - enum yahoo_service { /* these are easier to see in hex */ YAHOO_SERVICE_LOGON = 1, YAHOO_SERVICE_LOGOFF, @@ -470,7 +465,7 @@ { char *msg = NULL; char *from = NULL; - time_t tm = time(0); + char *typing = NULL; GSList *l = pkt->hash; while (l) { @@ -479,9 +474,14 @@ from = pair->value; if (pair->key == 49) msg = pair->value; + if (pair->key == 13) + typing = pair->value; l = l->next; } - serv_got_typing(gc, from, YAHOO_TYPING_RECV_TIMEOUT); + if (*typing == '1') + serv_got_typing(gc, from, 0); + else + serv_got_typing_stopped(gc, from); } static void yahoo_process_message(struct gaim_connection *gc, struct yahoo_packet *pkt) @@ -914,7 +914,7 @@ return 1; } -int yahoo_send_typing(struct gaim_connection *gc, char *who) +int yahoo_send_typing(struct gaim_connection *gc, char *who, int typ) { struct yahoo_data *yd = gc->proto_data; struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_TYPING, YAHOO_STATUS_TYPING, 0);//x6431de4f); @@ -922,7 +922,7 @@ yahoo_packet_hash(pkt, 49, "TYPING"); yahoo_packet_hash(pkt, 1, gc->displayname); yahoo_packet_hash(pkt, 14, " "); - yahoo_packet_hash(pkt, 13, "1"); + yahoo_packet_hash(pkt, 13, typ ? "1" : "0"); yahoo_packet_hash(pkt, 5, who); yahoo_packet_hash(pkt, 1002, "1"); @@ -930,7 +930,7 @@ yahoo_packet_free(pkt); - return YAHOO_TYPING_SEND_TIMEOUT; + return 0; } static void yahoo_set_away(struct gaim_connection *gc, char *state, char *msg)
--- a/src/prpl.h Mon Mar 04 03:04:49 2002 +0000 +++ b/src/prpl.h Mon Mar 04 04:18:02 2002 +0000 @@ -104,8 +104,7 @@ void (* close) (struct gaim_connection *); int (* send_im) (struct gaim_connection *, char *who, char *message, int away); void (* set_info) (struct gaim_connection *, char *info); - int (* send_typing) (struct gaim_connection *, char *name); - void (* send_typing_stopped) (struct gaim_connection *, char *name); + int (* send_typing) (struct gaim_connection *, char *name, int typing); void (* get_info) (struct gaim_connection *, char *who); void (* set_away) (struct gaim_connection *, char *state, char *message); void (* get_away) (struct gaim_connection *, char *who);
--- a/src/server.c Mon Mar 04 03:04:49 2002 +0000 +++ b/src/server.c Mon Mar 04 04:18:02 2002 +0000 @@ -144,18 +144,14 @@ /* This should return the elapsed time in seconds in which Gaim will not send * typing notifications. - * if it returns zero, it will not send any more typing notifications */ -int serv_send_typing(struct gaim_connection *g, char *name) { + * if it returns zero, it will not send any more typing notifications + * typing is a flag - TRUE for typing, FALSE for stopped typing */ +int serv_send_typing(struct gaim_connection *g, char *name, int typing) { if (g && g->prpl && g->prpl->send_typing) - return g->prpl->send_typing(g, name); + return g->prpl->send_typing(g, name, typing); else return 0; } -void serv_send_typing_stopped(struct gaim_connection *g, char *name) { - if (g && g->prpl && g->prpl->send_typing_stopped) - g->prpl->send_typing_stopped(g, name); -} - int serv_send_im(struct gaim_connection *gc, char *name, char *message, int flags) { int val = -EINVAL; @@ -165,7 +161,7 @@ if (!(flags & IM_FLAG_AWAY)) serv_touch_idle(gc); - serv_send_typing_stopped(gc, name); + serv_send_typing(gc, name, FALSE); return val; }