Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

//text sends message /text (then /// sends //, etc.)

  • Loading branch information...
commit d88f2427d1c39686e86e27510dfb2a3bc52ed884 1 parent 18f017c
ec429 authored
Showing with 42 additions and 34 deletions.
  1. +2 −0  input.c
  2. +35 −0 irc.c
  3. +3 −0  irc.h
  4. +0 −2  plans
  5. +2 −32 quirc.c
View
2  input.c
@@ -494,6 +494,8 @@ char * slash_dequote(char *inp)
int cmd_handle(char *inp, char **qmsg, fd_set *master, int *fdmax) // old state=3; return new state
{
char *cmd=inp+1;
+ if(*cmd=='/') //msg sends /msg
+ return(talk(cmd));
char *args=strchr(cmd, ' ');
if(args) *args++=0;
if(strcmp(cmd, "close")==0)
View
35 irc.c
@@ -1453,3 +1453,38 @@ int ctcp(char *msg, char *from, char *src, int b2, bool ha, bool notice, bool pr
}
return(0);
}
+
+int talk(char *iinput)
+{
+ if((bufs[cbuf].type==CHANNEL)||(bufs[cbuf].type==PRIVATE))
+ {
+ if(bufs[bufs[cbuf].server].handle)
+ {
+ if(LIVE(cbuf))
+ {
+ char pmsg[12+strlen(bufs[cbuf].bname)+strlen(iinput)];
+ sprintf(pmsg, "PRIVMSG %s :%s", bufs[cbuf].bname, iinput);
+ irc_tx(bufs[bufs[cbuf].server].handle, pmsg);
+ char *cnick=strdup(bufs[bufs[cbuf].server].nick);
+ crush(&cnick, maxnlen);
+ char *tag=mktag("<%s> ", cnick);
+ free(cnick);
+ add_to_buffer(cbuf, c_msg[0], iinput, tag);
+ free(tag);
+ }
+ else
+ {
+ add_to_buffer(cbuf, c_err, "Can't talk - tab is not live!", "");
+ }
+ }
+ else
+ {
+ add_to_buffer(cbuf, c_err, "Can't talk - tab is disconnected!", "");
+ }
+ }
+ else
+ {
+ add_to_buffer(cbuf, c_err, "Can't talk - view is not a channel!", "");
+ }
+ return(0);
+}
View
3  irc.h
@@ -71,6 +71,9 @@ char irc_to_lower(char c, cmap casemapping);
int irc_strcasecmp(char *c1, char *c2, cmap casemapping);
int irc_strncasecmp(char *c1, char *c2, int n, cmap casemapping);
+// Send an IRC PRIVMSG (ie. ordinary talking)
+int talk(char *iinput);
+
// Received-IRC message handlers
int irc_numeric(message pkt, int b);
int rx_ping(message pkt, int b);
View
2  plans
@@ -20,8 +20,6 @@ Improve the parsing of mirc-colour-codes (to fix things like \003124 which curre
/clear command.
-//text sends message /text (then /// sends //, etc).
-
Short commands (sufficient-prefix matching, like /cle).
Logging & Persistent backscroll.
View
34 quirc.c
@@ -406,43 +406,13 @@ int main(int argc, char *argv[])
if(*iinput=='/')
{
state=cmd_handle(iinput, &qmsg, &master, &fdmax);
- free(iinput);iinput=NULL;
}
else
{
- if((bufs[cbuf].type==CHANNEL)||(bufs[cbuf].type==PRIVATE))
- {
- if(bufs[bufs[cbuf].server].handle)
- {
- if(LIVE(cbuf))
- {
- char pmsg[12+strlen(bufs[cbuf].bname)+strlen(iinput)];
- sprintf(pmsg, "PRIVMSG %s :%s", bufs[cbuf].bname, iinput);
- irc_tx(bufs[bufs[cbuf].server].handle, pmsg);
- char *cnick=strdup(bufs[bufs[cbuf].server].nick);
- crush(&cnick, maxnlen);
- char *tag=mktag("<%s> ", cnick);
- free(cnick);
- add_to_buffer(cbuf, c_msg[0], iinput, tag);
- free(tag);
- }
- else
- {
- add_to_buffer(cbuf, c_err, "Can't talk - tab is not live!", "");
- }
- }
- else
- {
- add_to_buffer(cbuf, c_err, "Can't talk - tab is disconnected!", "");
- }
- }
- else
- {
- add_to_buffer(cbuf, c_err, "Can't talk - view is not a channel!", "");
- }
- free(iinput);iinput=NULL;
+ talk(iinput);
state=0;
}
+ free(iinput);iinput=NULL;
}
else
{
Please sign in to comment.
Something went wrong with that request. Please try again.