Conversation
mlj
left a comment
There was a problem hiding this comment.
Thank you, this looks good.
Can you also add documentation for the new option in castgetrc.5.ronn?
| } | ||
|
|
||
| static int _cast_channel_save_channel(FILE *f, gpointer user_data, int debug) | ||
| static int _cast_channel_save_channel(FILE *f, gpointer user_data, int debug, channel *cc) |
There was a problem hiding this comment.
Please rename the new parameter to c for consistency.
(Ideally, we'd avoid this new parameter, cf. comment on _rss_open_url_cb()).
| c->regex_filter = g_strdup(defaults->regex_filter); | ||
|
|
||
| if (!c->user_agent && defaults->user_agent) | ||
| c->user_agent = g_strdup(defaults->user_agent); |
There was a problem hiding this comment.
Please also free the duplicated string in channel_configuration_free().
| static int _rss_open_url_cb(FILE *f, gpointer user_data, int debug) | ||
| static int _rss_open_url_cb(FILE *f, gpointer user_data, int debug, channel *c) | ||
| { | ||
| gchar *url = (gchar *)user_data; |
There was a problem hiding this comment.
I think it would be better if you passed the channel to the function via user_data, i.e. use a struct with the URL and the channel and pass a pointer to that struct.
That said, the callbacks already make this code hard to read, and it is in general need of a rewrite so perhaps it's better to address this separately after merging this change.
fixes #31
demo:
client machine:
server apache logs: