summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-03-24 17:08:56 +0100
committerSébastien Helleu <flashcode@flashtux.org>2018-03-24 17:08:56 +0100
commit50d39969cb1fb6bd46213b185d5ae764cfd60d3a (patch)
tree8baa58205e504d1bb6b12c5643c9a6bb562981df /src/plugins/irc
parent837eb82edd3dc954ca2f7e2fb04be41bb807ab97 (diff)
downloadweechat-50d39969cb1fb6bd46213b185d5ae764cfd60d3a.zip
irc: fix some styles
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-channel.c11
-rw-r--r--src/plugins/irc/irc-channel.h2
-rw-r--r--src/plugins/irc/irc-command.c2
-rw-r--r--src/plugins/irc/irc-completion.c3
-rw-r--r--src/plugins/irc/irc-modelist.c27
-rw-r--r--src/plugins/irc/irc-modelist.h12
-rw-r--r--src/plugins/irc/irc-protocol.c18
-rw-r--r--src/plugins/irc/irc-upgrade.h2
8 files changed, 52 insertions, 25 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index e93b1d373..a89b8e38b 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -427,7 +427,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
{
struct t_irc_channel *new_channel;
struct t_gui_buffer *ptr_buffer;
- const char *chanmodes;
+ const char *ptr_chanmode;
/* create buffer for channel (or use existing one) */
ptr_buffer = irc_channel_create_buffer (server, channel_type,
@@ -483,9 +483,11 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
new_channel->last_nick_speaking_time = NULL;
new_channel->modelists = NULL;
new_channel->last_modelist = NULL;
- for (chanmodes = irc_server_get_chanmodes (server); chanmodes[0] && chanmodes[0] != ','; chanmodes++)
+ for (ptr_chanmode = irc_server_get_chanmodes (server); ptr_chanmode[0];
+ ptr_chanmode++)
{
- irc_modelist_new (new_channel, chanmodes[0]);
+ if (ptr_chanmode[0] != ',')
+ irc_modelist_new (new_channel, ptr_chanmode[0]);
}
new_channel->join_smart_filtered = NULL;
new_channel->buffer = ptr_buffer;
@@ -1709,7 +1711,8 @@ irc_channel_print_log (struct t_irc_channel *channel)
{
irc_nick_print_log (ptr_nick);
}
- for (ptr_modelist = channel->modelists; ptr_modelist; ptr_modelist = ptr_modelist->next_modelist)
+ for (ptr_modelist = channel->modelists; ptr_modelist;
+ ptr_modelist = ptr_modelist->next_modelist)
{
irc_modelist_print_log (ptr_modelist);
}
diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h
index 7434acff4..b0505434a 100644
--- a/src/plugins/irc/irc-channel.h
+++ b/src/plugins/irc/irc-channel.h
@@ -72,7 +72,7 @@ struct t_irc_channel
struct t_irc_channel_speaking *nicks_speaking_time; /* for smart filter */
/* of join/part/quit messages */
struct t_irc_channel_speaking *last_nick_speaking_time;
- struct t_irc_modelist *modelists; /* modelists in the channel */
+ struct t_irc_modelist *modelists; /* modelists in the channel */
struct t_irc_modelist *last_modelist; /* last modelist in the channel */
struct t_hashtable *join_smart_filtered; /* smart filtered joins */
struct t_gui_buffer *buffer; /* buffer allocated for channel */
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 0b9a81a1e..aa0331828 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -279,7 +279,7 @@ irc_command_mode_masks (struct t_irc_server *server,
if (ptr_channel)
{
/* use modelist item for number arguments */
- if (set[0] == '-' && ptr_modelist)
+ if (ptr_modelist && (set[0] == '-'))
{
error = NULL;
number = strtol (argv[pos_masks], &error, 10);
diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c
index e3b2f834d..b0e0c2dd1 100644
--- a/src/plugins/irc/irc-completion.c
+++ b/src/plugins/irc/irc-completion.c
@@ -450,7 +450,8 @@ irc_completion_modelist_cb (const void *pointer, void *data,
ptr_modelist = irc_modelist_search (ptr_channel, pos[0]);
if (ptr_modelist)
{
- for (ptr_item = ptr_modelist->items; ptr_item; ptr_item = ptr_item->next_item)
+ for (ptr_item = ptr_modelist->items; ptr_item;
+ ptr_item = ptr_item->next_item)
{
weechat_hook_completion_list_add (completion,
ptr_item->mask,
diff --git a/src/plugins/irc/irc-modelist.c b/src/plugins/irc/irc-modelist.c
index e9226c784..697e8da39 100644
--- a/src/plugins/irc/irc-modelist.c
+++ b/src/plugins/irc/irc-modelist.c
@@ -2,6 +2,7 @@
* irc-modelist.c - channel mode list management for IRC plugin
*
* Copyright (C) 2015 Simmo Saan <simmo.saan@gmail.com>
+ * Copyright (C) 2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -41,7 +42,8 @@
*/
int
-irc_modelist_item_valid (struct t_irc_modelist *modelist, struct t_irc_modelist_item *item)
+irc_modelist_item_valid (struct t_irc_modelist *modelist,
+ struct t_irc_modelist_item *item)
{
struct t_irc_modelist_item *ptr_item;
@@ -81,7 +83,8 @@ irc_modelist_item_new (struct t_irc_modelist *modelist,
}
/* initialize new item */
- new_item->number = (modelist->last_item) ? modelist->last_item->number + 1 : 0;
+ new_item->number = (modelist->last_item) ?
+ modelist->last_item->number + 1 : 0;
new_item->mask = strdup (mask);
new_item->setter = (setter) ? strdup (setter) : NULL;
new_item->datetime = datetime;
@@ -95,9 +98,11 @@ irc_modelist_item_new (struct t_irc_modelist *modelist,
modelist->items = new_item;
modelist->last_item = new_item;
- if (modelist->state == IRC_MODELIST_STATE_EMPTY ||
- modelist->state == IRC_MODELIST_STATE_RECEIVED)
+ if ((modelist->state == IRC_MODELIST_STATE_EMPTY) ||
+ (modelist->state == IRC_MODELIST_STATE_RECEIVED))
+ {
modelist->state = IRC_MODELIST_STATE_MODIFIED;
+ }
/* all is OK, return address of new item */
return new_item;
@@ -108,14 +113,15 @@ irc_modelist_item_new (struct t_irc_modelist *modelist,
*/
void
-irc_modelist_item_free (struct t_irc_modelist *modelist, struct t_irc_modelist_item *item)
+irc_modelist_item_free (struct t_irc_modelist *modelist,
+ struct t_irc_modelist_item *item)
{
struct t_irc_modelist_item *new_items;
if (!modelist || !item)
return;
- /* remove channel from channels list */
+ /* remove item from modelist list */
if (modelist->last_item == item)
modelist->last_item = item->prev_item;
if (item->prev_item)
@@ -211,7 +217,8 @@ irc_modelist_item_number (struct t_irc_modelist *modelist, int number)
*/
int
-irc_modelist_valid (struct t_irc_channel *channel, struct t_irc_modelist *modelist)
+irc_modelist_valid (struct t_irc_channel *channel,
+ struct t_irc_modelist *modelist)
{
struct t_irc_modelist *ptr_modelist;
@@ -273,7 +280,8 @@ irc_modelist_new (struct t_irc_channel *channel, char type)
*/
void
-irc_modelist_free (struct t_irc_channel *channel, struct t_irc_modelist *modelist)
+irc_modelist_free (struct t_irc_channel *channel,
+ struct t_irc_modelist *modelist)
{
struct t_irc_modelist *new_modelists;
@@ -343,7 +351,8 @@ irc_modelist_search (struct t_irc_channel *channel, char type)
*/
struct t_hdata *
-irc_modelist_hdata_item_cb (const void *pointer, void *data, const char *hdata_name)
+irc_modelist_hdata_item_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
struct t_hdata *hdata;
diff --git a/src/plugins/irc/irc-modelist.h b/src/plugins/irc/irc-modelist.h
index 1e709dd5a..a8a7775b5 100644
--- a/src/plugins/irc/irc-modelist.h
+++ b/src/plugins/irc/irc-modelist.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 Simmo Saan <simmo.saan@gmail.com>
+ * Copyright (C) 2018 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -17,8 +18,10 @@
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef WEECHAT_IRC_MODELIST_H
-#define WEECHAT_IRC_MODELIST_H 1
+#ifndef WEECHAT_PLUGIN_IRC_MODELIST_H
+#define WEECHAT_PLUGIN_IRC_MODELIST_H
+
+#include <time.h>
/* modelist states */
#define IRC_MODELIST_STATE_EMPTY 0
@@ -75,7 +78,8 @@ extern void irc_modelist_free_all (struct t_irc_channel *channel);
extern struct t_irc_modelist *irc_modelist_search (struct t_irc_channel *channel,
char type);
-extern struct t_hdata *irc_modelist_hdata_item_cb (const void *pointer, void *data,
+extern struct t_hdata *irc_modelist_hdata_item_cb (const void *pointer,
+ void *data,
const char *hdata_name);
extern struct t_hdata *irc_modelist_hdata_modelist_cb (const void *pointer,
void *data,
@@ -87,4 +91,4 @@ extern int irc_modelist_add_to_infolist (struct t_infolist *infolist,
extern void irc_modelist_item_print_log (struct t_irc_modelist_item *item);
extern void irc_modelist_print_log (struct t_irc_modelist *modelist);
-#endif /* WEECHAT_IRC_MODELIST_H */
+#endif /* WEECHAT_PLUGIN_IRC_MODELIST_H */
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 177d945e0..59d93339b 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -1010,7 +1010,9 @@ IRC_PROTOCOL_CALLBACK(kick)
for (ptr_modelist = ptr_channel->modelists; ptr_modelist;
ptr_modelist = ptr_modelist->next_modelist)
+ {
ptr_modelist->state = IRC_MODELIST_STATE_MODIFIED;
+ }
/* read option "autorejoin" in server */
rejoin = IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTOREJOIN);
@@ -1129,7 +1131,9 @@ IRC_PROTOCOL_CALLBACK(kill)
for (ptr_modelist = ptr_channel->modelists; ptr_modelist;
ptr_modelist = ptr_modelist->next_modelist)
+ {
ptr_modelist->state = IRC_MODELIST_STATE_MODIFIED;
+ }
irc_bar_item_update_channel ();
}
@@ -1771,7 +1775,9 @@ IRC_PROTOCOL_CALLBACK(part)
for (ptr_modelist = ptr_channel->modelists; ptr_modelist;
ptr_modelist = ptr_modelist->next_modelist)
+ {
ptr_modelist->state = IRC_MODELIST_STATE_MODIFIED;
+ }
/* cycling ? => rejoin channel immediately */
if (ptr_channel->cycle)
@@ -3906,7 +3912,8 @@ IRC_PROTOCOL_CALLBACK(346)
ptr_channel->buffer : server->buffer;
ptr_modelist = irc_modelist_search (ptr_channel, 'I');
- if (ptr_modelist) {
+ if (ptr_modelist)
+ {
/* start receiving new list */
if (ptr_modelist->state != IRC_MODELIST_STATE_RECEIVING)
{
@@ -4065,7 +4072,8 @@ IRC_PROTOCOL_CALLBACK(348)
ptr_channel->buffer : server->buffer;
ptr_modelist = irc_modelist_search (ptr_channel, 'e');
- if (ptr_modelist) {
+ if (ptr_modelist)
+ {
/* start receiving new list */
if (ptr_modelist->state != IRC_MODELIST_STATE_RECEIVING)
{
@@ -4857,7 +4865,8 @@ IRC_PROTOCOL_CALLBACK(367)
ptr_channel->buffer : server->buffer;
ptr_modelist = irc_modelist_search (ptr_channel, 'b');
- if (ptr_modelist) {
+ if (ptr_modelist)
+ {
/* start receiving new list */
if (ptr_modelist->state != IRC_MODELIST_STATE_RECEIVING)
{
@@ -5317,7 +5326,8 @@ IRC_PROTOCOL_CALLBACK(728)
ptr_channel->buffer : server->buffer;
ptr_modelist = irc_modelist_search (ptr_channel, argv[4][0]);
- if (ptr_modelist) {
+ if (ptr_modelist)
+ {
/* start receiving new list */
if (ptr_modelist->state != IRC_MODELIST_STATE_RECEIVING)
{
diff --git a/src/plugins/irc/irc-upgrade.h b/src/plugins/irc/irc-upgrade.h
index acfc39120..fa2a0734c 100644
--- a/src/plugins/irc/irc-upgrade.h
+++ b/src/plugins/irc/irc-upgrade.h
@@ -34,7 +34,7 @@ enum t_irc_upgrade_type
IRC_UPGRADE_TYPE_REDIRECT,
IRC_UPGRADE_TYPE_NOTIFY,
IRC_UPGRADE_TYPE_MODELIST,
- IRC_UPGRADE_TYPE_MODELIST_ITEM
+ IRC_UPGRADE_TYPE_MODELIST_ITEM,
};
extern int irc_upgrade_save ();