Mercurial > pidgin
comparison plugins/irc.c @ 1393:3b5c7f8bb2b5
[gaim-migrate @ 1403]
I'm lame. Oh well, at least pings tell how many seconds they took.
committer: Tailor Script <tailor@pidgin.im>
| author | Rob Flynn <gaim@robflynn.com> |
|---|---|
| date | Mon, 08 Jan 2001 06:42:03 +0000 |
| parents | 7f4302f6fd64 |
| children | a2fa5a9977e0 |
comparison
equal
deleted
inserted
replaced
| 1392:dc6ba774bfc5 | 1393:3b5c7f8bb2b5 |
|---|---|
| 723 if (u_message[0] == '\001') { | 723 if (u_message[0] == '\001') { |
| 724 if ((g_strncasecmp(u_message, "\001PING ", 6) == 0) && (strlen(u_message) > 6)) { | 724 if ((g_strncasecmp(u_message, "\001PING ", 6) == 0) && (strlen(u_message) > 6)) { |
| 725 /* Someone's triyng to ping us. Let's respond */ | 725 /* Someone's triyng to ping us. Let's respond */ |
| 726 gchar u_arg[24]; | 726 gchar u_arg[24]; |
| 727 gchar u_buf[200]; | 727 gchar u_buf[200]; |
| 728 unsigned long tend= time((time_t *)NULL); | |
| 729 unsigned long tstart; | |
| 730 | |
| 731 printf("LA: %s\n", buf); | |
| 728 | 732 |
| 729 strcpy(u_arg, u_message + 6); | 733 strcpy(u_arg, u_message + 6); |
| 730 u_arg[strlen(u_arg) - 1] = '\0'; | 734 u_arg[strlen(u_arg) - 1] = '\0'; |
| 731 | 735 |
| 732 /* FIXME: We should keep track of pings we send. We should store | 736 /* FIXME: We should keep track of pings we send. We should store |
| 733 * the serial # and the time so that we can accurately report which | 737 * the serial # and the time so that we can accurately report which |
| 734 * pings are turning, etc */ | 738 * pings are turning, etc */ |
| 735 | 739 |
| 736 g_snprintf(u_buf, sizeof(u_buf), "Ping Reply From %s", u_nick); | 740 tstart = atol(u_arg); |
| 741 | |
| 742 g_snprintf(u_buf, sizeof(u_buf), "Ping Reply From %s: [%ld seconds]", u_nick, tend-tstart); | |
| 737 | 743 |
| 738 do_error_dialog(u_buf, "Gaim IRC - Ping Reply"); | 744 do_error_dialog(u_buf, "Gaim IRC - Ping Reply"); |
| 739 | 745 |
| 740 return; | 746 return; |
| 741 } | 747 } |
| 1087 static void irc_send_ping(GtkObject * w, char *who) | 1093 static void irc_send_ping(GtkObject * w, char *who) |
| 1088 { | 1094 { |
| 1089 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(w); | 1095 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(w); |
| 1090 struct irc_data *idata = (struct irc_data *)gc->proto_data; | 1096 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
| 1091 char buf[BUF_LEN]; | 1097 char buf[BUF_LEN]; |
| 1092 unsigned int serial = 2391271; | 1098 |
| 1093 | 1099 g_snprintf(buf, BUF_LEN, "PRIVMSG %s :%cPING %ld%c\n", who, '\001', time((time_t *)NULL), '\001'); |
| 1094 g_snprintf(buf, BUF_LEN, "PRIVMSG %s :%cPING %d%c\n", who, '\001', serial, '\001'); | |
| 1095 | 1100 |
| 1096 write(idata->fd, buf, strlen(buf)); | 1101 write(idata->fd, buf, strlen(buf)); |
| 1097 } | 1102 } |
| 1098 | 1103 |
| 1099 | 1104 |
