comparison src/gtkconv.c @ 6621:42fdf16f1dad

[gaim-migrate @ 7145] Individual accounts remember the "No Proxy" setting instead of reverting back to "Use Global Proxy Settings" Proxy settings for individual accounts do not revert to "No Proxy" if you open an account, don't change the proxy drop down, then save the account. Those two sound like the same thing, but they're different. I think. Added the "use environmental variables" setting in a way that isn't horrible. We're not using that thing that splits the proxy variable into host:port yet. I'll do that later. I would have done that earlier, but I had to go buy a bike. Also, I'd like to show what the environmental variables are set to somewhere. That'll come later. Also a patch from Robot101: (22:10:25) Bzubhipheron: I have a patch that replaces #define WFLAG_* with GaimMessageFlags GAIM_MESSAGE_* (22:10:30) Bzubhipheron: (an enum in disguise) (22:14:18) Bzubhipheron: GaimMessageFlags protrays much better typing information than "int". most of the other #defines are gone, and glib standardises on enums for its flags too. (22:14:27) Bzubhipheron: (gone or going) (22:14:45) Bzubhipheron: and it makes the prototype of my message queueing stuff prettier. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 25 Aug 2003 02:49:42 +0000
parents 8ce66049ce68
children a4622f1fb5a1
comparison
equal deleted inserted replaced
6620:7230e5920911 6621:42fdf16f1dad
2696 addthis = g_strconcat(tmp, matches->data, " ", NULL); 2696 addthis = g_strconcat(tmp, matches->data, " ", NULL);
2697 g_free(tmp); 2697 g_free(tmp);
2698 matches = g_list_remove(matches, matches->data); 2698 matches = g_list_remove(matches, matches->data);
2699 } 2699 }
2700 2700
2701 gaim_conversation_write(conv, NULL, addthis, -1, WFLAG_NOLOG, 2701 gaim_conversation_write(conv, NULL, addthis, -1, GAIM_MESSAGE_NO_LOG,
2702 time(NULL)); 2702 time(NULL));
2703 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); 2703 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1);
2704 g_free(addthis); 2704 g_free(addthis);
2705 } 2705 }
2706 2706
4202 g_free(gtkconv); 4202 g_free(gtkconv);
4203 } 4203 }
4204 4204
4205 static void 4205 static void
4206 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, 4206 gaim_gtkconv_write_im(GaimConversation *conv, const char *who,
4207 const char *message, size_t len, int flags, 4207 const char *message, size_t len, GaimMessageFlags flags,
4208 time_t mtime) 4208 time_t mtime)
4209 { 4209 {
4210 GaimGtkConversation *gtkconv; 4210 GaimGtkConversation *gtkconv;
4211 4211
4212 gtkconv = GAIM_GTK_CONVERSATION(conv); 4212 gtkconv = GAIM_GTK_CONVERSATION(conv);
4213 4213
4214 if (!(flags & WFLAG_NOLOG) && 4214 if (!(flags & GAIM_MESSAGE_NO_LOG) &&
4215 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { 4215 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) {
4216 4216
4217 gaim_window_raise(gaim_conversation_get_window(conv)); 4217 gaim_window_raise(gaim_conversation_get_window(conv));
4218 } 4218 }
4219 4219
4220 /* Play a sound, if specified in prefs. */ 4220 /* Play a sound, if specified in prefs. */
4221 if (gtkconv->make_sound) { 4221 if (gtkconv->make_sound) {
4222 if (flags & WFLAG_RECV) { 4222 if (flags & GAIM_MESSAGE_RECV) {
4223 if (gtkconv->u.im->a_virgin && 4223 if (gtkconv->u.im->a_virgin &&
4224 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { 4224 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) {
4225 4225
4226 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); 4226 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE);
4227 } 4227 }
4238 gaim_conversation_write(conv, who, message, len, flags, mtime); 4238 gaim_conversation_write(conv, who, message, len, flags, mtime);
4239 } 4239 }
4240 4240
4241 static void 4241 static void
4242 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, 4242 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who,
4243 const char *message, int flags, time_t mtime) 4243 const char *message, GaimMessageFlags flags, time_t mtime)
4244 { 4244 {
4245 GaimGtkConversation *gtkconv; 4245 GaimGtkConversation *gtkconv;
4246 4246
4247 gtkconv = GAIM_GTK_CONVERSATION(conv); 4247 gtkconv = GAIM_GTK_CONVERSATION(conv);
4248 4248
4249 /* Play a sound, if specified in prefs. */ 4249 /* Play a sound, if specified in prefs. */
4250 if (gtkconv->make_sound) { 4250 if (gtkconv->make_sound) {
4251 if (!(flags & WFLAG_WHISPER) && (flags & WFLAG_SEND)) 4251 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND))
4252 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); 4252 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY);
4253 else if (flags & WFLAG_RECV) { 4253 else if (flags & GAIM_MESSAGE_RECV) {
4254 if ((flags & WFLAG_NICK) && 4254 if ((flags & GAIM_MESSAGE_NICK) &&
4255 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) { 4255 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) {
4256 4256
4257 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); 4257 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK);
4258 } 4258 }
4259 else 4259 else
4260 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); 4260 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY);
4261 } 4261 }
4262 } 4262 }
4263 4263
4264 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) 4264 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks"))
4265 flags |= WFLAG_COLORIZE; 4265 flags |= GAIM_MESSAGE_COLORIZE;
4266 4266
4267 /* Raise the window, if specified in prefs. */ 4267 /* Raise the window, if specified in prefs. */
4268 if (!(flags & WFLAG_NOLOG) && 4268 if (!(flags & GAIM_MESSAGE_NO_LOG) &&
4269 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { 4269 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) {
4270 4270
4271 gaim_window_raise(gaim_conversation_get_window(conv)); 4271 gaim_window_raise(gaim_conversation_get_window(conv));
4272 } 4272 }
4273 4273
4274 gaim_conversation_write(conv, who, message, -1, flags, mtime); 4274 gaim_conversation_write(conv, who, message, -1, flags, mtime);
4275 } 4275 }
4276 4276
4277 static void 4277 static void
4278 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, 4278 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who,
4279 const char *message, size_t length, int flags, 4279 const char *message, size_t length, GaimMessageFlags flags,
4280 time_t mtime) 4280 time_t mtime)
4281 { 4281 {
4282 GaimGtkConversation *gtkconv; 4282 GaimGtkConversation *gtkconv;
4283 GaimWindow *win; 4283 GaimWindow *win;
4284 GaimConnection *gc; 4284 GaimConnection *gc;
4299 gtkconv = GAIM_GTK_CONVERSATION(conv); 4299 gtkconv = GAIM_GTK_CONVERSATION(conv);
4300 gc = gaim_conversation_get_gc(conv); 4300 gc = gaim_conversation_get_gc(conv);
4301 4301
4302 win = gaim_conversation_get_window(conv); 4302 win = gaim_conversation_get_window(conv);
4303 4303
4304 if (!(flags & WFLAG_NOLOG) && 4304 if (!(flags & GAIM_MESSAGE_NO_LOG) &&
4305 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && 4305 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT &&
4306 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || 4306 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) ||
4307 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && 4307 (gaim_conversation_get_type(conv) == GAIM_CONV_IM &&
4308 (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") || 4308 (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") ||
4309 gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send"))))) { 4309 gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send"))))) {
4338 OPT_PROTO_USE_POINTSIZE) { 4338 OPT_PROTO_USE_POINTSIZE) {
4339 4339
4340 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; 4340 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE;
4341 } 4341 }
4342 4342
4343 if (flags & WFLAG_SYSTEM) { 4343 if (flags & GAIM_MESSAGE_SYSTEM) {
4344 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) 4344 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"))
4345 g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>", 4345 g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>",
4346 mdate, message); 4346 mdate, message);
4347 else 4347 else
4348 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); 4348 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message);
4364 else { 4364 else {
4365 conv->history = g_string_append(conv->history, buf); 4365 conv->history = g_string_append(conv->history, buf);
4366 conv->history = g_string_append(conv->history, "<BR>\n"); 4366 conv->history = g_string_append(conv->history, "<BR>\n");
4367 } 4367 }
4368 4368
4369 if (!(flags & WFLAG_NOLOG) && gaim_conversation_is_logging(conv)) { 4369 if (!(flags & GAIM_MESSAGE_NO_LOG) && gaim_conversation_is_logging(conv)) {
4370 4370
4371 char *t1; 4371 char *t1;
4372 char nm[256]; 4372 char nm[256];
4373 4373
4374 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) 4374 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html"))
4396 4396
4397 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) 4397 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html"))
4398 g_free(t1); 4398 g_free(t1);
4399 } 4399 }
4400 } 4400 }
4401 else if (flags & WFLAG_NOLOG) { 4401 else if (flags & GAIM_MESSAGE_NO_LOG) {
4402 g_snprintf(buf, BUF_LONG, 4402 g_snprintf(buf, BUF_LONG,
4403 "<B><FONT COLOR=\"#777777\">%s</FONT></B><BR>", 4403 "<B><FONT COLOR=\"#777777\">%s</FONT></B><BR>",
4404 message); 4404 message);
4405 4405
4406 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, -1, 0); 4406 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, -1, 0);
4407 } 4407 }
4408 else { 4408 else {
4409 char *new_message = g_memdup(message, length); 4409 char *new_message = g_memdup(message, length);
4410 4410
4411 if (flags & WFLAG_WHISPER) { 4411 if (flags & GAIM_MESSAGE_WHISPER) {
4412 str = g_malloc(1024); 4412 str = g_malloc(1024);
4413 4413
4414 /* If we're whispering, it's not an autoresponse. */ 4414 /* If we're whispering, it's not an autoresponse. */
4415 if (meify(new_message, length)) { 4415 if (meify(new_message, length)) {
4416 g_snprintf(str, 1024, "***%s", who); 4416 g_snprintf(str, 1024, "***%s", who);
4423 } 4423 }
4424 else { 4424 else {
4425 if (meify(new_message, length)) { 4425 if (meify(new_message, length)) {
4426 str = g_malloc(1024); 4426 str = g_malloc(1024);
4427 4427
4428 if (flags & WFLAG_AUTO) 4428 if (flags & GAIM_MESSAGE_AUTO_RESP)
4429 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); 4429 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who);
4430 else 4430 else
4431 g_snprintf(str, 1024, "***%s", who); 4431 g_snprintf(str, 1024, "***%s", who);
4432 4432
4433 if (flags & WFLAG_NICK) 4433 if (flags & GAIM_MESSAGE_NICK)
4434 strcpy(color, "#AF7F00"); 4434 strcpy(color, "#AF7F00");
4435 else 4435 else
4436 strcpy(color, "#062585"); 4436 strcpy(color, "#062585");
4437 } 4437 }
4438 else { 4438 else {
4439 str = g_malloc(1024); 4439 str = g_malloc(1024);
4440 4440
4441 if (flags & WFLAG_AUTO) 4441 if (flags & GAIM_MESSAGE_AUTO_RESP)
4442 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); 4442 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE);
4443 else 4443 else
4444 g_snprintf(str, 1024, "%s:", who); 4444 g_snprintf(str, 1024, "%s:", who);
4445 4445
4446 if (flags & WFLAG_NICK) 4446 if (flags & GAIM_MESSAGE_NICK)
4447 strcpy(color, "#AF7F00"); 4447 strcpy(color, "#AF7F00");
4448 else if (flags & WFLAG_RECV) { 4448 else if (flags & GAIM_MESSAGE_RECV) {
4449 if (flags & WFLAG_COLORIZE) { 4449 if (flags & GAIM_MESSAGE_COLORIZE) {
4450 const char *u; 4450 const char *u;
4451 int m = 0; 4451 int m = 0;
4452 4452
4453 for (u = who; *u != '\0'; u++) 4453 for (u = who; *u != '\0'; u++)
4454 m += *u; 4454 m += *u;
4458 strcpy(color, nick_colors[m]); 4458 strcpy(color, nick_colors[m]);
4459 } 4459 }
4460 else 4460 else
4461 strcpy(color, "#A82F2F"); 4461 strcpy(color, "#A82F2F");
4462 } 4462 }
4463 else if (flags & WFLAG_SEND) 4463 else if (flags & GAIM_MESSAGE_SEND)
4464 strcpy(color, "#16569E"); 4464 strcpy(color, "#16569E");
4465 } 4465 }
4466 } 4466 }
4467 4467
4468 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) 4468 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"))