Changeset 83e92bf
- Timestamp:
- 2010-03-27T12:30:00Z (15 years ago)
- Branches:
- master
- Children:
- 9b69eb7
- Parents:
- b95932e
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.c
rb95932e r83e92bf 620 620 621 621 ic = irc_channel_new( irc, ROOT_CHAN ); 622 irc_channel_set_topic( ic, CONTROL_TOPIC );622 irc_channel_set_topic( ic, CONTROL_TOPIC, irc->root ); 623 623 irc_channel_add_user( ic, irc->user ); 624 624 -
irc.h
rb95932e r83e92bf 118 118 char *name; 119 119 char *topic; 120 char *topic_who; 121 time_t topic_time; 120 122 char mode[8]; 121 123 GSList *users; … … 145 147 irc_channel_t *irc_channel_new( irc_t *irc, const char *name ); 146 148 irc_channel_t *irc_channel_by_name( irc_t *irc, const char *name ); 149 int irc_channel_free( irc_channel_t *ic ); 147 150 int irc_channel_add_user( irc_channel_t *ic, irc_user_t *iu ); 148 151 int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu ); 149 int irc_channel_set_topic( irc_channel_t *ic, const char *topic );152 int irc_channel_set_topic( irc_channel_t *ic, const char *topic, const irc_user_t *who ); 150 153 151 154 /* irc_commands.c */ … … 160 163 void irc_send_part( irc_channel_t *ic, irc_user_t *iu, const char *reason ); 161 164 void irc_send_names( irc_channel_t *ic ); 162 void irc_send_topic( irc_channel_t *ic );165 void irc_send_topic( irc_channel_t *ic, gboolean topic_change ); 163 166 void irc_send_whois( irc_user_t *iu ); 164 167 -
irc_channel.c
rb95932e r83e92bf 109 109 } 110 110 111 int irc_channel_set_topic( irc_channel_t *ic, const char *topic )111 int irc_channel_set_topic( irc_channel_t *ic, const char *topic, const irc_user_t *iu ) 112 112 { 113 113 g_free( ic->topic ); 114 114 ic->topic = g_strdup( topic ); 115 115 116 g_free( ic->topic_who ); 117 if( iu ) 118 ic->topic_who = g_strdup_printf( "%s!%s@%s", iu->nick, iu->user, iu->host ); 119 else 120 ic->topic_who = NULL; 121 122 ic->topic_time = time( NULL ); 123 116 124 if( ic->flags & IRC_CHANNEL_JOINED ) 117 irc_send_topic( ic );125 irc_send_topic( ic, TRUE ); 118 126 119 127 return 1; -
irc_send.c
rb95932e r83e92bf 135 135 irc_write( irc, ":%s MODE %s +%s", irc->root->host, ic->name, ic->mode ); 136 136 irc_send_names( ic ); 137 irc_send_topic( ic );137 irc_send_topic( ic, FALSE ); 138 138 } 139 139 } … … 182 182 } 183 183 184 void irc_send_topic( irc_channel_t *ic ) 185 { 186 if( ic->topic ) 184 void irc_send_topic( irc_channel_t *ic, gboolean topic_change ) 185 { 186 if( topic_change && ic->topic_who ) 187 { 188 irc_write( ic->irc, ":%s TOPIC %s :%s", ic->topic_who, 189 ic->name, ic->topic && *ic->topic ? ic->topic : "" ); 190 } 191 else if( ic->topic ) 192 { 187 193 irc_send_num( ic->irc, 332, "%s :%s", ic->name, ic->topic ); 194 if( ic->topic_who ) 195 irc_send_num( ic->irc, 333, "%s %s %d", 196 ic->name, ic->topic_who, (int) ic->topic_time ); 197 } 188 198 else 189 199 irc_send_num( ic->irc, 331, "%s :No topic for this channel", ic->name );
Note: See TracChangeset
for help on using the changeset viewer.