MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / api_call_start

Function api_call_start

Scripts/ButSystem.py:14025–14064  ·  view source on GitHub ↗

api_call_start. Route handler or application helper. This docstring was expanded to make future maintenance easier. Args: peer: Parameter. Returns: Varies.

(peer: str)

Source from the content-addressed store, hash-verified

14023 # Mark any pending incoming DMs as delivered when the user opens the Chats list.
14024 # This enables 'delivered' ticks even before a chat is opened (seen).
14025 try:
14026 conn0 = db_connect()
14027 conn0.execute(
14028 "UPDATE dm_messages SET delivered_at=? WHERE recipient=? AND delivered_at IS NULL",
14029 (now_z(), me),
14030 )
14031 conn0.commit()
14032 conn0.close()
14033 except Exception:
14034 pass
14035
14036 cards, online_count, offline_count = user_cards(g.scope, exclude=me)
14037 _dm_total, unread_map = dm_unread_counts(me)
14038 # Self-chat ("Saved messages") is always available and should be pinned at the top.
14039 # We expose `self_has_pic` so templates can show either the profile picture or a fallback avatar.
14040 try:
14041 ensure_profile_row(me)
14042 conn = db_connect()
14043 prow = conn.execute("SELECT pic_path FROM profiles WHERE username=?", (me,)).fetchone()
14044 conn.close()
14045 self_has_pic = bool(prow and prow["pic_path"] and os.path.exists(prow["pic_path"]))
14046 except Exception:
14047 self_has_pic = False
14048 return render_template(
14049 "chats.html",
14050 title="Chats",
14051 me=me,
14052 users=cards,
14053 self_has_pic=self_has_pic,
14054 unread_map=unread_map,
14055 online_count=online_count,
14056 offline_count=offline_count,
14057 )
14058
14059@app.route("/chat/<username>")
14060@login_required
14061def chat_with(username: str):
14062 """chat_with.
14063
14064Route handler or application helper.
14065
14066This docstring was expanded to make future maintenance easier.
14067

Callers

nothing calls this directly

Calls 3

current_userFunction · 0.70
db_connectFunction · 0.70
now_zFunction · 0.70

Tested by

no test coverage detected