Mercurial > pidgin
comparison src/away.c @ 1044:77b6bc7288d3
[gaim-migrate @ 1054]
Thanks to Ryan C. Gordon for the Away message patch!
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Wed, 01 Nov 2000 11:22:04 +0000 |
parents | 91b7377e7b45 |
children | c73736fa0b7c |
comparison
equal
deleted
inserted
replaced
1043:1528d05b3e6b | 1044:77b6bc7288d3 |
---|---|
63 serv_set_away(NULL); | 63 serv_set_away(NULL); |
64 awaymessage = NULL; | 64 awaymessage = NULL; |
65 plugin_event(event_back, 0, 0, 0, 0); | 65 plugin_event(event_back, 0, 0, 0, 0); |
66 } | 66 } |
67 | 67 |
68 | |
69 /* | |
70 * rcg10312000 This could be more robust, but it works for my current | |
71 * goal: to remove those annoying <BR> tags. :) | |
72 */ | |
73 static void strncpy_nohtml(gchar *dest, const gchar *src, size_t destsize) | |
74 { | |
75 gchar *ptr; | |
76 g_snprintf(dest, destsize, "%s", src); | |
77 | |
78 while (1) { | |
79 ptr = strstr(dest, "<BR>"); | |
80 if (ptr == NULL) /* done? */ | |
81 return; | |
82 | |
83 /* replace <BR> with a newline. */ | |
84 *ptr = '\n'; | |
85 memmove(ptr + 1, ptr + 4, strlen(ptr + 4) + 1); | |
86 } | |
87 } | |
88 | |
89 | |
68 void do_away_message(GtkWidget *w, struct away_message *a) | 90 void do_away_message(GtkWidget *w, struct away_message *a) |
69 { | 91 { |
70 GtkWidget *back; | 92 GtkWidget *back; |
71 GtkWidget *awaytext; | 93 GtkWidget *awaytext; |
72 GtkWidget *vscrollbar; | 94 GtkWidget *vscrollbar; |
100 bbox = gtk_hbox_new(TRUE, 10); | 122 bbox = gtk_hbox_new(TRUE, 10); |
101 topbox = gtk_hbox_new(FALSE, 5); | 123 topbox = gtk_hbox_new(FALSE, 5); |
102 vbox = gtk_vbox_new(FALSE, 5); | 124 vbox = gtk_vbox_new(FALSE, 5); |
103 | 125 |
104 awaytext = gtk_text_new(NULL, NULL); | 126 awaytext = gtk_text_new(NULL, NULL); |
127 | |
128 /* rcg10312000 Convert basic HTML (<BR>, etc) to plain text. | |
105 g_snprintf(buf, sizeof(buf), "%s", a->message); | 129 g_snprintf(buf, sizeof(buf), "%s", a->message); |
106 vscrollbar = gtk_vscrollbar_new(GTK_TEXT(awaytext)->vadj); | 130 */ |
131 strncpy_nohtml(buf, a->message, sizeof (buf)); | |
132 | |
133 vscrollbar = gtk_vscrollbar_new(GTK_TEXT(awaytext)->vadj); | |
107 gtk_widget_show(vscrollbar); | 134 gtk_widget_show(vscrollbar); |
108 gtk_widget_set_usize(awaytext, 225, 75); | 135 gtk_widget_set_usize(awaytext, 225, 75); |
109 gtk_text_set_word_wrap(GTK_TEXT(awaytext), TRUE); | 136 gtk_text_set_word_wrap(GTK_TEXT(awaytext), TRUE); |
110 gtk_widget_show(awaytext); | 137 gtk_widget_show(awaytext); |
111 gtk_text_freeze(GTK_TEXT(awaytext)); | 138 gtk_text_freeze(GTK_TEXT(awaytext)); |