summary refs log tree commit diff stats
path: root/src
AgeCommit message (Collapse)Author
2013-05-11CosmeticsBerke Viktor
2013-05-11Make logmask consistent with scrollback maskBerke Viktor
2013-05-11Remove some redundancyBerke Viktor
2013-05-11Also disable labels, not just entriesBerke Viktor
2013-05-11Nuke nickserv password field and some cosmeticsBerke Viktor
2013-05-11Get rid of this unnecessary bufferBerke Viktor
2013-05-11Skeleton for tabbed uiBerke Viktor
2013-05-11Reorganize the network listBerke Viktor
2013-05-10Replace various network options with universal login method optionBerke Viktor
2013-05-09Added support for marking nicks that are away in different colour when ↵Repentinus
away_size_max = 0, but tracking enabled.
2013-05-09Add option to support away tracking regardless of channel sizeHeiki Ojasild
As there is option to disable away tracking, it would make sense to treat channel size limit of 0 as infinity for away tracking purposes. These changes attempt to implement this.
2013-05-09Now process_numeric() passes the right session context to text_emit() when anDiogo Sousa
numeric event occurs regarding a nick with a open dialog. Since this session context is potentially passed to plugins this can change the behavior of plugins, but I think this is the intended semantics (http://docs.hexchat.org/en/latest/script_python.html#context-theory). Another consequence is that event messages will be displayed in the query dialog of the nick in question (if a query dialog is open, of course), which I think is sensible. (The initial intention of this patch was actually to report the "No such nick" message in the query dialog when sending a message to a user that has quit.)
2013-05-08stop using gconfTingPing
2013-05-08Fix server tab changing color when activeTingPing
2013-05-08Show hours for last seen in friends listTingPing
closes #579
2013-05-07Have gui_input_icon depend on gui_input_nick in prefsTingPing
2013-05-06Clean up IRCNetTingPing
2013-05-04Replace g_strdup_printf with g_build_filename where possibleBerke Viktor
2013-05-03Merge branch 'py3k' of git://github.com/TingPing/hexchatTingPing
2013-05-03Add python3 pluginTingPing
2013-05-03commaTingPing
2013-05-03update gamesurge's default nickserv typeTingPing
2013-05-03Merge pull request #565 from bviktor/nickservtypeTingPing
Make NickServ registration configurable per-network
2013-05-03Don't make assumptions about the function being calledBerke Viktor
2013-05-03Fix QuakeNet registrationBerke Viktor
2013-05-03Provide default NickServ types where necessaryBerke Viktor
2013-05-03Merge pull request #571 from amalmurali/masterTingPing
Update textevents.in
2013-05-03Line breaks and typofixBerke Viktor
2013-05-01Do save_config() on Channel List window min, max changesRichardHitt
#570
2013-05-01Do save_config() on Search-window checkbox changeRichardHitt
#570
2013-05-01Fix warning about g_type_init() in dbus/example.cRichardHitt
2013-05-01Save nicks when closing network listTingPing
#570
2013-05-01Update textevents.inAmal
Corrected text events for Channel Invite and Channel Remove Invite
2013-04-30remove incorrect notice help infoTingPing
2013-04-28Remove away announceTingPing
2013-04-28Remove useless slashBerke Viktor
2013-04-28Make NickServ registration configurable per-networkBerke Viktor
Fixes #394
2013-04-28Make /msg nickserv the default registration typeBerke Viktor
Fixes #394 and hopefully doesn't break others
2013-04-28Get rid of some hardcoded network recognitionBerke Viktor
2013-04-28Don't autoload WMPA, it's dead in the waterBerke Viktor
2013-04-28Don't hardcode "plugins" as the subdirectory for plugins in manyChristoph J. Thompson
places. modified: config-win32.h modified: configure.ac modified: plugins/checksum/Makefile.am modified: plugins/doat/Makefile.am modified: plugins/fishlim/Makefile.am modified: plugins/perl/Makefile.am modified: plugins/python/Makefile.am modified: plugins/sysinfo/Makefile.am modified: plugins/xdcc/Makefile.am modified: src/common/plugin.c modified: src/fe-text/fe-text.c
2013-04-28CosmeticsBerke Viktor
2013-04-28Add hints about the beep fileBerke Viktor
2013-04-28Rename Sound to Sounds and reorder Chatting pagesBerke Viktor
2013-04-28Eliminate compiler warningBerke Viktor
free() requires stdlib.h
2013-04-28Store just the filename if the sound file comes from the default sound dirBerke Viktor
And get rid of some hardcoding while we're at it
2013-04-28Fix spacingBerke Viktor
2013-04-27Use regular canberra not gtkTingPing
2013-04-28Remove dead code for sound_commandBerke Viktor
2013-04-27More cleanupTingPing
a> 10 11 12 13 14 15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178














                                                                       
                                                                            




                   

                   


               


                   






                              
                           
 

                               






                               
                  















                                             
                                                                                   


















                                                                                                                  
                                                                                     


                     
               











                                                                           
                     

 











                                                            
                                                                                        


                                                                                       
                                                          






                                                                 
                                                                                                                                                  
                                                                         
                                                                                                                      

                                                                             
                                                                                         












                                                                                      
                                                                           



                                                                         


                                                                                                                                          






















                                                                                         
/* X-Chat
 * Copyright (C) 1998 Peter Zelezny.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>

#ifdef WIN32
#include <io.h>
#else
#include <unistd.h>
#endif

#include "fe-gtk.h"

#include <gtk/gtkbutton.h>
#include <gtk/gtkhbbox.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkvscrollbar.h>
#include <gtk/gtkstock.h>
#include <gdk/gdkkeysyms.h>

#include "../common/hexchat.h"
#include "../common/hexchatc.h"
#include "../common/cfgfiles.h"
#include "../common/server.h"
#include "gtkutil.h"
#include "palette.h"
#include "maingui.h"
#include "rawlog.h"
#include "xtext.h"
#include "fkeys.h"

static void
close_rawlog (GtkWidget *wid, server *serv)
{
	if (is_server (serv))
		serv->gui->rawlog_window = 0;
}

static void
rawlog_save (server *serv, char *file)
{
	int fh = -1;

	if (file)
	{
		if (serv->gui->rawlog_window)
			fh = hexchat_open_file (file, O_TRUNC | O_WRONLY | O_CREAT,
										 0600, XOF_DOMODE | XOF_FULLPATH);
		if (fh != -1)
		{
			gtk_xtext_save (GTK_XTEXT (serv->gui->rawlog_textlist), fh);
			close (fh);
		}
	}
}

static int
rawlog_clearbutton (GtkWidget * wid, server *serv)
{
	gtk_xtext_clear (GTK_XTEXT (serv->gui->rawlog_textlist)->buffer, 0);
	return FALSE;
}

static int
rawlog_savebutton (GtkWidget * wid, server *serv)
{
	gtkutil_file_req (_("Save As..."), rawlog_save, serv, NULL, NULL, FRF_WRITE);
	return FALSE;
}

static gboolean
rawlog_key_cb (GtkWidget * wid, GdkEventKey * key, gpointer userdata)
{
	/* Copy rawlog selection to clipboard when Ctrl+Shift+C is pressed,
	 * but make sure not to copy twice, i.e. when auto-copy is enabled.
	 */
	if (!prefs.hex_text_autocopy_text &&
		(key->keyval == GDK_c || key->keyval == GDK_C) &&
		key->state & STATE_SHIFT &&
		key->state & STATE_CTRL)
	{
		gtk_xtext_copy_selection (userdata);
	}
	return FALSE;
}

void
open_rawlog (struct server *serv)
{
	GtkWidget *hbox, *vscrollbar, *vbox;
	char tbuf[256];

	if (serv->gui->rawlog_window)
	{
		mg_bring_tofront (serv->gui->rawlog_window);
		return;
	}

	snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Raw Log (%s)"), serv->servername);
	serv->gui->rawlog_window =
		mg_create_generic_tab ("RawLog", tbuf, FALSE, TRUE, close_rawlog, serv,
							 640, 320, &vbox, serv);
	gtkutil_destroy_on_esc (serv->gui->rawlog_window);

	hbox = gtk_hbox_new (FALSE, 2);
	gtk_container_add (GTK_CONTAINER (vbox), hbox);
	gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
	gtk_widget_show (hbox);

	serv->gui->rawlog_textlist = gtk_xtext_new (colors, 0);
	gtk_xtext_set_tint (GTK_XTEXT (serv->gui->rawlog_textlist), prefs.hex_text_tint_red, prefs.hex_text_tint_green, prefs.hex_text_tint_blue);
	gtk_xtext_set_background (GTK_XTEXT (serv->gui->rawlog_textlist),
									  channelwin_pix, prefs.hex_text_transparent);

	gtk_container_add (GTK_CONTAINER (hbox), serv->gui->rawlog_textlist);
	gtk_xtext_set_font (GTK_XTEXT (serv->gui->rawlog_textlist), prefs.hex_text_font);
	GTK_XTEXT (serv->gui->rawlog_textlist)->ignore_hidden = 1;
	gtk_widget_show (serv->gui->rawlog_textlist);

	vscrollbar = gtk_vscrollbar_new (GTK_XTEXT (serv->gui->rawlog_textlist)->adj);
	gtk_box_pack_start (GTK_BOX (hbox), vscrollbar, FALSE, FALSE, 0);
	show_and_unfocus (vscrollbar);

	hbox = gtk_hbutton_box_new ();
	gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD);
	gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0);
	gtk_widget_show (hbox);

	gtkutil_button (hbox, GTK_STOCK_CLEAR, NULL, rawlog_clearbutton,
						 serv, _("Clear Raw Log"));

	gtkutil_button (hbox, GTK_STOCK_SAVE_AS, NULL, rawlog_savebutton,
						 serv, _("Save As..."));

	/* Copy selection to clipboard when Ctrl+Shift+C is pressed AND text auto-copy is disabled */
	g_signal_connect (G_OBJECT (serv->gui->rawlog_window), "key_press_event", G_CALLBACK (rawlog_key_cb), serv->gui->rawlog_textlist);

	gtk_widget_show (serv->gui->rawlog_window);
}

void
fe_add_rawlog (server *serv, char *text, int len, int outbound)
{
	char *new_text;

	if (!serv->gui->rawlog_window)
		return;

	new_text = malloc (len + 7);

	len = sprintf (new_text, "\0033>>\017 %s", text);
	if (outbound)
	{
		new_text[1] = '4';
		new_text[2] = '<';
		new_text[3] = '<';
	}
	gtk_xtext_append (GTK_XTEXT (serv->gui->rawlog_textlist)->buffer, new_text, len);
	free (new_text);
}