Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/majn/telegram-purple.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2019-05-12 18:47:19 +0300
committerBen Wiederhake <BenWiederhake.GitHub@gmx.de>2019-05-12 23:51:34 +0300
commit1ad94de0d4ea152afb2f64e70d141b9be25b6ac4 (patch)
tree6567299bc105d1d4585acd9f22490074e673cbd7
parenteb33ca12841d7f66c2f40ce450cb3cbd83b5c652 (diff)
Wrap up if-oneliners
Credits to this oneliner: $ grep -Prn '(?<!along with this program; )(?<!along with this library; )(?<![A-Za-z_#])if[^{]+$' *.c | grep -Fv '//'
-rw-r--r--telegram-purple.c7
-rw-r--r--tgp-chat.c6
-rw-r--r--tgp-msg.c14
-rw-r--r--tgp-request.c1
4 files changed, 16 insertions, 12 deletions
diff --git a/telegram-purple.c b/telegram-purple.c
index 1890c3b..e453f6f 100644
--- a/telegram-purple.c
+++ b/telegram-purple.c
@@ -421,8 +421,9 @@ static PurpleCmdRet tgprpl_cmd_kick(PurpleConversation *conv, const gchar *cmd,
pc = conv->account->gc;
id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv));
- if (pc == NULL || id == -1)
+ if (pc == NULL || id == -1) {
return PURPLE_CMD_RET_FAILED;
+ }
who = g_strjoinv(" ", args);
tgprpl_kick_from_chat(pc, id, who);
@@ -460,7 +461,6 @@ static GList* tgprpl_blist_node_menu (PurpleBlistNode *node) {
GList* menu = NULL;
if (PURPLE_BLIST_NODE_IS_BUDDY(node) &&
tgl_get_peer_type (tgp_blist_buddy_get_id ((PurpleBuddy *)node)) == TGL_PEER_USER) {
-
// Add encrypted chat option to the right click menu of all buddies
PurpleBuddy* buddy = (PurpleBuddy *)node;
PurpleMenuAction* action = purple_menu_action_new (_("Start secret chat..."), PURPLE_CALLBACK(start_secret_chat),
@@ -567,8 +567,9 @@ static void tgprpl_login (PurpleAccount * acct) {
return;
}
- if (purple_account_get_bool (acct, TGP_KEY_USE_IPV6, FALSE))
+ if (purple_account_get_bool (acct, TGP_KEY_USE_IPV6, FALSE)) {
tgl_enable_ipv6(TLS);
+ }
if (! tgp_startswith (purple_account_get_username (acct), "+")) {
// TRANSLATORS: Please fill in your own prefix!
diff --git a/tgp-chat.c b/tgp-chat.c
index 76cda6b..60f3749 100644
--- a/tgp-chat.c
+++ b/tgp-chat.c
@@ -225,11 +225,13 @@ unsigned int tgprpl_send_chat_typing (PurpleConversation *conv, PurpleTypingStat
PurpleConvChat *chat;
int id;
- if (!PURPLE_CONNECTION_IS_CONNECTED (gc))
+ if (!PURPLE_CONNECTION_IS_CONNECTED (gc)) {
return 0;
+ }
- if (g_strcmp0(purple_plugin_get_id (purple_connection_get_prpl (gc)), PLUGIN_ID))
+ if (g_strcmp0(purple_plugin_get_id (purple_connection_get_prpl (gc)), PLUGIN_ID)) {
return 0;
+ }
debug ("tgprpl_send_chat_typing()");
diff --git a/tgp-msg.c b/tgp-msg.c
index 91ed2a9..3ee67e5 100644
--- a/tgp-msg.c
+++ b/tgp-msg.c
@@ -522,10 +522,11 @@ static char *tgp_msg_reply_display (struct tgl_state *TLS, tgl_peer_t *replyee,
if (str_not_empty (reply->media.caption)) {
char *old = quote;
- if (str_not_empty (quote))
+ if (str_not_empty (quote)) {
quote = g_strdup_printf ("%s %s", old, reply->media.caption);
- else
+ } else {
quote = g_strdup(reply->media.caption);
+ }
g_free (old);
}
@@ -612,8 +613,9 @@ static void tgp_msg_display (struct tgl_state *TLS, struct tgp_msg_loading *C) {
} else
switch (M->media.type) {
case tgl_message_media_none:
- if (str_not_empty (M->message))
+ if (str_not_empty (M->message)) {
text = purple_markup_escape_text (M->message, strlen (M->message));
+ }
break;
case tgl_message_media_photo:
@@ -743,10 +745,11 @@ static void tgp_msg_display (struct tgl_state *TLS, struct tgp_msg_loading *C) {
//Captions are only used for some media types but others will just have them empty
if (str_not_empty (M->media.caption)) {
char *old = text;
- if (str_not_empty (text))
+ if (str_not_empty (text)) {
text = g_strdup_printf ("%s<br>%s", old, M->media.caption);
- else
+ } else {
text = g_strdup(M->media.caption);
+ }
g_free (old);
}
@@ -955,7 +958,6 @@ void tgp_msg_recv (struct tgl_state *TLS, struct tgl_message *M, GList *before)
*/
if (tgl_get_peer_type (C->msg->from_id) == TGL_PEER_CHANNEL
|| tgl_get_peer_type (C->msg->to_id) == TGL_PEER_CHANNEL) {
-
tgl_peer_id_t id = tgl_get_peer_type (C->msg->from_id) == TGL_PEER_CHANNEL ?
C->msg->from_id : C->msg->to_id;
diff --git a/tgp-request.c b/tgp-request.c
index c85ddea..81c3862 100644
--- a/tgp-request.c
+++ b/tgp-request.c
@@ -54,7 +54,6 @@ static void request_code (struct tgl_state *TLS, void (*callback) (struct tgl_st
!purple_request_input (tls_get_conn (TLS), _("Login code"), _("Enter login code"), explanation, NULL, 0, 0, _("the code"), _("OK"),
G_CALLBACK(request_code_entered), _("Cancel"), G_CALLBACK(request_canceled_disconnect), tls_get_pa (TLS),
NULL, NULL, request_values_data_init (TLS, callback, arg, 0))) {
-
// the purple request API is not supported, create a new conversation (the Telegram system account "Telegram") to
// prompt the user for the code.
tls_get_data (TLS)->request_code_data = request_values_data_init (TLS, callback, arg, 0);