Changeset 75c3ff7 for protocols/purple
- Timestamp:
- 2010-05-21T00:09:29Z (15 years ago)
- Branches:
- master
- Children:
- 2c5fabc
- Parents:
- e7dc02a
- Location:
- protocols/purple
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/purple/ft.c
re7dc02a r75c3ff7 40 40 struct im_connection *ic; 41 41 int fd; 42 char *fn, * orig_fn, *handle;42 char *fn, *handle; 43 43 gboolean ui_wants_data; 44 44 }; … … 89 89 xfer->ui_data = px; 90 90 px->xfer = xfer; 91 92 purple_xfer_set_filename( xfer, px->orig_fn );93 purple_xfer_set_local_filename( xfer, px->fn );94 91 95 92 next_ft = NULL; … … 152 149 if( lseek( px->fd, 0, SEEK_CUR ) == px->xfer->size ) 153 150 { 154 purple_xfer_end( px->xfer );151 /*purple_xfer_end( px->xfer );*/ 155 152 imcb_file_finished( ft ); 156 153 } … … 177 174 178 175 g_free( px->fn ); 179 g_free( px->orig_fn );180 176 g_free( px->handle ); 181 177 if( px->fd >= 0 ) … … 195 191 if( *px->fn ) 196 192 { 197 //unlink( px->fn ); 193 char *slash; 194 195 unlink( px->fn ); 196 if( ( slash = strrchr( px->fn, '/' ) ) ) 197 { 198 *slash = '\0'; 199 rmdir( px->fn ); 200 } 198 201 *px->fn = '\0'; 199 202 } … … 226 229 struct prpl_xfer_data *px = xfer->ui_data; 227 230 228 imcb_file_canceled( px->ft, "Canceled by remote end" ); 229 } 230 231 static void prplcb_xfer_add( PurpleXfer *xfer ) 232 { 233 if( purple_xfer_get_type( xfer ) == PURPLE_XFER_SEND ) 234 { 235 struct prpl_xfer_data *px = xfer->ui_data; 236 237 purple_xfer_set_filename( xfer, px->orig_fn ); 238 } 231 if( px->ft ) 232 imcb_file_canceled( px->ft, "Canceled by remote end" ); 233 else 234 /* px->ft == NULL for sends, because of the two stages. :-/ */ 235 imcb_error( px->ic, "File transfer cancelled by remote end" ); 239 236 } 240 237 … … 252 249 { 253 250 struct prpl_xfer_data *px = g_new0( struct prpl_xfer_data, 1 ); 251 char *dir, *basename; 254 252 255 253 ft->data = px; 256 254 px->ft = ft; 257 px->fn = g_strdup( "/tmp/bitlbee-purple-ft.XXXXXX" ); 258 px->fd = mkstemp( px->fn ); 255 256 dir = g_strdup( "/tmp/bitlbee-purple-ft.XXXXXX" ); 257 if( !mkdtemp( dir ) ) 258 { 259 imcb_error( ic, "Could not create temporary file for file transfer" ); 260 g_free( px ); 261 g_free( dir ); 262 return; 263 } 264 265 if( ( basename = strrchr( ft->file_name, '/' ) ) ) 266 basename++; 267 else 268 basename = ft->file_name; 269 px->fn = g_strdup_printf( "%s/%s", dir, basename ); 270 px->fd = open( px->fn, O_WRONLY | O_CREAT, 0600 ); 271 g_free( dir ); 272 273 if( px->fd < 0 ) 274 { 275 imcb_error( ic, "Could not create temporary file for file transfer" ); 276 g_free( px ); 277 g_free( px->fn ); 278 return; 279 } 259 280 260 281 px->ic = ic; 261 282 px->handle = g_strdup( handle ); 262 px->orig_fn = g_strdup( ft->file_name );263 283 264 284 imcb_log( ic, "Due to libpurple limitations, the file has to be cached locally before proceeding with the actual file transfer. Please wait..." ); … … 324 344 prplcb_xfer_new, 325 345 prplcb_xfer_destroy, 326 prplcb_xfer_add,346 NULL, /* prplcb_xfer_add, */ 327 347 prplcb_xfer_progress, 328 348 prplcb_xfer_dbg, -
protocols/purple/purple.c
re7dc02a r75c3ff7 841 841 purple_notify_set_ui_ops( &bee_notify_uiops ); 842 842 purple_xfers_set_ui_ops( &bee_xfer_uiops ); 843 //purple_debug_set_ui_ops( &bee_debug_uiops );843 purple_debug_set_ui_ops( &bee_debug_uiops ); 844 844 } 845 845
Note: See TracChangeset
for help on using the changeset viewer.