@@ -1064,6 +1064,10 @@ drag_free_offer(Window *w) {
10641064 for (size_t i = 0 ; i < ds .num_mimes ; i ++ ) {
10651065 free (ds .items [i ].optional_data );
10661066 if (ds .items [i ].fd_plus_one > 0 ) safe_close (ds .items [i ].fd_plus_one - 1 , __FILE__ , __LINE__ );
1067+ if (ds .items [i ].uri_list ) {
1068+ for (size_t k = 0 ; k < ds .items [i ].num_uris ; k ++ ) free ((char * )ds .items [i ].uri_list [k ]);
1069+ free (ds .items [i ].uri_list );
1070+ }
10671071 }
10681072 free (ds .items );
10691073 ds .items = NULL ;
@@ -1471,11 +1475,35 @@ drag_process_item_data(Window *w, size_t idx, int has_more, const uint8_t *paylo
14711475 }
14721476}
14731477
1478+ static const char * *
1479+ parse_uri_list (int fd ) {
1480+ (void )fd ;
1481+ // TODO: Implement this, it should read the uri list from fd, parse
1482+ // it ignoring comments, see get_nth_file_url() for an example of
1483+ // parsing a uri list. If an error occurs it should call abrt() with
1484+ // appropriate error code and return NULL. The returned value should
1485+ // be a list of strings alloced by malloc with each string also
1486+ // alloced by malloc.
1487+ return NULL ;
1488+ }
1489+
1490+
14741491void
14751492drag_remote_file_data (
14761493 Window * w , int32_t x , int32_t y , int32_t X , int32_t Y , bool has_more , const uint8_t * payload , size_t payload_sz
14771494) {
1478- (void )w ; (void )x ; (void )y ; (void )X ; (void )Y ; (void )has_more ; (void )payload ; (void )payload_sz ;
1495+ size_t item_idx = ds .num_mimes ;
1496+ for (size_t i = 0 ; i < ds .num_mimes ; i ++ ) {
1497+ if (ds .items [i ].requested_remote_files ) {
1498+ item_idx = i ; break ;
1499+ }
1500+ }
1501+ if (item_idx == ds .num_mimes || ds .items [item_idx ].fd_plus_one == 0 ) abrt (EINVAL );
1502+ if (ds .items [item_idx ].uri_list == NULL ) {
1503+ ds .items [item_idx ].uri_list = parse_uri_list (ds .items [item_idx ].fd_plus_one - 1 );
1504+ if (!ds .items [item_idx ].uri_list ) return ;
1505+ }
1506+ (void )x ; (void )y ; (void )X ; (void )Y ; (void )has_more ; (void )payload ; (void )payload_sz ;
14791507 // TODO: Implement this
14801508}
14811509#undef img
0 commit comments