Changeset 0b5cc72
- Timestamp:
- 2010-04-05T00:39:04Z (15 years ago)
- Branches:
- master
- Children:
- 57c96f7
- Parents:
- 1d39159
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.h
r1d39159 r0b5cc72 179 179 int irc_channel_add_user( irc_channel_t *ic, irc_user_t *iu ); 180 180 int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu ); 181 gboolean irc_channel_has_user( irc_channel_t *ic, irc_user_t *iu ); 181 182 int irc_channel_set_topic( irc_channel_t *ic, const char *topic, const irc_user_t *who ); 182 183 gboolean irc_channel_name_ok( const char *name ); … … 198 199 void irc_send_msg( irc_user_t *iu, const char *type, const char *dst, const char *msg, const char *prefix ); 199 200 void irc_send_msg_raw( irc_user_t *iu, const char *type, const char *dst, const char *msg ); 201 void irc_send_nick( irc_user_t *iu, const char *new ); 200 202 201 203 /* irc_user.c */ … … 203 205 int irc_user_free( irc_t *irc, const char *nick ); 204 206 irc_user_t *irc_user_by_name( irc_t *irc, const char *nick ); 205 int irc_user_ rename( irc_t *irc, const char *old, const char *new );207 int irc_user_set_nick( irc_t *irc, const char *old, const char *new ); 206 208 gint irc_user_cmp( gconstpointer a_, gconstpointer b_ ); 207 209 -
irc_channel.c
r1d39159 r0b5cc72 82 82 int irc_channel_add_user( irc_channel_t *ic, irc_user_t *iu ) 83 83 { 84 if( g_slist_find( ic->users, iu ) != NULL)84 if( !irc_channel_has_user( ic, iu ) ) 85 85 return 0; 86 86 … … 98 98 int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu ) 99 99 { 100 if( g_slist_find( ic->users, iu ) == NULL)100 if( !irc_channel_has_user( ic, iu ) ) 101 101 return 0; 102 102 … … 110 110 111 111 return 1; 112 } 113 114 /* Currently a fairly stupid one-liner but I fear it's going to get worse. :-) */ 115 gboolean irc_channel_has_user( irc_channel_t *ic, irc_user_t *iu ) 116 { 117 return g_slist_find( ic->users, iu ) != NULL; 112 118 } 113 119 -
irc_send.c
r1d39159 r0b5cc72 311 311 iu->nick, iu->user, iu->host, type, dst, msg ); 312 312 } 313 314 void irc_send_nick( irc_user_t *iu, const char *new ) 315 { 316 irc_write( iu->irc, ":%s!%s@%s NICK %s", 317 iu->nick, iu->user, iu->host, new ); 318 } -
irc_user.c
r1d39159 r0b5cc72 83 83 } 84 84 85 int irc_user_ rename( irc_t *irc, const char *old, const char *new )85 int irc_user_set_nick( irc_t *irc, const char *old, const char *new ) 86 86 { 87 87 irc_user_t *iu = irc_user_by_name( irc, old ); 88 88 char key[strlen(new)+1]; 89 GSList *cl; 89 90 90 91 strcpy( key, new ); 91 92 if( iu == NULL || !nick_lc( key ) || irc_user_by_name( irc, new ) ) 92 93 return 0; 94 95 for( cl = irc->channels; cl; cl = cl->next ) 96 { 97 irc_channel_t *ic = cl->data; 98 99 /* Send a NICK update if we're renaming our user, or someone 100 who's in the same channel like our user. */ 101 if( iu == irc->user || 102 ( irc_channel_has_user( ic, irc->user ) && 103 irc_channel_has_user( ic, iu ) ) ) 104 { 105 irc_send_nick( iu, new ); 106 break; 107 } 108 } 93 109 94 110 irc->users = g_slist_remove( irc->users, iu );
Note: See TracChangeset
for help on using the changeset viewer.