-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for user_agent configuration #62
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this looks good.
Can you also add documentation for the new option in castgetrc.5.ronn
?
@@ -126,7 +127,7 @@ static void _cast_channel_save_downloaded_enclosure(gpointer key, | |||
g_free(escaped_key); | |||
} | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename the new parameter to c
for consistency.
(Ideally, we'd avoid this new parameter, cf. comment on _rss_open_url_cb()
).
@@ -143,6 +144,9 @@ struct channel_configuration *channel_configuration_new( | |||
|
|||
if (!c->regex_filter && defaults->regex_filter) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also free the duplicated string in channel_configuration_free()
.
@@ -252,20 +253,20 @@ rss_file *rss_open_file(const char *filename) | |||
return f; | |||
} | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: