- Timestamp:
- 2015-03-15T09:31:18Z (6 years ago)
- Children:
- ac6855b3
- Parents:
- c0e4c22
- git-author:
- dequis <dx@…> (05-03-15 10:31:24)
- git-committer:
- dequis <dx@…> (15-03-15 09:31:18)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_im.c
rc0e4c22 r830864d 609 609 } 610 610 611 static gboolean bee_irc_chat_placeholder_new(bee_t *bee, struct im_connection *ic, const char *handle, 612 const char *name, const char *topic) 613 { 614 irc_t *irc = bee->ui_data; 615 irc_channel_t *ircc; 616 char *full_name = irc_channel_name_gen(bee, name); 617 618 ircc = irc_channel_new(irc, full_name); 619 620 set_setstr(&ircc->set, "type", "chat"); 621 set_setstr(&ircc->set, "chat_type", "placeholder"); 622 set_setstr(&ircc->set, "account", ic->acc->tag); 623 set_setstr(&ircc->set, "room", (char *) handle); 624 625 irc_channel_set_topic(ircc, topic, NULL); 626 627 g_free(full_name); 628 629 return TRUE; 630 } 631 611 632 static gboolean bee_irc_chat_log(bee_t *bee, struct groupchat *c, const char *text) 612 633 { … … 701 722 static gboolean bee_irc_chat_name_hint(bee_t *bee, struct groupchat *c, const char *name) 702 723 { 703 irc_t *irc = bee->ui_data; 704 irc_channel_t *ic = c->ui_data, *oic; 705 char stripped[MAX_NICK_LENGTH + 1], *full_name; 706 707 if (ic == NULL) { 708 return FALSE; 709 } 710 711 /* Don't rename a channel if the user's in it already. */ 712 if (ic->flags & IRC_CHANNEL_JOINED) { 713 return FALSE; 714 } 715 716 strncpy(stripped, name, MAX_NICK_LENGTH); 717 stripped[MAX_NICK_LENGTH] = '\0'; 718 irc_channel_name_strip(stripped); 719 if (set_getbool(&bee->set, "lcnicks")) { 720 nick_lc(irc, stripped); 721 } 722 723 if (stripped[0] == '\0') { 724 return FALSE; 725 } 726 727 full_name = g_strdup_printf("#%s", stripped); 728 if ((oic = irc_channel_by_name(irc, full_name))) { 729 char *type, *chat_type; 730 731 type = set_getstr(&oic->set, "type"); 732 chat_type = set_getstr(&oic->set, "chat_type"); 733 734 if (type && chat_type && oic->data == FALSE && 735 strcmp(type, "chat") == 0 && 736 strcmp(chat_type, "groupchat") == 0) { 737 /* There's a channel with this name already, but it looks 738 like it's not in use yet. Most likely the IRC client 739 rejoined the channel after a reconnect. Remove it so 740 we can reuse its name. */ 741 irc_channel_free(oic); 742 } else { 743 g_free(full_name); 744 return FALSE; 745 } 746 } 747 748 g_free(ic->name); 749 ic->name = full_name; 750 751 return TRUE; 724 return irc_channel_name_hint(c->ui_data, name); 752 725 } 753 726 … … 877 850 static gboolean bee_irc_channel_chat_join(irc_channel_t *ic) 878 851 { 879 char *acc_s, *room ;852 char *acc_s, *room, *chat_type; 880 853 account_t *acc; 881 854 882 if (strcmp(set_getstr(&ic->set, "chat_type"), "room") != 0) { 855 chat_type = set_getstr(&ic->set, "chat_type"); 856 857 if (strcmp(chat_type, "room") != 0 && strcmp(chat_type, "placeholder") != 0) { 883 858 return TRUE; 884 859 } … … 1036 1011 struct irc_channel *ic = set->data; 1037 1012 1013 ic->flags &= ~(IRC_CHANNEL_TEMP | IRC_CHANNEL_KEEP_PLACEHOLDER); 1014 1038 1015 if (strcmp(value, "groupchat") == 0) { 1039 1016 ic->flags |= IRC_CHANNEL_TEMP; 1040 1017 } else if (strcmp(value, "room") == 0) { 1041 ic->flags &= ~IRC_CHANNEL_TEMP; 1018 // beep boop 1019 } else if (strcmp(value, "placeholder") == 0) { 1020 ic->flags |= IRC_CHANNEL_TEMP | IRC_CHANNEL_KEEP_PLACEHOLDER; 1042 1021 } else { 1043 1022 return NULL; … … 1123 1102 bee_irc_chat_new, 1124 1103 bee_irc_chat_free, 1104 bee_irc_chat_placeholder_new, 1125 1105 bee_irc_chat_log, 1126 1106 bee_irc_chat_msg,
Note: See TracChangeset
for help on using the changeset viewer.