comparison src/gtkconv.c @ 7564:54b370f7d9bf

[gaim-migrate @ 8180] /me-ify logs, and maybe fix the random directories problem. maybe. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 19 Nov 2003 05:34:50 +0000
parents cdfdbabd3266
children 532635bc38c1
comparison
equal deleted inserted replaced
7563:cb9c3b6d6de9 7564:54b370f7d9bf
2894 2894
2895 g_free(entered); 2895 g_free(entered);
2896 g_free(partial); 2896 g_free(partial);
2897 } 2897 }
2898 2898
2899 static gboolean
2900 meify(char *message, size_t len)
2901 {
2902 /*
2903 * Read /me-ify: If the message (post-HTML) starts with /me,
2904 * remove the "/me " part of it (including that space) and return TRUE.
2905 */
2906 char *c;
2907 gboolean inside_html = 0;
2908
2909 /* Umm.. this would be very bad if this happens. */
2910 g_return_val_if_fail(message != NULL, FALSE);
2911
2912 if (len == -1)
2913 len = strlen(message);
2914
2915 for (c = message; *c != '\0'; c++, len--) {
2916 if (inside_html) {
2917 if (*c == '>')
2918 inside_html = FALSE;
2919 }
2920 else {
2921 if (*c == '<')
2922 inside_html = TRUE;
2923 else
2924 break;
2925 }
2926 }
2927
2928 if (*c != '\0' && !g_ascii_strncasecmp(c, "/me ", 4)) {
2929 memmove(c, c + 4, len - 3);
2930
2931 return TRUE;
2932 }
2933
2934 return FALSE;
2935 }
2936
2937 static void 2899 static void
2938 save_convo(GtkWidget *save, GaimConversation *c) 2900 save_convo(GtkWidget *save, GaimConversation *c)
2939 { 2901 {
2940 char buf[BUF_LONG]; 2902 char buf[BUF_LONG];
2941 GtkWidget *window; 2903 GtkWidget *window;
4608 4570
4609 if (flags & GAIM_MESSAGE_WHISPER) { 4571 if (flags & GAIM_MESSAGE_WHISPER) {
4610 str = g_malloc(1024); 4572 str = g_malloc(1024);
4611 4573
4612 /* If we're whispering, it's not an autoresponse. */ 4574 /* If we're whispering, it's not an autoresponse. */
4613 if (meify(new_message, length)) { 4575 if (gaim_message_meify(new_message, length)) {
4614 g_snprintf(str, 1024, "***%s", who); 4576 g_snprintf(str, 1024, "***%s", who);
4615 strcpy(color, "#6C2585"); 4577 strcpy(color, "#6C2585");
4616 } 4578 }
4617 else { 4579 else {
4618 g_snprintf(str, 1024, "*%s*:", who); 4580 g_snprintf(str, 1024, "*%s*:", who);
4619 strcpy(color, "#00FF00"); 4581 strcpy(color, "#00FF00");
4620 } 4582 }
4621 } 4583 }
4622 else { 4584 else {
4623 if (meify(new_message, length)) { 4585 if (gaim_message_meify(new_message, length)) {
4624 str = g_malloc(1024); 4586 str = g_malloc(1024);
4625 4587
4626 if (flags & GAIM_MESSAGE_AUTO_RESP) 4588 if (flags & GAIM_MESSAGE_AUTO_RESP)
4627 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); 4589 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who);
4628 else 4590 else