Before making any significant changes, let's identify the existing xfer types by either active or passive.
{
weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
weechat_infolist_new_var_string (item, "plugin_id", ptr_server->name);
- weechat_infolist_new_var_string (item, "type_string", "file_send");
+ weechat_infolist_new_var_string (item, "type_string", "file_send_passive");
weechat_infolist_new_var_string (item, "protocol_string", "dcc");
weechat_infolist_new_var_string (item, "remote_nick", argv[2]);
weechat_infolist_new_var_string (item, "local_nick", ptr_server->nick);
{
weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
weechat_infolist_new_var_string (item, "plugin_id", server->name);
- weechat_infolist_new_var_string (item, "type_string", "file_recv");
+ weechat_infolist_new_var_string (item, "type_string", "file_recv_active");
weechat_infolist_new_var_string (item, "protocol_string", "dcc");
weechat_infolist_new_var_string (item, "remote_nick", nick);
weechat_infolist_new_var_string (item, "local_nick", server->nick);
{
weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
weechat_infolist_new_var_string (item, "plugin_id", server->name);
- weechat_infolist_new_var_string (item, "type_string", "file_recv");
+ weechat_infolist_new_var_string (item, "type_string", "file_recv_active");
weechat_infolist_new_var_string (item, "filename",
(filename) ? filename : pos_file);
weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
{
weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
weechat_infolist_new_var_string (item, "plugin_id", server->name);
- weechat_infolist_new_var_string (item, "type_string", "file_recv");
+ weechat_infolist_new_var_string (item, "type_string", "file_recv_active");
weechat_infolist_new_var_string (item, "filename",
(filename) ? filename : pos_file);
weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
if (type && converted_addr[0])
{
/* send DCC PRIVMSG */
- if (strcmp (type, "file_send") == 0)
+ if (strcmp (type, "file_send_passive") == 0)
{
filename = weechat_infolist_string (infolist, "filename");
spaces_in_name = (strchr (filename, ' ') != NULL);
if (xfer->status == XFER_STATUS_CONNECTING)
{
- if (xfer->type == XFER_TYPE_FILE_SEND)
+ if (xfer->type == XFER_TYPE_FILE_SEND_PASSIVE)
{
xfer->last_activity = time (NULL);
sock = accept (xfer->sock,
struct t_weechat_plugin *weechat_xfer_plugin = NULL;
char *xfer_type_string[] = /* strings for types */
-{ "file_recv", "file_send", "chat_recv",
- "chat_send"
+{ "file_recv_active", "file_recv_passive",
+ "file_send_active", "file_send_passive",
+ "chat_recv", "chat_send"
};
char *xfer_protocol_string[] = /* strings for protocols */
(xfer->status == XFER_STATUS_DONE) ? "" : weechat_prefix ("error"),
XFER_PLUGIN_NAME,
xfer->filename,
- (xfer->type == XFER_TYPE_FILE_SEND) ? _("sent to") : _("received from"),
+ (xfer->type == XFER_TYPE_FILE_SEND_PASSIVE) ? _("sent to") : _("received from"),
xfer->remote_nick,
xfer->remote_address_str,
(xfer->status == XFER_STATUS_DONE) ? _("OK") : _("FAILED"));
new_xfer->hash_target = NULL;
new_xfer->hash_status = XFER_HASH_STATUS_UNKNOWN;
- if ((type == XFER_TYPE_FILE_RECV)
+ if ((type == XFER_TYPE_FILE_RECV_ACTIVE)
&& weechat_config_boolean (xfer_config_file_auto_check_crc32))
{
ptr_crc32 = xfer_file_search_crc32 (new_xfer->filename);
/* write info message on core buffer */
switch (type)
{
- case XFER_TYPE_FILE_RECV:
+ case XFER_TYPE_FILE_RECV_ACTIVE:
weechat_printf (NULL,
_("%s: incoming file from %s "
"(%s, %s.%s), name: %s, %llu bytes "
xfer_protocol_string[protocol]);
xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE);
break;
- case XFER_TYPE_FILE_SEND:
+ case XFER_TYPE_FILE_SEND_PASSIVE:
weechat_printf (NULL,
_("%s: offering file to %s (%s.%s), name: %s "
"(local filename: %s), %llu bytes (protocol: %s)"),
*/
if ((XFER_IS_RECV(type)
&& xfer_nick_auto_accepted (new_xfer->plugin_id, new_xfer->remote_nick))
- || ((type == XFER_TYPE_FILE_RECV)
+ || ((type == XFER_TYPE_FILE_RECV_ACTIVE)
&& weechat_config_boolean (xfer_config_file_auto_accept_files))
|| ((type == XFER_TYPE_CHAT_RECV)
&& weechat_config_boolean (xfer_config_file_auto_accept_chats)))
}
}
- if (type == XFER_TYPE_FILE_RECV)
+ if (type == XFER_TYPE_FILE_RECV_ACTIVE)
{
filename2 = strdup (filename);
sscanf (weechat_infolist_string (infolist, "size"), "%llu", &file_size);
}
- if (type == XFER_TYPE_FILE_SEND)
+ if (type == XFER_TYPE_FILE_SEND_PASSIVE)
{
/* add home if filename not beginning with '/' or '~' (not for Win32) */
#ifdef _WIN32
}
}
- if (type == XFER_TYPE_FILE_RECV)
+ if (type == XFER_TYPE_FILE_RECV_ACTIVE)
{
if (filename2)
{
sscanf (str_start_resume, "%llu", &start_resume);
- ptr_xfer = xfer_search (plugin_name, plugin_id, XFER_TYPE_FILE_RECV,
+ ptr_xfer = xfer_search (plugin_name, plugin_id, XFER_TYPE_FILE_RECV_ACTIVE,
XFER_STATUS_CONNECTING, port);
if (ptr_xfer)
{
sscanf (str_start_resume, "%llu", &start_resume);
- ptr_xfer = xfer_search (plugin_name, plugin_id, XFER_TYPE_FILE_SEND,
+ ptr_xfer = xfer_search (plugin_name, plugin_id, XFER_TYPE_FILE_SEND_PASSIVE,
XFER_STATUS_CONNECTING, port);
if (ptr_xfer)
{
enum t_xfer_type
{
- XFER_TYPE_FILE_RECV = 0,
- XFER_TYPE_FILE_SEND,
+ XFER_TYPE_FILE_RECV_ACTIVE = 0,
+ XFER_TYPE_FILE_RECV_PASSIVE,
+ XFER_TYPE_FILE_SEND_ACTIVE,
+ XFER_TYPE_FILE_SEND_PASSIVE,
XFER_TYPE_CHAT_RECV,
XFER_TYPE_CHAT_SEND,
/* number of xfer types */
/* macros for type/status */
-#define XFER_IS_FILE(type) ((type == XFER_TYPE_FILE_RECV) || \
- (type == XFER_TYPE_FILE_SEND))
+#define XFER_IS_FILE(type) ((type == XFER_TYPE_FILE_RECV_ACTIVE) || \
+ (type == XFER_TYPE_FILE_RECV_PASSIVE) || \
+ (type == XFER_TYPE_FILE_SEND_ACTIVE) || \
+ (type == XFER_TYPE_FILE_SEND_PASSIVE))
#define XFER_IS_CHAT(type) ((type == XFER_TYPE_CHAT_RECV) || \
(type == XFER_TYPE_CHAT_SEND))
-#define XFER_IS_RECV(type) ((type == XFER_TYPE_FILE_RECV) || \
+#define XFER_IS_RECV(type) ((type == XFER_TYPE_FILE_RECV_ACTIVE) || \
+ (type == XFER_TYPE_FILE_RECV_PASSIVE) || \
(type == XFER_TYPE_CHAT_RECV))
-#define XFER_IS_SEND(type) ((type == XFER_TYPE_FILE_SEND) || \
+#define XFER_IS_SEND(type) ((type == XFER_TYPE_FILE_SEND_ACTIVE) || \
+ (type == XFER_TYPE_FILE_SEND_PASSIVE) || \
(type == XFER_TYPE_CHAT_SEND))
+#define XFER_IS_ACTIVE(type) ((type == XFER_TYPE_FILE_RECV_ACTIVE) || \
+ (type == XFER_TYPE_FILE_SEND_ACTIVE))
+#define XFER_IS_PASSIVE(type) ((type == XFER_TYPE_FILE_RECV_PASSIVE) || \
+ (type == XFER_TYPE_FILE_SEND_PASSIVE))
#define XFER_HAS_ENDED(status) ((status == XFER_STATUS_DONE) || \
(status == XFER_STATUS_FAILED) || \