comparison src/protocols/irc/irc.c @ 7323:443fc7d6fbff

[gaim-migrate @ 7909] The username reported to the IRC server can now be set in the account options for an IRC account. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Fri, 24 Oct 2003 15:37:17 +0000
parents bb484e976aa8
children b34655144117
comparison
equal deleted inserted replaced
7322:ab828b8c3f22 7323:443fc7d6fbff
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);