Giter Site home page Giter Site logo

hipchat-cli's People

Contributors

c3w avatar datashaman avatar dentarg avatar dkolbly avatar dkolbly-team avatar eirc avatar ekristen avatar estahn avatar graffic avatar ilikepi avatar jimsmith avatar jparise avatar kaorimatz avatar onnodb avatar powdahound avatar rberrelleza avatar skahlhoefer avatar withinfocus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hipchat-cli's Issues

HTML message broken

There seems to be some strange processing of HTML data for even basic messages:

echo "<a href='http://a.com'>A</a>" | hipchat-cli/hipchat_room_message

produces:

A
">http://a.com'>A

within the HipChat client. Is there something invalid about this HTML message?

Contribute CLI for setting status?

I have a Ruby program that sets the HipChat user's presence/show attribute (AKA, status). Would you be interested in pulling this if I submitted a PR?

New lines not converted

When sending message with new lines ( \n ) the content is not completely cleared resulting on non valid json send, and you get this message back :

{
  "error": {
    "code": 400,
    "message": "The request body cannot be parsed as valid JSON: Invalid control character at: line 1 column 121 (char 121)",
    "type": "Bad Request"
  }
}

Here is a quick fix. Replace this block line 100

# replace newlines with XHTML <br>
if [ $FORMAT == 'html' ]; then
    INPUT=$(echo -n "${INPUT}" | sed "s/$/\<br\>/")
    INPUT=$(echo -n "${INPUT}" | tr '\n' ' ')
fi

From name mandatory only under v1

The api v2 didn't need the From name switch but for the script is always mandatory.
I've simply modified the check at line 73

if [[ -z $TOKEN ]] || [[ -z $ROOM_ID ]] || [[ -z $FROM && $API == "v1" ]] ; then

in order to keep the check only for v1 api.

Alternate for Perl?

There is some processing/cleanup done using Perl. However, there are cases where Perl might not be available. Is there a SED or AWK alternative for the use of Perl?

Example:
perl -p -e "s/(?<!href=\"|href=')((?:https?|ftp|mailto)\:\/\/[^ \n]*)/\<a href=\"\1\"\>\1\<\/a>/g")

issues with config file

I'm having issues with getting the script to read the config file in /etc/hipchat, is there anything I need to do in order to get it to read the config file?

`img` tag incorrectly subject to URL replacement

According to the Hipchat API docs, the img tag is supported in html-formatted notification messages. Unfortunately, if the message input includes an img tag, this script will attempt to convert the value of the src attribute to an HTML anchor element. This is obviously undesirable, as it results in the posting of a malformed message.

The simplest fix would involve a tweak to the URL replacement regex to prevent it from acting on img tags. The following should suffice (though it could certainly be made more terse):

# replace bare URLs with real hyperlinks
INPUT=$(echo -n "${INPUT}" | perl -p -e "s/(?<!href=\"|href='|src=\"|src=')((?:https?|ftp|mailto)\:\/\/[^ \n]*)/\<a href=\"\1\"\>\1\<\/a>/g")

I'm happy to submit a patch to accomplish this, but I wanted to suggest a possible alternative first. I'm wondering if perhaps the URL replacement should be disabled for html-formatted messages. It's definitely helpful for text-formatted messages, but it seems more intuitive that an html-formatted message should be required to build links explicitly.

This would be a breaking change of course, but I'm not sure whether that is a concern for the use case of this script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.