Example #1
0
 def do_action(self, message):
     self.send_btn(
         self._("End Chat?"),
         [b(self._("End"), END_CONVERSATION),
          b(self._("New Chat"), END_CONVERSATION_AND_SEARCH),
          b(self._("Share Your Profile"), SHARE_PROFILE_PRE)],
         action.TALKING__ACTION)
Example #2
0
 def send_matched(userc1, userc2, event):
     if userc1.user.version >= "2.0" and userc2.user.version >= "2.0":
         return userc1.send_action(fb.generic_template_itsb(
             userc1.user.id, userc1._(title), userc1._(subtitle),
             fb.profile_picture(userc2.user.fb_id),
             [b(userc1._("End Chat"), END_CONVERSATION),
              b(userc1._("Share Your Profile"),
                SHARE_PROFILE_PRE)]), event)
     else:
         return userc1.send_action(
             fb.generic_template_b(
                 userc1.user.id, userc1._(title),
                 userc1._(subtitle), [
                     b(userc1._("End Chat"), END_CONVERSATION),
                     b(userc1._("Share Your Profile"),
                       SHARE_PROFILE_PRE)]), event)
Example #3
0
    def end_conversation(self, message, partner_active=True,
                         event=action.TALKING__END_CHAT, with_btn=True):
        me = self.user
        partner = self.user.partner
        partner_c = UserContext(partner)
        pid = partner.id
        me.partner = None
        self.delegate.on_match_ended(self, partner_c)
        if with_btn:
            if self.user.version < "2.0":
                text = self._("Chat ended.") + "\n" + self._(
                    "Do you want to start a new chat?\n"
                    "Each other's profile picture will be shared when matched with someone new."
                )
                self.user.version = "2.0"
            else:
                text = self._("Chat ended.")
            self.send_btn(text, [self.new_chat(), self.langb(),
                                 b(self._("Report"),
                                   "PREREPORT-{}".format(pid))], event)
        else:
            self.send_message(self._("Chat ended."), event)

        if partner and partner_active:
            if partner.version < "2.0":
                text = partner_c._(
                    "Stranger has disconnected.") + "\n" + partner_c._(
                    "Do you want to start a new chat?\n"
                    "Each other's profile picture will be shared when matched with someone new."
                )
                partner.version = "2.0"
            else:
                text = partner_c._("Stranger has disconnected.")
            partner_c.send_btn(
                text, [partner_c.new_chat(), partner_c.langb(),
                       b(partner_c._("Report"), "PREREPORT-{}".format(me.id))],
                action.TALKING__END_CHAT_PASSIVE)
Example #4
0
 def share_profile(self, message):
     pc = UserContext(self.user.partner)
     link = fb.profile_link(self.user.fb_id)
     pc.send_action(
         fb.generic_template_ib(
             pc.user.id,
             pc._("Profile shared."),
             fb.profile_picture(self.user.fb_id),
             link,
             [
                 fb.web_button(pc._("View Profile"), link, link, "tall"),
                 b(pc._("Share Your Profile"), SHARE_PROFILE_PRE)
             ],
         ), action.TALKING__SHARED_PROFILE_PASSIVE)
     self.send_message(self._("Shared."),
                       action.TALKING__SHARED_YOUR_PROFILE)
Example #5
0
 def share_profile_pre(self, message):
     self.send_btn(self._(
         "Send a link to your Facebook profile?"
     ), [b(self._("Send"), SHARE_PROFILE)],
         action.TALKING__SHARE_PROFILE_PRE)
Example #6
0
 def do_action(self, message):
     self.send_btn(
         self._("Finding someone new...\n"
                "Want to interrupt searching?"),
         [b(self._("Interrupt searching"), CANCEL_SEARCH)],
         action.SEARCHING__ACTION)
Example #7
0
 def new_chat(self):
     return b(self._("New Chat"), SEARCH)
Example #8
0
def prereport_user(user_c, target):
    user_c.send_btn(
        user_c._("If the person you chatted with was a malicious user,"
                 " you can report them via the [Report] button."),
        [b(user_c._("Report"), "REPORT-{}".format(target))],
        action.PREREPORTED_USER)