Changeset 36562b0 for irc_channel.c
- Timestamp:
- 2010-06-07T00:44:45Z (14 years ago)
- Branches:
- master
- Children:
- 0d9d53e
- Parents:
- 92cb8c4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_channel.c
r92cb8c4 r36562b0 49 49 irc_channel_user_set_mode( ic, irc->root, IRC_CHANNEL_USER_OP ); 50 50 51 irc->channels = g_slist_ prepend( irc->channels, ic );51 irc->channels = g_slist_append( irc->channels, ic ); 52 52 53 53 set_add( &ic->set, "type", "control", set_eval_channel_type, ic ); … … 69 69 irc_channel_t *ic = l->data; 70 70 71 if( name[0] == ic->name[0] && nick_cmp( name + 1, ic->name + 1) == 0 )71 if( g_strcasecmp( name, ic->name ) == 0 ) 72 72 return ic; 73 73 } 74 74 75 75 return NULL; 76 } 77 78 irc_channel_t *irc_channel_get( irc_t *irc, char *id ) 79 { 80 irc_channel_t *ic, *ret = NULL; 81 GSList *l; 82 int nr; 83 84 if( sscanf( id, "%d", &nr ) == 1 && nr < 1000 ) 85 { 86 for( l = irc->channels; l; l = l->next ) 87 { 88 ic = l->data; 89 if( ( nr-- ) == 0 ) 90 return ic; 91 } 92 93 return NULL; 94 } 95 96 /* Exact match first: Partial match only sucks if there's a channel 97 #aa and #aabb */ 98 if( ( ret = irc_channel_by_name( irc, id ) ) ) 99 return ret; 100 101 for( l = irc->channels; l; l = l->next ) 102 { 103 ic = l->data; 104 105 if( strstr( ic->name, id ) ) 106 { 107 /* Make sure it's a unique match. */ 108 if( !ret ) 109 ret = ic; 110 else 111 return NULL; 112 } 113 } 114 115 return ret; 76 116 } 77 117
Note: See TracChangeset
for help on using the changeset viewer.