Jump to content

IRC UDF - Updated Version of Chips' IRC UDF - Release: V1.22 - 09/06/2016 - Technical Writer Needed!


Recommended Posts

Posted

You should learn more about using #include

In your case you should use:

#include "IRCConstants.au3"

instead:

#include <IRCConstants.au3>

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 7/22/2016 at 7:07 AM, mLipok said:

Here is little refactored function:
 

Func _IRCChannelInvite($_vIRC, $_sUser, $_sChannel)
    Select ;Parameter Checking, Trust No One
        Case $_vIRC = ""
            Return SetError(1, 1, 0)
        Case $_vIRC = -1
            Return SetError(1, 2, 0)
        Case $_sUser = ""
            Return SetError(2, 1, 0)
        Case StringInStr($_sUser, " ")
            Return SetError(2, 2, 0)
        Case $_sChannel = ""
            Return SetError(3, 1, 0)
        Case Not $_sChannel = ""
            Switch AscW(StringLeft($_sChannel, 1))
                Case Not 33 And Not 35 And Not 38 And Not 43
                    Return SetError(3, 2, 0)
            EndSwitch
        Case StringInStr($_sChannel, " ")
            Return SetError(3, 2, 0)
    EndSelect
    
    TCPSend($_vIRC, "INVITE " & $_sUser & " " & $_sChannel & @CRLF)
    If @error Then Return SetError(4, @error & @extended, 0)

    Return 1
EndFunc   ;==>_IRCChannelInvite

Func _IRCChannelJoin($_vIRC, $_sChannels, $_sKeys = "")
    Select ;Parameter Checking, Trust No One
        Case $_vIRC = ""
            Return SetError(1, 1, 0)
        Case $_vIRC = -1
            Return SetError(1, 2, 0)
        Case $_sChannels = ""
            Return SetError(2, 1, 0)
        Case StringInStr($_sChannels, " ")
            Return SetError(2, 2, 0)
    EndSelect

    If Not $_sKeys = "" Then $_sKeys = " " & $_sKeys
    TCPSend($_vIRC, "JOIN " & $_sChannels & $_sKeys & @CRLF)
    If @error Then Return SetError(3, @error & @extended, 0)
    
    Return 1
EndFunc   ;==>_IRCChannelJoin

Try to refactor the other ones.

 

 


Why you are using @error & @extended ?

If @error Then Return SetError(3, @error & @extended, 0)

This is strange to me.

This is strange also because TCPSend not setting @extended (according to HelpFile).

 

Expand  

I've been using both to try to future proof anyone having errors with my functions. I originally had tried @error & " - " & @extended but SetError strips out non-numerals. Will add code improvements by tomorrow (Sunday EST time)

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted
  On 7/22/2016 at 7:17 AM, mLipok said:

You should learn more about using #include

In your case you should use:

#include "IRCConstants.au3"

instead:

#include <IRCConstants.au3>

 

Expand  

You'll have to forgive the double reply, the mobile AutoIt forums aren't as friendly as I'd like. Anyway, I originally had it that way but tried to future proof it towards inclusion into AutoIt. Hence, the install instructions on the GitHub.

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted
  On 7/23/2016 at 6:09 AM, TheDcoder said:

Ah, yes, @error and @extended can only be numbers, something which I recently learned :P.

Expand  

Help states this

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

@mLipok

Current UDF function returns are based off

I might revert them as they'd give a slight performance improvement by returning the script from the function a little earlier.

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted

@Mat answer is 3,5 year old.
I'm curious what he think now about this old answer, and about my statement:


  On 7/25/2016 at 10:21 PM, rcmaehl said:

hey'd give a slight performance improvement by returning the script from the function a little earlier.

Expand  

This is true.
But this is also easier to understand the code. You do not must go throught entire function code to see whats happend next.
Also debuging is much easier as you do not must to check if any other function line not changing @error @extended 

mLipok

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Looking for feedback

Survey: What data would you like to see returned when a function is successful?

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted
  On 8/23/2016 at 9:05 PM, rcmaehl said:

Survey: What data would you like to see returned when a function is successful?

Expand  

When I visited that page:

  Quote

Welcome to: poll.me

This Web page is parked for FREE, courtesy of GoDaddy.com.
Expand  

 

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Posted
  On 8/24/2016 at 4:08 AM, TheDcoder said:

When I visited that page:

 

Expand  

WHOOPS. It only copied half the URL. Fixed

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted (edited)
  On 8/26/2016 at 3:26 PM, TheDcoder said:

Well... All 3 votes for " The number of bytes sent" :P

Expand  

I'm actually kinda relieved, It's the easiest to implement, but I'll be leaving the poll up for another week or two.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted (edited)
  On 8/26/2016 at 3:30 PM, TheDcoder said:

The hardest would be the "next" packet I guess?

Expand  

Yep, slightly more difficult because of having to deal with adding more error checking.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted (edited)

Will be removing the poll on the 7th. Current results are 4 for Number of bytes sent, zilch everything else. I've drafted an update version of this UDFs and put it on a separate branch on github. If it's still the leader on the 7th I'll merge the branch.

 

Also upcoming is proper message length limitations (360 characters) after setting the maximum length of the values the receiver would see, based on this article plus RFC2812 commands. I'm working on improving calculations of this function to allow slightly longer messages based if the length of those values is at the maximum or not.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted (edited)

Update:

.
  IRC.au3            Fixed   : Updated Headers to UDF-spec (- instead of =)
  _IRCGetMsg         Fixed   : Incorrect Return Value On Error
  _IRCStripSpecial   Added   : Better documentation of Flags
  _IRCMultiSendMsg   Added   : Better documentation of Flags
  _IRCMultiSendMsg   Fixed   : Max Message Size based on https://forums.unrealircd.org/viewtopic.php?t=6811
  Updated all files to consider themselves a standalone install by default
  All Functions that didn't Return anything now return Number of bytes sent
  Slight Performance Improvements by using Parameter Gating instead of Single Input Single Output

 

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...