Changeset 15bc063 for protocols/twitter
- Timestamp:
- 2011-03-29T22:47:00Z (14 years ago)
- Branches:
- master
- Children:
- 6220254
- Parents:
- 4f50ea5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
r4f50ea5 r15bc063 454 454 { 455 455 struct twitter_data *td = ic->proto_data; 456 char *cmds, **cmd; 456 char *cmds, **cmd, *new = NULL; 457 guint64 in_reply_to = 0; 457 458 458 459 cmds = g_strdup( message ); … … 524 525 return; 525 526 } 527 else if( g_strcasecmp( cmd[0], "reply" ) == 0 && cmd[1] && cmd[2] ) 528 { 529 struct twitter_user_data *tud; 530 bee_user_t *bu = NULL; 531 guint64 id = 0; 532 533 if( ( bu = bee_user_by_handle( ic->bee, ic, cmd[1] ) ) && 534 ( tud = bu->data ) && tud->last_id ) 535 { 536 id = tud->last_id; 537 } 538 else if( ( id = g_ascii_strtoull( cmd[1], NULL, 10 ) ) && 539 ( id < TWITTER_LOG_LENGTH ) ) 540 { 541 bu = td->log[id].bu; 542 if( g_slist_find( ic->bee->users, bu ) ) 543 id = td->log[id].id; 544 else 545 bu = NULL; 546 } 547 if( !id || !bu ) 548 { 549 twitter_msg( ic, "User `%s' does not exist or didn't " 550 "post any statuses recently", cmd[1] ); 551 return; 552 } 553 message = new = g_strdup_printf( "@%s %s", bu->handle, 554 message + ( cmd[2] - cmd[0] ) ); 555 in_reply_to = id; 556 } 526 557 else if( g_strcasecmp( cmd[0], "post" ) == 0 ) 527 558 { … … 530 561 531 562 { 532 guint64 in_reply_to = 0; 533 char *s, *new = NULL; 563 char *s; 534 564 bee_user_t *bu; 535 565 536 566 if( !twitter_length_check( ic, message ) ) 537 567 { 568 g_free( new ); 538 569 g_free( cmds ); 539 570 return; … … 541 572 542 573 s = cmd[0] + strlen( cmd[0] ) - 1; 543 if( s > cmd[0] && ( *s == ':' || *s == ',' ) )574 if( !new && s > cmd[0] && ( *s == ':' || *s == ',' ) ) 544 575 { 545 576 *s = '\0';
Note: See TracChangeset
for help on using the changeset viewer.