Changeset e4816ea
- Timestamp:
- 2010-05-08T00:48:48Z (15 years ago)
- Branches:
- master
- Children:
- a87754b
- Parents:
- b17ce85
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_im.c
rb17ce85 re4816ea 27 27 #include "dcc.h" 28 28 29 /* IM->IRC callbacks */29 /* IM->IRC callbacks: Simple IM/buddy-related stuff. */ 30 30 31 31 static const struct irc_user_funcs irc_user_im_funcs; … … 203 203 } 204 204 205 206 /* Groupchats */ 205 /* IRC->IM calls */ 206 207 static gboolean bee_irc_user_privmsg( irc_user_t *iu, const char *msg ) 208 { 209 if( iu->bu ) 210 return bee_user_msg( iu->irc->b, iu->bu, msg, 0 ); 211 else 212 return FALSE; 213 } 214 215 static gboolean bee_irc_user_ctcp( irc_user_t *iu, char *const *ctcp ) 216 { 217 if( ctcp[1] && g_strcasecmp( ctcp[0], "DCC" ) == 0 218 && g_strcasecmp( ctcp[1], "SEND" ) == 0 ) 219 { 220 if( iu->bu && iu->bu->ic && iu->bu->ic->acc->prpl->transfer_request ) 221 { 222 file_transfer_t *ft = dcc_request( iu->bu->ic, ctcp ); 223 if ( ft ) 224 iu->bu->ic->acc->prpl->transfer_request( iu->bu->ic, ft, iu->bu->handle ); 225 226 return TRUE; 227 } 228 } 229 else if( g_strcasecmp( ctcp[0], "TYPING" ) == 0 ) 230 { 231 if( iu->bu && iu->bu->ic && iu->bu->ic->acc->prpl->send_typing && ctcp[1] ) 232 { 233 int st = ctcp[1][0]; 234 if( st >= '0' && st <= '2' ) 235 { 236 st <<= 8; 237 iu->bu->ic->acc->prpl->send_typing( iu->bu->ic, iu->bu->handle, st ); 238 } 239 240 return TRUE; 241 } 242 } 243 244 return FALSE; 245 } 246 247 static const struct irc_user_funcs irc_user_im_funcs = { 248 bee_irc_user_privmsg, 249 bee_irc_user_ctcp, 250 }; 251 252 253 /* IM->IRC: Groupchats */ 207 254 gboolean bee_irc_chat_new( bee_t *bee, struct groupchat *c ) 208 255 { … … 289 336 290 337 291 /* File transfers */338 /* IM->IRC: File transfers */ 292 339 static file_transfer_t *bee_irc_ft_in_start( bee_t *bee, bee_user_t *bu, const char *file_name, size_t file_size ) 293 340 { … … 335 382 bee_irc_ft_finished, 336 383 }; 337 338 339 /* IRC->IM calls */340 341 static gboolean bee_irc_user_privmsg( irc_user_t *iu, const char *msg )342 {343 if( iu->bu )344 return bee_user_msg( iu->irc->b, iu->bu, msg, 0 );345 else346 return FALSE;347 }348 349 static gboolean bee_irc_user_ctcp( irc_user_t *iu, char *const *ctcp )350 {351 if( ctcp[1] && g_strcasecmp( ctcp[0], "DCC" ) == 0352 && g_strcasecmp( ctcp[1], "SEND" ) == 0 )353 {354 if( iu->bu && iu->bu->ic && iu->bu->ic->acc->prpl->transfer_request )355 {356 file_transfer_t *ft = dcc_request( iu->bu->ic, ctcp );357 if ( ft )358 iu->bu->ic->acc->prpl->transfer_request( iu->bu->ic, ft, iu->bu->handle );359 360 return TRUE;361 }362 }363 else if( g_strcasecmp( ctcp[0], "TYPING" ) == 0 )364 {365 if( iu->bu && iu->bu->ic && iu->bu->ic->acc->prpl->send_typing && ctcp[1] )366 {367 int st = ctcp[1][0];368 if( st >= '0' && st <= '2' )369 {370 st <<= 8;371 iu->bu->ic->acc->prpl->send_typing( iu->bu->ic, iu->bu->handle, st );372 }373 374 return TRUE;375 }376 }377 378 return FALSE;379 }380 381 static const struct irc_user_funcs irc_user_im_funcs = {382 bee_irc_user_privmsg,383 bee_irc_user_ctcp,384 };
Note: See TracChangeset
for help on using the changeset viewer.