plug.hangouts

class immp.plug.hangouts.HangoutsUser(id_=None, plug=None, *, username=None, real_name=None, avatar=None, link=None, suggested=False, raw=None)

Bases: immp.core.message.User

User present in Hangouts.

classmethod from_user(hangouts, user)

Convert a hangups.user.User into a User.

Parameters
  • hangouts (HangoutsPlug) – Related plug instance that provides the user.
  • user (hangups.user.User) – Hangups user object retrieved from the user list.
Returns

Parsed user object.

Return type

HangoutsUser

classmethod from_entity(hangouts, entity)

Convert a hangups.hangouts_pb2.Entity into a User.

Parameters
  • hangouts (HangoutsPlug) – Related plug instance that provides the user.
  • user (hangups.hangouts_pb2.Entity) – Hangouts entity response retrieved from a hangups.hangouts_pb2.GetEntityByIdRequest.
Returns

Parsed user object.

Return type

HangoutsUser

class immp.plug.hangouts.HangoutsSegment(text, *, bold=False, italic=False, underline=False, strike=False, code=False, pre=False, link=None, mention=None)

Bases: immp.core.message.Segment

Plug-friendly representation of Hangouts message formatting.

classmethod from_segment(segment)

Convert a hangups.ChatMessageSegment into a Segment.

Parameters
segment (hangups.ChatMessageSegment) – Hangups message segment from the conversation event.
Returns
Parsed segment object.
Return type
HangoutsSegment
classmethod to_segments(segment)

Convert a Segment into one or more hangups.ChatMessageSegment instances. This will also attempt to create missing link segments for plain URLs within the text.

Parameters
segment (Segment) – Message segment created by another plug.
Returns
Unparsed segment objects.
Return type
hangups.ChatMessageSegment list
class immp.plug.hangouts.HangoutsFile(hangouts, title=None, type_=None, source=None)

Bases: immp.core.message.File

File attachment originating from Hangouts.

classmethod from_embed(hangouts, embed)

Convert a hangouts_pb2.PlusPhoto into a File.

Parameters
  • hangouts (HangoutsPlug) – Related plug instance that provides the file.
  • embed (hangups.hangouts_pb2.EmbedItem) – Photo or video inside a Hangups message event.
Returns

Parsed file object.

Return type

SlackFile

class immp.plug.hangouts.HangoutsMessage(*, text=None, user=None, edited=False, action=False, reply_to=None, joined=None, left=None, title=None, attachments=None, raw=None)

Bases: immp.core.message.Message

Message originating from Hangouts.

classmethod from_event(hangouts, event)

Convert a hangups.ChatMessageEvent into a Message.

Parameters
Returns

Parsed message object.

Return type

HangoutsMessage

class immp.plug.hangouts.HangoutsPlug(name, config, host)

Bases: immp.core.util.HTTPOpenable, immp.core.plug.Plug

Plug for Google Hangouts.