diff options
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | hexsparkles.c | 46 | ||||
| -rw-r--r-- | sparkles.c | 46 | 
3 files changed, 94 insertions, 4 deletions
| @@ -567,6 +567,7 @@ If you don't have any flags you can use "." in place of any flags.  The response can use $1, $2, $3 etc to refer to the text event parameters, or $n or $c for your nick or the channel name. $$ comes out as a $.  "DeleteEvent" is accepted as a response and it will delete the event. +"NoHighlight" when paired with "Channel Msg Hilight" or "Channel Action Hilight" will replace the message with a non-highlighted version.  ======= @@ -590,6 +591,11 @@ Shakespeare insult  Saves preferences to a .ini file +### recentclosed +`/spark recentclosed` + +Lists the three most recent tabs you've closed +  ### randnum  `/spark randnum Limit` diff --git a/hexsparkles.c b/hexsparkles.c index eec168a..5e0d2e1 100644 --- a/hexsparkles.c +++ b/hexsparkles.c @@ -21,7 +21,7 @@  #define PNAME "Nova's Sparkles"  #define PDESC "Mix of annoying/powerful/useful stuff" -#define PVERSION "1.1" +#define PVERSION "1.1.1"  #define USE_SPARKLES_USER 0  #define ENABLE_NSFW_CONTENT 1  #define PESTERCHUM_NETWORK "Pesterchum" @@ -102,6 +102,7 @@ static const char SparkEncryptPrefix[] = {2,0x16,0x1f,0x16,0x16,0x0f,2,3,'0','0'  static char SparklesUser[64];  static char *Rainbow[]={"04","08","09","12","13"}; +static char ClosedList[3][64] = {"","",""};  static void INIConfigHandler(const char *Group, const char *Item, const char *Value);  static int ParseINI(FILE *File, void (*Handler)(const char *Group, const char *Item, const char *Value)); @@ -122,7 +123,7 @@ struct OnEventInfo {    hexchat_hook *Hook;  }; -#define ONEVENTS_SIZE 30 +#define ONEVENTS_SIZE 100  struct OnEventInfo *OnEventInfos[ONEVENTS_SIZE];  enum ConfigTypes { @@ -391,6 +392,13 @@ static int on_event_cb(char *word[], void *userdata) {    if(!strcasecmp(Buffer, "DeleteEvent"))      return HEXCHAT_EAT_ALL; +  if(!strcasecmp(Buffer, "NoHilight") || !strcasecmp(Buffer, "NoHighlight")) { +    if(!strcasecmp(Info->EventName, "Channel Msg Hilight")) +      hexchat_emit_print(ph, "Channel Message", word[1], word[2], word[3], word[4], NULL); +    else if(!strcasecmp(Info->EventName, "Channel Action Hilight")) +      hexchat_emit_print(ph, "Channel Action", word[1], word[2], word[3], word[4], NULL); +    return HEXCHAT_EAT_ALL; +  }    hexchat_command(ph, Buffer);    if(Info->Flags & OEF_TEMPORARY) { @@ -2011,6 +2019,27 @@ static int TrapActionPost_cb(char *word[], char *word_eol[], void *userdata) {      MeHook = hexchat_hook_command(ph, "me", HEXCHAT_PRI_NORM, TrapActionPost_cb, NULL, 0);      return HEXCHAT_EAT_ALL;    } +  else if(CmdStackPtr != NULL) { +    char Buffer[512]; +    strcpy(Buffer, CmdStackPtr); +    char *A = strstr(Buffer, "||"); +    if(A) { +      *A = 0; +      CmdStackPtr=A+2; +      char *OldPtr = CmdStackPtr; +      hexchat_commandf(ph, "%s %s", Buffer, word_eol[1]); +      if(OldPtr == CmdStackPtr) { +        hexchat_printf(ph, "\"%s\" in cmdstack did not result in /say", Buffer); +        CmdStackPtr = NULL; +      } +      return HEXCHAT_EAT_ALL; +    } +    else { +      CmdStackPtr=NULL; +      hexchat_commandf(ph, "%s %s", Buffer, word_eol[1]); +      return HEXCHAT_EAT_ALL; +    } +  }    if(strcasecmp(MeHookCommand,"")) {      if(MeHook != NULL)        hexchat_unhook(ph, MeHook); @@ -2025,6 +2054,13 @@ static int TrapActionPost_cb(char *word[], char *word_eol[], void *userdata) {    return HEXCHAT_EAT_NONE;  } +static int Close_cb(char *word[], void *userdata) { +  strcpy(ClosedList[2], ClosedList[1]); +  strcpy(ClosedList[1], ClosedList[0]); +  strlcpy(ClosedList[0], hexchat_get_info(ph, "channel"), 64); +  return HEXCHAT_EAT_NONE; +} +  static int TrapNormalPost_cb(char *word[], char *word_eol[], void *userdata) {    if(UseOneSayHook) {      if(SayHook != NULL) @@ -2620,6 +2656,11 @@ static int Spark_cb(char *word[], char *word_eol[], void *userdata) {       hexchat_commandf(ph, "say %s", Buffer);     } +   if(!strcasecmp(word[2],"recentclosed")) { +     WasValid = 1; +     hexchat_printf(ph, "Recently closed tabs: %s %s %s", ClosedList[0], ClosedList[1], ClosedList[2]); +   } +     if(!strcasecmp(word[2],"grabtopic")) {       WasValid = 1;       GrabbingTopic = 1; @@ -3824,6 +3865,7 @@ int hexchat_plugin_init(hexchat_plugin *plugin_handle,     #endif     SayHook = hexchat_hook_command(ph, "", HEXCHAT_PRI_NORM, TrapNormalPost_cb, NULL, 0);     MeHook = hexchat_hook_command(ph, "me", HEXCHAT_PRI_NORM, TrapActionPost_cb, NULL, 0); +   hexchat_hook_print(ph, "Close Context", HEXCHAT_PRI_NORM, Close_cb, NULL);     hexchat_hook_print(ph, "Nick Clash",             HEXCHAT_PRI_NORM, nickclash_cb, NULL);     hexchat_hook_print(ph, "Channel Message",       HEXCHAT_PRI_NORM, channelmessage_cb, (int)0); @@ -21,7 +21,7 @@  #define PNAME "Nova's Sparkles"  #define PDESC "Mix of annoying/powerful/useful stuff" -#define PVERSION "1.1" +#define PVERSION "1.1.1"  #define USE_SPARKLES_USER 0  #define ENABLE_NSFW_CONTENT 1  #define PESTERCHUM_NETWORK "Pesterchum" @@ -102,6 +102,7 @@ static const char SparkEncryptPrefix[] = {2,0x16,0x1f,0x16,0x16,0x0f,2,3,'0','0'  static char SparklesUser[64];  static char *Rainbow[]={"04","08","09","12","13"}; +static char ClosedList[3][64] = {"","",""};  static void INIConfigHandler(const char *Group, const char *Item, const char *Value);  static int ParseINI(FILE *File, void (*Handler)(const char *Group, const char *Item, const char *Value)); @@ -122,7 +123,7 @@ struct OnEventInfo {    xchat_hook *Hook;  }; -#define ONEVENTS_SIZE 30 +#define ONEVENTS_SIZE 100  struct OnEventInfo *OnEventInfos[ONEVENTS_SIZE];  enum ConfigTypes { @@ -391,6 +392,13 @@ static int on_event_cb(char *word[], void *userdata) {    if(!strcasecmp(Buffer, "DeleteEvent"))      return XCHAT_EAT_ALL; +  if(!strcasecmp(Buffer, "NoHilight") || !strcasecmp(Buffer, "NoHighlight")) { +    if(!strcasecmp(Info->EventName, "Channel Msg Hilight")) +      xchat_emit_print(ph, "Channel Message", word[1], word[2], word[3], word[4], NULL); +    else if(!strcasecmp(Info->EventName, "Channel Action Hilight")) +      xchat_emit_print(ph, "Channel Action", word[1], word[2], word[3], word[4], NULL); +    return XCHAT_EAT_ALL; +  }    xchat_command(ph, Buffer);    if(Info->Flags & OEF_TEMPORARY) { @@ -2011,6 +2019,27 @@ static int TrapActionPost_cb(char *word[], char *word_eol[], void *userdata) {      MeHook = xchat_hook_command(ph, "me", XCHAT_PRI_NORM, TrapActionPost_cb, NULL, 0);      return XCHAT_EAT_ALL;    } +  else if(CmdStackPtr != NULL) { +    char Buffer[512]; +    strcpy(Buffer, CmdStackPtr); +    char *A = strstr(Buffer, "||"); +    if(A) { +      *A = 0; +      CmdStackPtr=A+2; +      char *OldPtr = CmdStackPtr; +      xchat_commandf(ph, "%s %s", Buffer, word_eol[1]); +      if(OldPtr == CmdStackPtr) { +        xchat_printf(ph, "\"%s\" in cmdstack did not result in /say", Buffer); +        CmdStackPtr = NULL; +      } +      return XCHAT_EAT_ALL; +    } +    else { +      CmdStackPtr=NULL; +      xchat_commandf(ph, "%s %s", Buffer, word_eol[1]); +      return XCHAT_EAT_ALL; +    } +  }    if(strcasecmp(MeHookCommand,"")) {      if(MeHook != NULL)        xchat_unhook(ph, MeHook); @@ -2025,6 +2054,13 @@ static int TrapActionPost_cb(char *word[], char *word_eol[], void *userdata) {    return XCHAT_EAT_NONE;  } +static int Close_cb(char *word[], void *userdata) { +  strcpy(ClosedList[2], ClosedList[1]); +  strcpy(ClosedList[1], ClosedList[0]); +  strlcpy(ClosedList[0], xchat_get_info(ph, "channel"), 64); +  return XCHAT_EAT_NONE; +} +  static int TrapNormalPost_cb(char *word[], char *word_eol[], void *userdata) {    if(UseOneSayHook) {      if(SayHook != NULL) @@ -2620,6 +2656,11 @@ static int Spark_cb(char *word[], char *word_eol[], void *userdata) {       xchat_commandf(ph, "say %s", Buffer);     } +   if(!strcasecmp(word[2],"recentclosed")) { +     WasValid = 1; +     xchat_printf(ph, "Recently closed tabs: %s %s %s", ClosedList[0], ClosedList[1], ClosedList[2]); +   } +     if(!strcasecmp(word[2],"grabtopic")) {       WasValid = 1;       GrabbingTopic = 1; @@ -3824,6 +3865,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle,     #endif     SayHook = xchat_hook_command(ph, "", XCHAT_PRI_NORM, TrapNormalPost_cb, NULL, 0);     MeHook = xchat_hook_command(ph, "me", XCHAT_PRI_NORM, TrapActionPost_cb, NULL, 0); +   xchat_hook_print(ph, "Close Context", XCHAT_PRI_NORM, Close_cb, NULL);     xchat_hook_print(ph, "Nick Clash",             XCHAT_PRI_NORM, nickclash_cb, NULL);     xchat_hook_print(ph, "Channel Message",       XCHAT_PRI_NORM, channelmessage_cb, (int)0); | 
