mTwitch.iSupport.mrc

By SReject on Aug 27, 2015

version: 000.0000.0001

Moved to GitHub

I've moved this project to github in hopes of alleviating some of the headaches caused by maintaining 5+ pages for what is essentially the same project. I also hope the move will motivate others to get involved and contribute to the codebase

About

This module is depreciated and will eventually be incorporated into mTwitch.Core.mrc

This is an mTwitch module that injects the ISupport(005) numeric into twitch chat servers to allow mIRC better integration with the server. If not altered by other modules the preset value is NETWORK=twitch.tv PREFIX=(qoahv)~@&%+ CASEMAPPING=ascii. These three parameters cannot be overridden by modules.

Expanding

When an ISupport token is to be injected the on SIGNAL event mTwitch.iSupport is raised, from within this even a script can call /mTwitch.iSupportSet <name> [value] to add to the token.

Multiple declarations for the same key will only accept the first value given; all others for the key will be ignored.

Plans

Eventually I hope to make this able to handle multiple declarations for the same parameters, with switches that determine how conflicts are handled(append, override, error out, etc)

Code

on $*:PARSELINE:in:/^\x3A(?:[^\.!@]+\.)?(?:tmi|irc)\.twitch\.tv 004 /i:{
  if (!$mTwitch.isServer || $mTwitch.isServer().isGroup) { return }
  var %hash = mTwitch.iSupportSet $+ $cid, %x = 0, %e, %out, %key, %val, %tok, %pre = :tmi.twitch.tv 005 $me, %post = :are supported on this server
  set -u0 $+(%, %hash) $true
  hadd -m %hash NETWORK twitch.tv
  hadd %hash PREFIX (qoahv)~@&%+
  hadd %hash CASEMAPPING ascii
  .signal -n mTwitch.iSupportSet
  unset -u0 $+(%, %hash)
  %e = $hget(%hash, 0).item
  while (%x < %e) {
    inc %x
    %key = $hget(%hash, %x).item
    %val = $hget(%hash, %key)
    if (%val) {
      %tok = %key $+ = $+ %val
    }
    else {
      %tok = %key
    }
    if ($calc($len(%pre %post) + $len(%out) + 2 + $len(%tok)) > 510) {
      .parseline -iqptu0n %pre $addtok(%out, %tok, 32) %post
      %out = $null
    }
    else {
      %out = $addtok(%out, %tok, 32)
    }
  }
  if (%out) {
    .parseline -iqptu0n %pre %out %post
  }
  if ($hget(%hash)) hfree %hash
}
alias mTwitch.iSupportSet {
  if ($isid) return
  if ($0 < 1) return
  if (!$($+(%, mTwitch.iSupportSet, $cid), 2)) return
  if (!$mTwitch.isServer || $mTwitch.isServer().isGroup) return
  if ($len($hget(mTwitch.iSupportSet $+ $cid, $1))) {
    return
  }
  else {
    hadd -m mTwitch.iSupportSet $+ $cid $1 $iif($2, $2, $false)
  }
}
alias mTwitch.has.iSupport return 0000.0000.0001

Comments

Sign in to comment.
SReject   -  Oct 23, 2015

Set module as depreciated; will be added to mTwitch.Core.mrc

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.