src/protocols/irc/irc.c

changeset 7323
ed430996905d
parent 7156
127436d3f11a
child 7653
52c1a10f482e
equal deleted inserted replaced
7322:de15a9314c04 7323:ed430996905d
214 { 214 {
215 GaimConnection *gc = data; 215 GaimConnection *gc = data;
216 struct irc_conn *irc = gc->proto_data; 216 struct irc_conn *irc = gc->proto_data;
217 char hostname[256]; 217 char hostname[256];
218 char *buf; 218 char *buf;
219 const char *username;
219 GList *connections = gaim_connections_get_all(); 220 GList *connections = gaim_connections_get_all();
220 221
221 if (source < 0) 222 if (source < 0)
222 return; 223 return;
223 224
237 g_free(buf); 238 g_free(buf);
238 } 239 }
239 240
240 gethostname(hostname, sizeof(hostname)); 241 gethostname(hostname, sizeof(hostname));
241 hostname[sizeof(hostname) - 1] = '\0'; 242 hostname[sizeof(hostname) - 1] = '\0';
242 buf = irc_format(irc, "vvvv:", "USER", g_get_user_name(), hostname, irc->server, 243 username = gaim_account_get_string(irc->account, "username", "");
244 buf = irc_format(irc, "vvvv:", "USER", strlen(username) ? username : g_get_user_name(), hostname, irc->server,
243 gc->account->alias && *gc->account->alias ? gc->account->alias : IRC_DEFAULT_ALIAS); 245 gc->account->alias && *gc->account->alias ? gc->account->alias : IRC_DEFAULT_ALIAS);
244 if (irc_send(irc, buf) < 0) { 246 if (irc_send(irc, buf) < 0) {
245 gaim_connection_error(gc, "Error registering with server"); 247 gaim_connection_error(gc, "Error registering with server");
246 return; 248 return;
247 } 249 }
552 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 554 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
553 555
554 option = gaim_account_option_string_new(_("Encoding"), "encoding", IRC_DEFAULT_CHARSET); 556 option = gaim_account_option_string_new(_("Encoding"), "encoding", IRC_DEFAULT_CHARSET);
555 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 557 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
556 558
559 option = gaim_account_option_string_new(_("Username"), "username", "");
560 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
561
557 _irc_plugin = plugin; 562 _irc_plugin = plugin;
558 } 563 }
559 564
560 GAIM_INIT_PLUGIN(irc, _init_plugin, info); 565 GAIM_INIT_PLUGIN(irc, _init_plugin, info);

mercurial