mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-09-26 17:37:10 +00:00
Compare commits
8
Commits
2672f9b087
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca2456cbc6 | ||
|
|
222b4868f5 | ||
|
|
2cf1f7e833 | ||
|
|
776d24695e | ||
|
|
64a9c6e5d7 | ||
|
|
66196013bc | ||
|
|
61ff308c9f | ||
|
|
15905bebb1 |
@@ -2826,6 +2826,7 @@ static gboolean
|
|||||||
client_tag_allowed (server *serv, const char *tag)
|
client_tag_allowed (server *serv, const char *tag)
|
||||||
{
|
{
|
||||||
char **deny;
|
char **deny;
|
||||||
|
gboolean blocked = FALSE;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!serv->have_message_tags)
|
if (!serv->have_message_tags)
|
||||||
@@ -2837,15 +2838,16 @@ client_tag_allowed (server *serv, const char *tag)
|
|||||||
deny = g_strsplit (serv->clienttagdeny, ",", 0);
|
deny = g_strsplit (serv->clienttagdeny, ",", 0);
|
||||||
for (i = 0; deny[i]; i++)
|
for (i = 0; deny[i]; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp (deny[i], "*") || !strcmp (deny[i], tag) || (deny[i][0] == '+' && !strcmp (deny[i] + 1, tag)))
|
if (!strcmp (deny[i], "*"))
|
||||||
{
|
blocked = TRUE;
|
||||||
g_strfreev (deny);
|
else if (deny[i][0] == '-' && !strcmp (deny[i] + 1, tag))
|
||||||
return FALSE;
|
blocked = FALSE;
|
||||||
}
|
else if (!strcmp (deny[i], tag) || (deny[i][0] == '+' && !strcmp (deny[i] + 1, tag)))
|
||||||
|
blocked = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (deny);
|
g_strfreev (deny);
|
||||||
return TRUE;
|
return !blocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
|||||||
@@ -450,6 +450,7 @@ typedef struct session
|
|||||||
int mode_timeout_tag;
|
int mode_timeout_tag;
|
||||||
int typing_timeout_tag;
|
int typing_timeout_tag;
|
||||||
int typing_status;
|
int typing_status;
|
||||||
|
gint64 typing_last_sent;
|
||||||
int typing_animation_tag;
|
int typing_animation_tag;
|
||||||
int typing_animation_frame;
|
int typing_animation_frame;
|
||||||
|
|
||||||
|
|||||||
+26
-13
@@ -778,10 +778,13 @@ mg_inputbox_focus (GtkWidget *widget, GdkEventFocus *event, session_gui *gui)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define TYPING_THROTTLE_USEC (3 * G_USEC_PER_SEC)
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
mg_client_tag_allowed (server *serv, const char *tag)
|
mg_client_tag_allowed (server *serv, const char *tag)
|
||||||
{
|
{
|
||||||
char **deny;
|
char **deny;
|
||||||
|
gboolean blocked = FALSE;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!serv->have_message_tags)
|
if (!serv->have_message_tags)
|
||||||
@@ -793,30 +796,42 @@ mg_client_tag_allowed (server *serv, const char *tag)
|
|||||||
deny = g_strsplit (serv->clienttagdeny, ",", 0);
|
deny = g_strsplit (serv->clienttagdeny, ",", 0);
|
||||||
for (i = 0; deny[i]; i++)
|
for (i = 0; deny[i]; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp (deny[i], "*") || !strcmp (deny[i], tag) || (deny[i][0] == '+' && !strcmp (deny[i] + 1, tag)))
|
if (!strcmp (deny[i], "*"))
|
||||||
{
|
blocked = TRUE;
|
||||||
g_strfreev (deny);
|
else if (deny[i][0] == '-' && !strcmp (deny[i] + 1, tag))
|
||||||
return FALSE;
|
blocked = FALSE;
|
||||||
}
|
else if (!strcmp (deny[i], tag) || (deny[i][0] == '+' && !strcmp (deny[i] + 1, tag)))
|
||||||
|
blocked = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (deny);
|
g_strfreev (deny);
|
||||||
return TRUE;
|
return !blocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
|
mg_typing_can_send (session *sess)
|
||||||
|
{
|
||||||
|
gint64 now = g_get_monotonic_time ();
|
||||||
|
|
||||||
|
return sess->typing_last_sent == 0 ||
|
||||||
|
now - sess->typing_last_sent >= TYPING_THROTTLE_USEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
mg_send_typing (session *sess, const char *state)
|
mg_send_typing (session *sess, const char *state)
|
||||||
{
|
{
|
||||||
char tags[32];
|
char tags[32];
|
||||||
|
|
||||||
if (!sess || !sess->server->connected || !mg_client_tag_allowed (sess->server, "typing") || !sess->channel[0])
|
if (!sess || !sess->server->connected || !mg_client_tag_allowed (sess->server, "typing") || !sess->channel[0])
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
if (sess->type != SESS_CHANNEL && sess->type != SESS_DIALOG)
|
if (sess->type != SESS_CHANNEL && sess->type != SESS_DIALOG)
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
g_snprintf (tags, sizeof (tags), "+typing=%s", state);
|
g_snprintf (tags, sizeof (tags), "+typing=%s", state);
|
||||||
sess->server->p_tagmsg (sess->server, tags, sess->channel);
|
sess->server->p_tagmsg (sess->server, tags, sess->channel);
|
||||||
|
sess->typing_last_sent = g_get_monotonic_time ();
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -845,17 +860,15 @@ mg_typing_update (session *sess, const char *text)
|
|||||||
|
|
||||||
if (!text || !*text || text[0] == prefs.hex_input_command_char[0])
|
if (!text || !*text || text[0] == prefs.hex_input_command_char[0])
|
||||||
{
|
{
|
||||||
if (sess->typing_status)
|
if (sess->typing_status && mg_typing_can_send (sess))
|
||||||
mg_send_typing (sess, "done");
|
mg_send_typing (sess, "done");
|
||||||
sess->typing_status = 0;
|
sess->typing_status = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sess->typing_status != 1)
|
if (mg_typing_can_send (sess))
|
||||||
{
|
|
||||||
mg_send_typing (sess, "active");
|
mg_send_typing (sess, "active");
|
||||||
sess->typing_status = 1;
|
sess->typing_status = 1;
|
||||||
}
|
|
||||||
sess->typing_timeout_tag = fe_timeout_add_seconds (6, mg_typing_pause_cb, sess);
|
sess->typing_timeout_tag = fe_timeout_add_seconds (6, mg_typing_pause_cb, sess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1266,8 +1266,6 @@ attr_list_has_attrs (PangoAttrList *attrs)
|
|||||||
static void
|
static void
|
||||||
sexy_spell_entry_recheck_all(SexySpellEntry *entry)
|
sexy_spell_entry_recheck_all(SexySpellEntry *entry)
|
||||||
{
|
{
|
||||||
GdkRectangle rect;
|
|
||||||
GtkAllocation allocation;
|
|
||||||
GtkWidget *widget = GTK_WIDGET(entry);
|
GtkWidget *widget = GTK_WIDGET(entry);
|
||||||
int length, i, text_len;
|
int length, i, text_len;
|
||||||
const char *text;
|
const char *text;
|
||||||
@@ -1299,15 +1297,8 @@ sexy_spell_entry_recheck_all(SexySpellEntry *entry)
|
|||||||
|
|
||||||
gtk_entry_set_attributes (GTK_ENTRY (entry), attr_list_has_attrs (entry->priv->attr_list) ? entry->priv->attr_list : NULL);
|
gtk_entry_set_attributes (GTK_ENTRY (entry), attr_list_has_attrs (entry->priv->attr_list) ? entry->priv->attr_list : NULL);
|
||||||
|
|
||||||
if (gtk_widget_get_realized (GTK_WIDGET(entry)))
|
/* GtkEntry shares its parent's GdkWindow in GTK3; redraw the widget area. */
|
||||||
{
|
gtk_widget_queue_draw (widget);
|
||||||
gtk_widget_get_allocation (GTK_WIDGET(entry), &allocation);
|
|
||||||
|
|
||||||
rect.x = 0; rect.y = 0;
|
|
||||||
rect.width = allocation.width;
|
|
||||||
rect.height = allocation.height;
|
|
||||||
gdk_window_invalidate_rect(gtk_widget_get_window (widget), &rect, TRUE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
@@ -683,7 +683,7 @@ theme_manager_get_userlist_palette_behavior (const PangoFontDescription *font_de
|
|||||||
|
|
||||||
behavior.font_desc = font_desc;
|
behavior.font_desc = font_desc;
|
||||||
behavior.apply_background = TRUE;
|
behavior.apply_background = TRUE;
|
||||||
behavior.apply_foreground = (prefs.hex_gui_ulist_color || prefs.hex_text_color_nicks) ? FALSE : TRUE;
|
behavior.apply_foreground = prefs.hex_gui_ulist_color ? FALSE : TRUE;
|
||||||
|
|
||||||
return behavior;
|
return behavior;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ fe_userlist_rehash (session *sess, struct User *user)
|
|||||||
nick_token = THEME_TOKEN_TAB_AWAY;
|
nick_token = THEME_TOKEN_TAB_AWAY;
|
||||||
have_nick_token = TRUE;
|
have_nick_token = TRUE;
|
||||||
}
|
}
|
||||||
else if (prefs.hex_gui_ulist_color || prefs.hex_text_color_nicks)
|
else if (prefs.hex_gui_ulist_color)
|
||||||
{
|
{
|
||||||
int mirc_index = text_color_of (user->nick);
|
int mirc_index = text_color_of (user->nick);
|
||||||
|
|
||||||
@@ -635,7 +635,7 @@ fe_userlist_insert (session *sess, struct User *newuser, gboolean sel)
|
|||||||
nick_token = THEME_TOKEN_TAB_AWAY;
|
nick_token = THEME_TOKEN_TAB_AWAY;
|
||||||
have_nick_token = TRUE;
|
have_nick_token = TRUE;
|
||||||
}
|
}
|
||||||
else if (prefs.hex_gui_ulist_color || prefs.hex_text_color_nicks)
|
else if (prefs.hex_gui_ulist_color)
|
||||||
{
|
{
|
||||||
int mirc_index = text_color_of (newuser->nick);
|
int mirc_index = text_color_of (newuser->nick);
|
||||||
|
|
||||||
|
|||||||
+57
-3
@@ -273,6 +273,8 @@ static void gtk_xtext_render_page (GtkXText * xtext);
|
|||||||
static void gtk_xtext_calc_lines (xtext_buffer *buf, int);
|
static void gtk_xtext_calc_lines (xtext_buffer *buf, int);
|
||||||
static gboolean gtk_xtext_is_selecting (GtkXText *xtext);
|
static gboolean gtk_xtext_is_selecting (GtkXText *xtext);
|
||||||
static char *gtk_xtext_selection_get_text (GtkXText *xtext, int *len_ret);
|
static char *gtk_xtext_selection_get_text (GtkXText *xtext, int *len_ret);
|
||||||
|
static void gtk_xtext_clipboard_get (GtkClipboard *, GtkSelectionData *, guint, gpointer);
|
||||||
|
static void gtk_xtext_clipboard_clear (GtkClipboard *, gpointer);
|
||||||
static textentry *gtk_xtext_nth (GtkXText *xtext, int line, int *subline);
|
static textentry *gtk_xtext_nth (GtkXText *xtext, int line, int *subline);
|
||||||
static void gtk_xtext_adjustment_changed (GtkAdjustment * adj,
|
static void gtk_xtext_adjustment_changed (GtkAdjustment * adj,
|
||||||
GtkXText * xtext);
|
GtkXText * xtext);
|
||||||
@@ -1082,9 +1084,29 @@ gtk_xtext_new (const XTextColor *palette, int separator)
|
|||||||
return GTK_WIDGET (xtext);
|
return GTK_WIDGET (xtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_xtext_release_selections (GtkXText *xtext)
|
||||||
|
{
|
||||||
|
GdkAtom selections[] = { GDK_SELECTION_PRIMARY, GDK_SELECTION_SECONDARY };
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
if (!gtk_widget_has_screen (GTK_WIDGET (xtext)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (selections); i++)
|
||||||
|
{
|
||||||
|
GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (xtext), selections[i]);
|
||||||
|
|
||||||
|
if (gtk_clipboard_get_owner (clipboard) == G_OBJECT (xtext))
|
||||||
|
gtk_clipboard_clear (clipboard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_xtext_cleanup (GtkXText *xtext)
|
gtk_xtext_cleanup (GtkXText *xtext)
|
||||||
{
|
{
|
||||||
|
gtk_xtext_release_selections (xtext);
|
||||||
|
|
||||||
if (xtext->add_io_tag)
|
if (xtext->add_io_tag)
|
||||||
{
|
{
|
||||||
g_source_remove (xtext->add_io_tag);
|
g_source_remove (xtext->add_io_tag);
|
||||||
@@ -1179,6 +1201,7 @@ gtk_xtext_finalize (GObject *object)
|
|||||||
static void
|
static void
|
||||||
gtk_xtext_unrealize (GtkWidget * widget)
|
gtk_xtext_unrealize (GtkWidget * widget)
|
||||||
{
|
{
|
||||||
|
gtk_xtext_release_selections (GTK_XTEXT (widget));
|
||||||
backend_deinit (GTK_XTEXT (widget));
|
backend_deinit (GTK_XTEXT (widget));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2743,8 +2766,16 @@ gtk_xtext_set_clip_owner (GtkWidget * xtext, GdkEventButton * event)
|
|||||||
{
|
{
|
||||||
gtk_clipboard_set_text (gtk_widget_get_clipboard (xtext, GDK_SELECTION_CLIPBOARD), str, len);
|
gtk_clipboard_set_text (gtk_widget_get_clipboard (xtext, GDK_SELECTION_CLIPBOARD), str, len);
|
||||||
|
|
||||||
gtk_selection_owner_set (xtext, GDK_SELECTION_PRIMARY, event ? event->time : GDK_CURRENT_TIME);
|
/* Let GtkClipboard own the X11 selection window. Making xtext
|
||||||
gtk_selection_owner_set (xtext, GDK_SELECTION_SECONDARY, event ? event->time : GDK_CURRENT_TIME);
|
* the selection owner forces its window native and bypasses
|
||||||
|
* GTK's toplevel backing buffer on subsequent redraws.
|
||||||
|
*/
|
||||||
|
gtk_clipboard_set_with_owner (gtk_widget_get_clipboard (xtext, GDK_SELECTION_PRIMARY),
|
||||||
|
gtk_xtext_selection_targets, G_N_ELEMENTS (gtk_xtext_selection_targets),
|
||||||
|
gtk_xtext_clipboard_get, gtk_xtext_clipboard_clear, G_OBJECT (xtext));
|
||||||
|
gtk_clipboard_set_with_owner (gtk_widget_get_clipboard (xtext, GDK_SELECTION_SECONDARY),
|
||||||
|
gtk_xtext_selection_targets, G_N_ELEMENTS (gtk_xtext_selection_targets),
|
||||||
|
gtk_xtext_clipboard_get, gtk_xtext_clipboard_clear, G_OBJECT (xtext));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
@@ -3172,7 +3203,7 @@ gtk_xtext_selection_get (GtkWidget * widget,
|
|||||||
if (!window || !GDK_IS_WINDOW (window))
|
if (!window || !GDK_IS_WINDOW (window))
|
||||||
break;
|
break;
|
||||||
display = gdk_window_get_display (window);
|
display = gdk_window_get_display (window);
|
||||||
if (!display)
|
if (!display || !GDK_IS_X11_DISPLAY (display))
|
||||||
break;
|
break;
|
||||||
GdkAtom encoding;
|
GdkAtom encoding;
|
||||||
gint format;
|
gint format;
|
||||||
@@ -3197,6 +3228,29 @@ gtk_xtext_selection_get (GtkWidget * widget,
|
|||||||
g_free (stripped);
|
g_free (stripped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_xtext_clipboard_get (GtkClipboard *clipboard, GtkSelectionData *selection_data,
|
||||||
|
guint info, gpointer owner)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
char *text = gtk_xtext_selection_get_text (GTK_XTEXT (owner), &len);
|
||||||
|
|
||||||
|
if (text)
|
||||||
|
{
|
||||||
|
gtk_selection_data_set_text (selection_data, text, len);
|
||||||
|
g_free (text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_xtext_clipboard_clear (GtkClipboard *clipboard, gpointer owner)
|
||||||
|
{
|
||||||
|
GtkXText *xtext = GTK_XTEXT (owner);
|
||||||
|
|
||||||
|
if (xtext->orig_buffer)
|
||||||
|
gtk_xtext_selection_kill (xtext, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_xtext_scroll (GtkWidget *widget, GdkEventScroll *event)
|
gtk_xtext_scroll (GtkWidget *widget, GdkEventScroll *event)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user