Changeset 74f1cde


Ignore:
Timestamp:
2010-03-27T18:05:38Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
410bf6d
Parents:
280c56a
Message:

irc_usermsg() works a little bit again. Have to figure out how and where
to restore multiline support though.

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    r280c56a r74f1cde  
    624624                        irc_channel_add_user( ic, irc->user );
    625625                       
     626                        irc->last_root_cmd = g_strdup( ROOT_CHAN );
     627                       
    626628                        return 1;
    627629                }
  • irc.h

    r280c56a r74f1cde  
    6565        struct irc_user *root;
    6666        struct irc_user *user;
     67       
     68        char *last_root_cmd;
    6769
    6870        char *password; /* HACK: Used to save the user's password, but before
     
    8688        struct bee *b;
    8789} irc_t;
     90
     91typedef enum
     92{
     93        IRC_USER_PRIVATE = 1,
     94} irc_user_flags_t;
    8895
    8996typedef struct irc_user
     
    99106        char *key;
    100107       
    101         char is_private;
     108        irc_user_flags_t flags;
    102109       
    103110        char *sendbuf;
    104111        int sendbuf_len;
    105112        guint sendbuf_timer;
    106         int sendbuf_flags;
     113        //int sendbuf_flags;
    107114       
    108115        //struct user *b;
     
    190197void irc_send_whois( irc_user_t *iu );
    191198void irc_send_who( irc_t *irc, GSList *l, const char *channel );
     199void irc_send_msg( irc_user_t *iu, const char *type, const char *dst, const char *msg );
    192200
    193201/* irc_user.c */
  • irc_channel.c

    r280c56a r74f1cde  
    139139static gboolean control_channel_privmsg( irc_channel_t *ic, const char *msg )
    140140{
     141        g_free( ic->irc->last_root_cmd );
     142        ic->irc->last_root_cmd = g_strdup( ic->name );
     143       
    141144        root_command_string( ic->irc, msg );
    142145       
  • irc_send.c

    r280c56a r74f1cde  
    109109}
    110110
    111 /* FIXME/REPLACEME */
    112111void irc_usermsg( irc_t *irc, char *format, ... )
    113112{
     113        irc_channel_t *ic;
     114        irc_user_t *iu;
    114115        char text[1024];
    115116        va_list params;
    116         //irc_user_t *iu;
    117117       
    118118        va_start( params, format );
     
    120120        va_end( params );
    121121       
    122         fprintf( stderr, "%s\n", text );
     122        if( irc->last_root_cmd &&
     123            irc_channel_name_ok( irc->last_root_cmd ) &&
     124            ( ic = irc_channel_by_name( irc, irc->last_root_cmd ) ) &&
     125            ic->flags & IRC_CHANNEL_JOINED )
     126                irc_send_msg( irc->root, "PRIVMSG", irc->last_root_cmd, text );
     127        else if( irc->last_root_cmd &&
     128                 ( iu = irc_user_by_name( irc, irc->last_root_cmd ) ) &&
     129                 iu->f == &irc_user_root_funcs )
     130                irc_send_msg( iu, "PRIVMSG", irc->user->nick, text );
     131        else
     132        {
     133                g_free( irc->last_root_cmd );
     134                irc->last_root_cmd = NULL;
     135               
     136                irc_send_msg( irc->root, "PRIVMSG", irc->user->nick, text );
     137        }
    123138       
    124139        /*return( irc_msgfrom( irc, u->nick, text ) );*/
  • irc_user.c

    r280c56a r74f1cde  
    3434        iu->user = iu->host = iu->fullname = iu->nick;
    3535       
    36         iu->is_private = set_getbool( &irc->b->set, "private" );
     36        iu->flags = set_getbool( &irc->b->set, "private" ) ? IRC_USER_PRIVATE : 0;
    3737       
    3838        iu->key = g_strdup( nick );
     
    117117static gboolean root_privmsg( irc_user_t *iu, const char *msg )
    118118{
     119        g_free( iu->irc->last_root_cmd );
     120        iu->irc->last_root_cmd = g_strdup( iu->nick );
     121       
    119122        root_command_string( iu->irc, msg );
    120123       
Note: See TracChangeset for help on using the changeset viewer.