Changeset 3fbce97 for protocols/nogaim.c
- Timestamp:
- 2016-09-24T20:14:34Z (8 years ago)
- Children:
- ba52ac5
- Parents:
- 63cad66 (diff), 82cb190 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.c
r63cad66 r3fbce97 90 90 91 91 GList *protocols = NULL; 92 GList *disabled_protocols = NULL; 92 93 93 94 void register_protocol(struct prpl *p) … … 103 104 104 105 if (refused) { 105 log_message(LOGLVL_WARNING, "Protocol %s disabled\n", p->name);106 disabled_protocols = g_list_append(disabled_protocols, p); 106 107 } else { 107 108 protocols = g_list_append(protocols, p); … … 109 110 } 110 111 112 static int proto_name_cmp(const void *proto_, const void *name) 113 { 114 const struct prpl *proto = proto_; 115 return g_strcasecmp(proto->name, name); 116 } 117 111 118 struct prpl *find_protocol(const char *name) 112 119 { 113 GList *gl; 114 115 for (gl = protocols; gl; gl = gl->next) { 116 struct prpl *proto = gl->data; 117 118 if (g_strcasecmp(proto->name, name) == 0) { 119 return proto; 120 } 121 } 122 123 return NULL; 120 GList *gl = g_list_find_custom(protocols, name, proto_name_cmp); 121 return gl ? gl->data: NULL; 122 } 123 124 gboolean is_protocol_disabled(const char *name) 125 { 126 return g_list_find_custom(disabled_protocols, name, proto_name_cmp) != NULL; 124 127 } 125 128 … … 209 212 account_t *a; 210 213 214 if (!ic->bee->ui->log) { 215 return; 216 } 217 211 218 va_start(params, format); 212 219 text = g_strdup_vprintf(format, params); … … 227 234 /* If we found one, include the screenname in the message. */ 228 235 if (a) { 229 /* FIXME(wilmer): ui_log callback or so */ 230 irc_rootmsg(ic->bee->ui_data, "%s - %s", ic->acc->tag, text); 236 ic->bee->ui->log(ic->bee, ic->acc->tag, text); 231 237 } else { 232 i rc_rootmsg(ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text);238 ic->bee->ui->log(ic->bee, ic->acc->prpl->name, text); 233 239 } 234 240 … … 662 668 GList *m = ic->acc->prpl->away_states(ic); 663 669 msg = ic->acc->flags & ACC_FLAG_AWAY_MESSAGE ? away : NULL; 664 away = imc_away_state_find(m, away, &msg) ? : m->data; 670 away = imc_away_state_find(m, away, &msg) ? : 671 (imc_away_state_find(m, "away", &msg) ? : m->data); 665 672 } else if (ic->acc->flags & ACC_FLAG_STATUS_MESSAGE) { 666 673 away = NULL; … … 781 788 } 782 789 790 /* Deprecated: using this function resulted in merging several handles accidentally 791 * Also the irc layer handles this decently nowadays */ 783 792 void imcb_clean_handle(struct im_connection *ic, char *handle) 784 793 { 785 /* Accepts a handle and does whatever is necessary to make it 786 BitlBee-friendly. Currently this means removing everything 787 outside 33-127 (ASCII printable excl spaces), @ (only one 788 is allowed) and ! and : */ 789 char out[strlen(handle) + 1]; 790 int s, d; 791 792 s = d = 0; 793 while (handle[s]) { 794 if (handle[s] > ' ' && handle[s] != '!' && handle[s] != ':' && 795 (handle[s] & 0x80) == 0) { 796 if (handle[s] == '@') { 797 /* See if we got an @ already? */ 798 out[d] = 0; 799 if (strchr(out, '@')) { 800 continue; 801 } 802 } 803 804 out[d++] = handle[s]; 805 } 806 s++; 807 } 808 out[d] = handle[s]; 809 810 strcpy(handle, out); 811 } 794 }
Note: See TracChangeset
for help on using the changeset viewer.