Skip to content

Commit

Permalink
Add: Auto login on boot startup (toggle in settings)
Browse files Browse the repository at this point in the history
Fix: Memory leak
Fix some bugs
  • Loading branch information
badcast committed May 1, 2024
1 parent d224878 commit 452a615
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 361 deletions.
20 changes: 10 additions & 10 deletions client-frontend/dragon-tea/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ file(GLOB_RECURSE DRAGONTEA_SOURCES

list(APPEND DRAGONTEA_SOURCES ${DRAGONTEA_HEADERS})

add_library(dragontea SHARED)
add_library(libdragontea SHARED)
add_executable(exec ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c ${DRAGONTEA_HEADERS})

set_target_properties(dragontea PROPERTIES OUTPUT_NAME "teauilib")
set_target_properties(libdragontea PROPERTIES OUTPUT_NAME "teauilib")
set_target_properties(exec PROPERTIES OUTPUT_NAME "dragontea")

target_compile_definitions(dragontea PRIVATE TEA_COMPILLING)
target_compile_definitions(libdragontea PRIVATE TEA_COMPILLING)

# COMPILE BUILTIN SERVERS
set(BUILTIN_TEMPLATE_FILE "${CMAKE_BINARY_DIR}/builtin_template.c")
Expand All @@ -49,32 +49,32 @@ endif()

if(EXISTS "${BUILTIN_TEMPLATE_FILE}")
list(APPEND DRAGONTEA_SOURCES ${BUILTIN_TEMPLATE_FILE})
target_compile_definitions(dragontea PUBLIC BUILTIN_SERVERS=ON
target_compile_definitions(libdragontea PUBLIC BUILTIN_SERVERS=ON
BUILTIN_SERVERS_N=${BF_LENGTH})
endif()

target_sources(dragontea PRIVATE ${DRAGONTEA_SOURCES})
target_sources(libdragontea PRIVATE ${DRAGONTEA_SOURCES})

target_include_directories(
dragontea
libdragontea
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include/" ${gtk3ui_INCLUDE_DIRS}
${gthread_INCLUDE_DIRS} ${libcurl_INCLUDE_DIRS} ${json_INCLUDE_DIRS}
${libnotify_INCLUDE_DIRS})

target_include_directories(exec PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/)

target_link_libraries(
dragontea ${gtk3ui_LIBRARIES} ${libcurl_LIBRARIES} ${json_LIBRARIES}
libdragontea ${gtk3ui_LIBRARIES} ${libcurl_LIBRARIES} ${json_LIBRARIES}
${gthread_LIBRARIES} ${libnotify_LIBRARIES})

target_link_libraries(exec dragontea)
target_link_libraries(exec libdragontea )

target_compile_definitions(dragontea
target_compile_definitions(libdragontea
PUBLIC DRAGON_TEA_VERSION="${DRAGON_TEA_VERSION}")

if(UNIX OR LINUX)
set(LOCALE_DIR "${CMAKE_INSTALL_PREFIX}/share/locale")
target_compile_definitions(dragontea
target_compile_definitions(libdragontea
PUBLIC DRAGON_TEA_LOCALE_DIR="${LOCALE_DIR}")

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/localization/locale"
Expand Down
3 changes: 3 additions & 0 deletions client-frontend/dragon-tea/include/tea_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ struct tea_settings
char config_dir[TEA_MAXLEN_PATH];
// setting file
char setting_filename[TEA_MAXLEN_PATH];
// auto login on startup
int autologin;
// active server
int active_server;
// loaded from configurations
Expand Down Expand Up @@ -172,6 +174,7 @@ struct tea_app_widgets
struct
{
GtkWidget *combx_server_list;
GtkWidget *toggle_autologin;
GtkWidget *toggle_log;
GtkWidget *toggle_notify;
GtkWidget *button_apply;
Expand Down
2 changes: 1 addition & 1 deletion client-frontend/dragon-tea/localization/locale-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ function gen_locales()

find ../ ../src -type f -name "*.c" -o -name "*.h" | xargs xgettext -j --msgid-bugs-address="[email protected]" --copyright-holder="badcast" --keyword=gettext --keyword=_ -o messages.pot --from-code=UTF-8 -d dragon-tea

gen_locales ru_RU kz_KZ
gen_locales ru_RU kk_KZ
Binary file not shown.
Binary file not shown.
64 changes: 43 additions & 21 deletions client-frontend/dragon-tea/localization/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-03-25 15:07+0500\n"
"POT-Creation-Date: 2024-04-03 03:46+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -18,37 +18,40 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"

#: ../src/tea.c:270 ../src/tea.c:273 ../src/tea.c:308 ../src/tea.c:311
#: ../src/tea.c:322
#: ../src/tea.c:322 ../src/teauilib/tea.c:322
msgid "Error"
msgstr ""

#: ../src/core/ui_about.c:9 ../src/core/ui.c:7 ../src/core/ui.c:21
#: ../src/teauilib/core/ui_about.c:9 ../src/teauilib/core/ui.c:21
msgid "Dragon Tea"
msgstr ""

#: ../src/core/ui_about.c:11
#: ../src/core/ui_about.c:11 ../src/teauilib/core/ui_about.c:11
msgid "Free messenger for transmission"
msgstr ""

#: ../src/core/ui_about.c:13
#: ../src/core/ui_about.c:13 ../src/teauilib/core/ui_about.c:13
msgid "WEB-Page"
msgstr ""

#: ../src/core/ui_settings.c:32 ../src/core/ui_settings.c:35
#: ../src/core/ui_settings.c:79
#: ../src/core/ui_settings.c:79 ../src/teauilib/core/ui_settings.c:79
msgid "Switch server: "
msgstr ""

#: ../src/core/ui_settings.c:46 ../src/core/ui_settings.c:49
#: ../src/core/ui_settings.c:105
#: ../src/core/ui_settings.c:105 ../src/teauilib/core/ui_settings.c:105
msgid "Apply changes"
msgstr ""

#: ../src/core/ui_authorize.c:84 ../src/core/ui_authorize.c:88
#: ../src/teauilib/core/ui_authorize.c:88
msgid "User is not exists."
msgstr ""

#: ../src/core/ui_authorize.c:93 ../src/core/ui_authorize.c:97
#: ../src/teauilib/core/ui_authorize.c:97
#, c-format
msgid ""
"Authentication is not confirmed:\n"
Expand All @@ -65,130 +68,147 @@ msgid ""
msgstr ""

#: ../src/core/ui_authorize.c:167 ../src/core/ui_authorize.c:171
#: ../src/teauilib/core/ui_authorize.c:171
msgid "The nickname should not be empty."
msgstr ""

#: ../src/core/ui_authorize.c:191 ../src/core/ui_authorize.c:195
#: ../src/teauilib/core/ui_authorize.c:195
msgid "You set is invalid ID"
msgstr ""

#: ../src/core/ui_authorize.c:225 ../src/core/ui_authorize.c:262
#: ../src/core/ui_authorize.c:229 ../src/core/ui_authorize.c:266
#: ../src/teauilib/core/ui_authorize.c:229
#: ../src/teauilib/core/ui_authorize.c:266
msgid "Sign in"
msgstr ""

#: ../src/core/ui_authorize.c:226 ../src/core/ui_authorize.c:306
#: ../src/core/ui_authorize.c:230 ../src/core/ui_authorize.c:310
#: ../src/teauilib/core/ui_authorize.c:230
#: ../src/teauilib/core/ui_authorize.c:310
msgid "Sign up"
msgstr ""

#: ../src/core/ui_authorize.c:235 ../src/core/ui_authorize.c:239
#: ../src/teauilib/core/ui_authorize.c:239
msgid ""
"Log in using your UserID\n"
"note: Numbers only, and it must be unique."
msgstr ""

#: ../src/core/ui_authorize.c:246 ../src/core/ui_authorize.c:250
#: ../src/teauilib/core/ui_authorize.c:250
msgid "Signing..."
msgstr ""

#: ../src/core/ui_authorize.c:254 ../src/core/ui_authorize.c:258
#: ../src/teauilib/core/ui_authorize.c:258
msgid "Set UserID..."
msgstr ""

#: ../src/core/ui_authorize.c:274 ../src/core/ui_authorize.c:278
#: ../src/teauilib/core/ui_authorize.c:278
msgid ""
"Enter your nickname.\n"
"Force the use of the Latin alphabet,\n"
"the length of the nickname is not more than 16 and not less than 3."
msgstr ""

#: ../src/core/ui_authorize.c:285 ../src/core/ui_authorize.c:289
#: ../src/teauilib/core/ui_authorize.c:289
msgid "Sign up..."
msgstr ""

#: ../src/core/ui_authorize.c:293 ../src/core/ui_authorize.c:297
#: ../src/teauilib/core/ui_authorize.c:297
msgid "Enter nickname..."
msgstr ""

#: ../src/core/ui.c:20 ../src/core/ui.c:34 ../src/core/ui.c:36
#: ../src/teauilib/core/ui.c:36
msgid "Authentication"
msgstr ""

#: ../src/core/ui.c:22 ../src/core/ui.c:36 ../src/core/ui.c:38
#: ../src/teauilib/core/ui.c:38
msgid "Dragon chat"
msgstr ""

#: ../src/core/ui.c:24 ../src/core/ui.c:38 ../src/core/ui.c:40
#: ../src/teauilib/core/ui.c:40
msgid "Configuration"
msgstr ""

#: ../src/core/ui.c:26 ../src/core/ui.c:40 ../src/core/ui.c:42
#: ../src/teauilib/core/ui.c:42
msgid "About"
msgstr ""

#: ../src/core/ui.c:72 ../src/core/ui.c:83 ../src/core/ui.c:97
#: ../src/core/ui.c:113 ../src/core/ui.c:100
#: ../src/core/ui.c:113 ../src/core/ui.c:100 ../src/teauilib/core/ui.c:100
msgid "You state is offline"
msgstr ""

#: ../src/core/ui_callbacks.c:81 ../src/core/ui_callbacks.c:85
#: ../src/core/ui_callbacks.c:83
#: ../src/core/ui_callbacks.c:83 ../src/teauilib/core/ui_callbacks.c:83
#, c-format
msgid "The message has been sent. Time of sending %s, received %s"
msgstr ""

#: ../src/core/ui_callbacks.c:98 ../src/core/ui_callbacks.c:102
#: ../src/core/ui_callbacks.c:100
#: ../src/core/ui_callbacks.c:100 ../src/teauilib/core/ui_callbacks.c:100
msgid "Error send."
msgstr ""

#: ../src/core/ui_callbacks.c:118 ../src/core/ui_callbacks.c:122
#: ../src/core/ui_callbacks.c:120 ../src/core/ui_callbacks.c:126
#: ../src/teauilib/core/ui_callbacks.c:126
#, c-format
msgid "Synchronization of %ld messages"
msgstr ""

#: ../src/core/ui_callbacks.c:136 ../src/core/ui_callbacks.c:137
#: ../src/core/ui_callbacks.c:141 ../src/core/ui_callbacks.c:139
#: ../src/core/ui_callbacks.c:145
#: ../src/core/ui_callbacks.c:145 ../src/teauilib/core/ui_callbacks.c:145
msgid "Your network has been restored. "
msgstr ""

#: ../src/core/ui_callbacks.c:140 ../src/core/ui_callbacks.c:141
#: ../src/core/ui_callbacks.c:145 ../src/core/ui_callbacks.c:143
#: ../src/core/ui_callbacks.c:149
#: ../src/core/ui_callbacks.c:149 ../src/teauilib/core/ui_callbacks.c:149
msgid "You're online."
msgstr ""

#: ../src/core/ui_callbacks.c:172 ../src/core/ui_callbacks.c:173
#: ../src/core/ui_callbacks.c:177 ../src/core/ui_callbacks.c:175
#: ../src/core/ui_callbacks.c:201
#: ../src/core/ui_callbacks.c:201 ../src/teauilib/core/ui_callbacks.c:201
msgid "Your account has been deleted."
msgstr ""

#: ../src/core/ui_callbacks.c:180 ../src/core/ui_callbacks.c:181
#: ../src/core/ui_callbacks.c:185 ../src/core/ui_callbacks.c:183
#: ../src/core/ui_callbacks.c:209
#: ../src/core/ui_callbacks.c:209 ../src/teauilib/core/ui_callbacks.c:209
#, c-format
msgid "Network error. Your connection has been reset (%d remains)"
msgstr ""

#: ../src/core/ui_callbacks.c:187 ../src/core/ui_callbacks.c:188
#: ../src/core/ui_callbacks.c:192 ../src/core/ui_callbacks.c:190
#: ../src/core/ui_callbacks.c:216
#: ../src/core/ui_callbacks.c:216 ../src/teauilib/core/ui_callbacks.c:216
msgid "Unknown error"
msgstr ""

#: ../src/core/ui_callbacks.c:247 ../src/core/ui_callbacks.c:248
#: ../src/core/ui_callbacks.c:252 ../src/core/ui_callbacks.c:250
#: ../src/core/ui_callbacks.c:276
#: ../src/core/ui_callbacks.c:276 ../src/teauilib/core/ui_callbacks.c:276
msgid "Sending..."
msgstr ""

#: ../src/core/ui_callbacks.c:263 ../src/core/ui_callbacks.c:266
#: ../src/core/ui_callbacks.c:270 ../src/core/ui_callbacks.c:268
#: ../src/core/ui_callbacks.c:294
#: ../src/core/ui_callbacks.c:294 ../src/teauilib/core/ui_callbacks.c:294
msgid "Login completed."
msgstr ""

Expand All @@ -206,14 +226,14 @@ msgid ""
"------\n"
msgstr ""

#: ../src/main.c:14 ../src/main.c:23
#: ../src/main.c:14 ../src/main.c:23 ../src/teauilib/teauilib.c:25
#, c-format
msgid ""
"The program is running as root. These privileges can harm the system, please "
"be aware of this. Closing."
msgstr ""

#: ../src/core/ui_authorize.c:127
#: ../src/core/ui_authorize.c:127 ../src/teauilib/core/ui_authorize.c:127
#, c-format
msgid ""
"Error registration:\n"
Expand All @@ -222,10 +242,12 @@ msgid ""
msgstr ""

#: ../src/core/ui_logs.c:49 ../src/core/ui_logs.c:53 ../src/core/ui_logs.c:56
#: ../src/teauilib/core/ui_logs.c:56
msgid "Clear log"
msgstr ""

#: ../src/core/ui_callbacks.c:285 ../src/core/ui_callbacks.c:311
#: ../src/teauilib/core/ui_callbacks.c:311
#, c-format
msgid ""
"------\n"
Expand All @@ -239,14 +261,14 @@ msgid ""
"------\n"
msgstr ""

#: ../src/core/ui_settings.c:92
#: ../src/core/ui_settings.c:92 ../src/teauilib/core/ui_settings.c:92
msgid "Show log window on startup"
msgstr ""

#: ../src/core/ui_callbacks.c:177
#: ../src/core/ui_callbacks.c:177 ../src/teauilib/core/ui_callbacks.c:177
msgid "Read message"
msgstr ""

#: ../src/core/ui_settings.c:96
#: ../src/core/ui_settings.c:96 ../src/teauilib/core/ui_settings.c:96
msgid "Remove old notifications"
msgstr ""
Loading

0 comments on commit 452a615

Please sign in to comment.