/[weechat]/weechat/src/common/command.c
ViewVC logotype

Diff of /weechat/src/common/command.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.54 by flashcode, Thu May 5 16:26:34 2005 UTC revision 1.55 by flashcode, Sun May 8 12:19:47 2005 UTC
# Line 657  void Line 657  void
657  user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)  user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
658  {  {
659      t_irc_nick *ptr_nick;      t_irc_nick *ptr_nick;
660        int plugin_args_length;
661        char *plugin_args;
662            
663      if ((!command) || (!command[0]) || (command[0] == '\r') || (command[0] == '\n'))      if ((!command) || (!command[0]) || (command[0] == '\r') || (command[0] == '\n'))
664          return;          return;
# Line 682  user_command (t_irc_server *server, t_gu Line 684  user_command (t_irc_server *server, t_gu
684              else              else
685                  server_sendf (server, "PRIVMSG %s :%s\r\n",                  server_sendf (server, "PRIVMSG %s :%s\r\n",
686                                CHANNEL(buffer)->name, command);                                CHANNEL(buffer)->name, command);
687                
688              if (CHANNEL(buffer)->type == CHAT_PRIVATE)              if (CHANNEL(buffer)->type == CHAT_PRIVATE)
689              {              {
690                  gui_printf_type_color (CHANNEL(buffer)->buffer,                  gui_printf_type_color (CHANNEL(buffer)->buffer,
# Line 717  user_command (t_irc_server *server, t_gu Line 719  user_command (t_irc_server *server, t_gu
719                                  WEECHAT_ERROR);                                  WEECHAT_ERROR);
720                  }                  }
721              }              }
722                
723                /* sending a copy of the message as PRIVMSG to plugins because irc server doesn't */                              
724                plugin_args_length = strlen ("localhost PRIVMSG  :") +
725                    strlen (CHANNEL(buffer)->name) + strlen(command) + 16;
726                plugin_args = (char *) malloc (plugin_args_length * sizeof (*plugin_args));
727                
728                if (plugin_args)
729                {
730                    snprintf (plugin_args, plugin_args_length,
731                              "localhost PRIVMSG %s :%s",
732                              CHANNEL(buffer)->name, command);
733                    plugin_event_msg ("privmsg", server->name, plugin_args);
734                    free (plugin_args);
735                }
736                else
737                {
738                    irc_display_prefix (server->buffer, PREFIX_ERROR);
739                    gui_printf (server->buffer,
740                                _("%s unable to call handler for message (not enough memory)\n"),
741                                WEECHAT_ERROR);
742                }
743          }          }
744          else          else
745          {          {

Legend:
Removed from v.1.54  
changed lines
  Added in v.1.55

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26