Mercurial > pidgin
comparison plugins/irc.c @ 1675:3232467ae220
[gaim-migrate @ 1685]
I didnt test it, but I think it works.
committer: Tailor Script <tailor@pidgin.im>
| author | Rob Flynn <gaim@robflynn.com> |
|---|---|
| date | Sat, 31 Mar 2001 07:06:55 +0000 |
| parents | 1127fa1b4c02 |
| children | a3d857c8984e |
comparison
equal
deleted
inserted
replaced
| 1674:1127fa1b4c02 | 1675:3232467ae220 |
|---|---|
| 68 static char *irc_name() | 68 static char *irc_name() |
| 69 { | 69 { |
| 70 return "IRC"; | 70 return "IRC"; |
| 71 } | 71 } |
| 72 | 72 |
| 73 static void irc_get_info(struct gaim_connection *gc, char *who); | |
| 74 | |
| 73 char *name() | 75 char *name() |
| 74 { | 76 { |
| 75 return "IRC"; | 77 return "IRC"; |
| 76 } | 78 } |
| 77 | 79 |
| 183 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | 185 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
| 184 strcpy(temp, message + 4); | 186 strcpy(temp, message + 4); |
| 185 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG %s :%cACTION %s%c\n", who, '\001', temp, '\001'); | 187 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG %s :%cACTION %s%c\n", who, '\001', temp, '\001'); |
| 186 g_free(temp); | 188 g_free(temp); |
| 187 } | 189 } |
| 190 else if (!g_strncasecmp(message, "/whois ", 7) && (strlen(message) > 7)) { | |
| 191 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
| 192 strcpy(temp, message + 7); | |
| 193 irc_get_info(gc, temp); | |
| 194 g_free(temp); | |
| 195 | |
| 196 return; | |
| 197 } | |
| 198 | |
| 188 } | 199 } |
| 189 else { | 200 else { |
| 190 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG %s :%s\n", who, message); | 201 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG %s :%s\n", who, message); |
| 191 } | 202 } |
| 192 | 203 |
| 291 return; | 302 return; |
| 292 } | 303 } |
| 293 | 304 |
| 294 | 305 |
| 295 /* Before we actually send this, we should check to see if they're trying | 306 /* Before we actually send this, we should check to see if they're trying |
| 296 * To issue a /me command and handle it properly. */ | 307 * To issue a command and handle it properly. */ |
| 297 | 308 |
| 298 if ((g_strncasecmp(message, "/me ", 4) == 0) && (strlen(message) > 4)) { | 309 if (message[0] == '/') |
| 299 /* We have /me!! We have /me!! :-) */ | 310 { |
| 300 | 311 if ((g_strncasecmp(message, "/me ", 4) == 0) && (strlen(message) > 4)) { |
| 301 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | 312 /* We have /me!! We have /me!! :-) */ |
| 302 strcpy(temp, message + 4); | 313 |
| 303 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%cACTION %s%c\n", channel->name, '\001', temp, | 314 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
| 304 '\001'); | 315 strcpy(temp, message + 4); |
| 305 g_free(temp); | 316 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%cACTION %s%c\n", channel->name, '\001', temp, |
| 306 } else { | 317 '\001'); |
| 318 g_free(temp); | |
| 319 } | |
| 320 else if (!g_strncasecmp(message, "/whois ", 7) && (strlen(message) > 7)) { | |
| 321 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
| 322 | |
| 323 strcpy(temp, message + 7); | |
| 324 irc_get_info(gc, temp); | |
| 325 g_free(temp); | |
| 326 | |
| 327 return; | |
| 328 } | |
| 329 } | |
| 330 else { | |
| 307 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%s\n", channel->name, message); | 331 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%s\n", channel->name, message); |
| 308 } | 332 } |
| 309 | 333 |
| 310 write(idata->fd, buf, strlen(buf)); | 334 write(idata->fd, buf, strlen(buf)); |
| 311 | 335 |
