Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Chris Talbot
chatty
Commits
3cb6a942
Commit
3cb6a942
authored
Oct 04, 2021
by
Chris Talbot
Committed by
Mohammed Sadiq
Oct 11, 2021
Browse files
chat-view: attach files to message if attachment-view has files
parent
44e6ed47
Pipeline
#71907
passed with stages
in 10 minutes and 32 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/chatty-chat-view.c
View file @
3cb6a942
...
...
@@ -484,9 +484,12 @@ chat_view_send_message_button_clicked_cb (ChattyChatView *self)
g_autoptr
(
ChattyMessage
)
msg
=
NULL
;
g_autofree
char
*
message
=
NULL
;
GtkTextIter
start
,
end
;
GList
*
files
;
g_assert
(
CHATTY_IS_CHAT_VIEW
(
self
));
files
=
chatty_attachments_view_get_files
(
CHATTY_ATTACHMENTS_VIEW
(
self
->
attachment_view
));
gtk_text_buffer_get_bounds
(
self
->
message_input_buffer
,
&
start
,
&
end
);
message
=
gtk_text_buffer_get_text
(
self
->
message_input_buffer
,
&
start
,
&
end
,
FALSE
);
...
...
@@ -504,7 +507,7 @@ chat_view_send_message_button_clicked_cb (ChattyChatView *self)
gtk_widget_grab_focus
(
self
->
message_input
);
if
(
gtk_text_buffer_get_char_count
(
self
->
message_input_buffer
))
{
if
(
gtk_text_buffer_get_char_count
(
self
->
message_input_buffer
)
||
files
)
{
g_autofree
char
*
escaped
=
NULL
;
ChattyProtocol
protocol
;
...
...
@@ -519,12 +522,16 @@ chat_view_send_message_button_clicked_cb (ChattyChatView *self)
NULL
,
time
(
NULL
),
escaped
?
CHATTY_MESSAGE_HTML_ESCAPED
:
CHATTY_MESSAGE_TEXT
,
CHATTY_DIRECTION_OUT
,
0
);
if
(
files
)
{
chatty_message_set_files
(
msg
,
files
);
}
chatty_chat_send_message_async
(
self
->
chat
,
msg
,
view_send_message_async_cb
,
g_object_ref
(
self
));
gtk_widget_hide
(
self
->
send_message_button
);
}
chatty_attachments_view_reset
(
CHATTY_ATTACHMENTS_VIEW
(
self
->
attachment_view
));
gtk_text_buffer_delete
(
self
->
message_input_buffer
,
&
start
,
&
end
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment